Page 340 - CA_Blue( J )_Class10
P. 340
9. Write the difference of the following:
a. Character.isUpperCase(char) and Character.toUpperCase(char)
b. isWhitespace() and is.LetterOrDigit()
Ans. a. Character.isUpperCase(char) Character.toUpperCase(char)
Checks whether the character is in uppercase or not. Converts the character to uppercase.
Returns char data type. Returns boolean data type.
b. isWhitespace() is.LetterOrDigit()
Checks whether the character is a space or not. Checks whether the character is a letter/digit or not.
10. What is the output of the following?
a. System.out.println(Character.isLetter('x')); b. System.out.println(Float.parsefloat("58"));
Ans. a. true b. 58.0
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): Primitive data types in Java are the fundamental data types used to store simple values.
Reason (R): Primitive data types directly hold their values and are not objects. They are predefined by the language and are not
composed of other data types.
2. Assertion (A): Primitive data types are null.
Reason (R): Primitive data types cannot have a null value. They always hold a valid value.
Ans. 1. a 2. d
21 st
E. Case-based questions. Century #Experiential Learning
Skills
1. Autoboxing simplifies the process of converting primitive data types into objects by allowing the compiler to insert the necessary
code automatically. Unboxing simplifies the process of extracting primitive values from objects by allowing the compiler to insert
the necessary code automatically.
i. What does unboxing in Java refer to?
a. Converting objects into primitive data types
b. Converting primitive data types into objects automatically
c. Extracting primitive values from objects automatically
d. Inserting code for converting primitive data types into objects
ii. What does the compiler do during autoboxing and unboxing?
a. It removes unnecessary code
b. It inserts code to convert objects into primitive data types
c. It inserts code to convert primitive data types into objects
d. It inserts necessary code automatically
2. In Java, data types can be categorized into primitive and composite (reference) data types.
Primitive Data Types: These are the most basic data types provided by Java. They are used to store simple values.
byte, short, int, long, float, double, char and Boolean are different types of primitive data types.
Composite data types, also known as reference types, are used to store complex objects.
The following are different types of Composite data. 1. Arrays 2. Classes 3. Interfaces and Strings
i. What are the two main categories of data types in Java?
a. Simple and Complex data types b. Primary and Secondary data types
c. Primitive and Composite data types d. Basic and Advanced data types
ii. Which of the following are primitive data types in Java?
a. byte, int, float, String b. short, double, char, Boolean
c. int, long, String, double d. float, char, double, Boolean
338338 Touchpad Computer Applications-X

