Page 152 - Computer science 868 Class 12
P. 152
4. Which of the following is NOT the Integer data type?
a. int b. double
c. byte d. long
5. Which of the following is an arithmetic statement?
a. a+b b. x-y+z/k
c. e = a+b+9 d. All of these
Answers
1. a 2. d 3. c 4. b 5. c
B. Fill in the blanks:
1. There are ………………… types of conversions in Java.
2. ………………… conversion is done automatically.
3. ………………… is a method of converting a primitive data type value into an object of the corresponding wrapper class.
4. Wrapper classes included in Java library package are known as ………………… .
5. ………………… data type is not compatible with any other primitive data type.
6. In …………………, a value of a larger data type is converted into a smaller data type but only with the help of the user’s intervention.
Answers
1. two 2. Implicit 3. Autoboxing 4. Java.lang 5. Boolean 6. explicit conversion
C. Answer the following questions:
1. What is narrowing?
Ans. The process of assigning a value of a larger data type to a smaller data type using explicit type conversion is known as narrowing.
2. What type of conversion is depicted in the following program snippet?
int I = 65;
char ch = (char)I;
Ans. This is explicit data type conversion.
3. What does a floating-point represent?
Ans. Floating point data types represent the numbers with a fractional part such 3.4f or 56.2f.
4. What is the size of the char data type?
Ans. The char data type occupies two bytes of memory space in Java.
5. Give some examples of non-primitive data types.
Ans. Examples of non-primitive data types are
a. String b. Object
c. Class d. Array
e. Interface
D. Assertion and Reasoning Based Question.
Assertion: Applets are the codes in Java.
Reason: Applets are downloaded from a website on a client computer and can be executed within multiple web browser.
(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.
Ans. (c) Applets are the codes in Java that are downloaded from a website on a client computer and can only be executed within a web
browser.
150150 Touchpad Computer Science-XII

