Page 153 - Computer science 868 Class 12
P. 153
Unsolved Questions
A. Tick ( ) the correct option:
1. What is the size of the short data type?
a. 2 bytes b. 8 bytes
c. short d. long
2. The default value of the double data type is ………………… .
a. 0 b. 0d
c. d0 d. 0.0d
3. The long data type is a ………………… unsigned integer.
a. 64-bit b. 16-byte
c. 8-bit d. None of these
4. Which of the following is NOT a Wrapper class in Java.lang package?
a. double b. float
c. character d. string
5. Which of the following syntaxes helps to use a Wrapper class?
a. String Variable = <Wrapper class>.toString(<datatype>);
b. <datatype> Variable = <Wrapper class>.parse<Wrapper class>(String);
c. <datatype> Variable = <Wrapper class>.valueOf(String);
d. All of the above
B. Fill in the blanks:
1. The size of ………………… data type is 1 byte.
2. Wrapper class of int data type is ………………… .
3. There are ………………… wrapper classes in Java.lang package.
4. Conversion done by force is called ………………… .
5. When an expression contains different types of data values and yields a result, then that type of expression is known as …………………
expression.
C. Answer the following questions:
1. What is widening with respect to typecasting?
2. What is autoboxing? Write an example of autoboxing.
3. What are the character sets of Java?
4. What is unboxing? Write an example of unboxing.
5. Give three differences between primitive and non-primitive data types.
6. What are wrapper classes?
D. Assertion and Reasoning Based Question.
Assertion: The data type in Java indicates the way the values of the variable are saved in memory.
Reason: Each variable must be declared with a data type that will decide what type of value the variable will hold.
(a) Both Assertion and Reason are true, and Reason is the correct explanation for Assertion.
(b) Both Assertion and Reason are true, but Reason is not the correct explanation for Assertion.
(c) Assertion is true and Reason is false.
(d) Assertion is false and Reason is true.
151
Primitive Values, Wrapper Classes, Types and Casting 151

