Page 342 - CA_Blue( J )_Class10
P. 342
B. Fill in the blanks.
1. Output of Character.isLetter('5') is ………………….
2. The Character.isLowercase(char) method checks whether the character in the parameter is in ………………….
3. The Double.parseDouble() method is same as ………………….
4. To convert a String to Integer, we use ………………… method.
5. The toLowerCase() method returns ………………… data type.
C. Answer the following questions:
1. Write the output of the following:
a. char ch='E'; b. String str=”39.6”;
boolean t=Character.isUpperCase(ch); double d= Double.parseDouble(str);
System.out.println(ch+ “ : “ + t); System.out.println(str+(d+100));
2. What is the difference between parseInt() and toString()?
3. What is the use of the following methods?
a. Float.parseFloat() b. Character.isDigit()
4. What is Wrapper class? Give one example.
5. What is Autoboxing and Unboxing?
D. Assertion and Reasoning based questions.
The following questions consist of two statements – Assertion (A) and Reason (R). Answer these questions by selecting the
appropriate option given below:
a. Both A and R are true, and R is the correct explanation of A.
b. Both A and R are true, but R is not the correct explanation of A.
c. A is true, but R is false.
d. A is false, but R is true.
1. Assertion (A): Character.isLetter(): It is a Character wrapper class method.
Reason (R): It checks whether a character'n' is a digit or not.
2. Assertion (A): Character.toUpperCase(ch): It converts a character "ch" to Upper Case.
Reason (R): If the character is in UpperCase, then there will be no change.
3. Assertion (A): Integer.parseInt(String): Converts an integer to string
Reason (R): Integer is a wrapper class.
21 st
E. Case-based questions. Century #Experiential Learning
Skills
1. The String.valueOf() method converts different types of values, including primitive data types, to their string representations.
int num = 20;
String str = String.valueOf(num); // Convert int to String
Wrapper classes for primitive data types provide toString() methods to convert values
to strings.
double value = 3.14;
String str = Double.toString(value); // Convert double to String
i. Which of the following statements regarding converting primitive data types to strings in Java is true based on the provided
paragraph?
Statement 1: The String.valueOf() method can only convert primitive data types to strings.
Statement 2: toString() methods provided by wrapper classes can convert primitive data types to strings
a. Statement 1 is true, and Statement 2 is false. b. Statement 1 is false, and Statement 2 is true.
c. Both Statement 1 and Statement 2 are true. d. Both Statement 1 and Statement 2 are false.
ii. What does the String.valueOf() method do in Java?
a. Converts strings to primitive data types b. Converts primitive data types to strings
340340 Touchpad Computer Applications-X

