Page 56 - CA_Blue( J )_Class10
P. 56
9. Classify the following as primitive or non-primitive data types:
a. char b. arrays
c. int d. classes [2018]
Ans. a. char: primitive data type. b. arrays: non-primitive data type.
c. int: primitive data type. d. classes: non-primitive data type.
10. int res = 'A';
What is the value of res? [2018]
Ans. The value of res is 65. As the ASCII value of character 'A' is 65.
11. Name the operators listed below:
a. < b. ++
c. && d. ?: [2017]
Ans. a. < (Less than operator) b. ++ (Increment operator)
c. && (Logical AND operator) d. ?: (Conditional or Ternary operator)
12. State the number of bytes occupied by char and int data types. [2017]
Ans. char (2 bytes) and int (4 bytes)
13. What are keywords? Give an example. [2016]
Ans. Keywords are the pre-defined words that are reserved by the Java compiler for a specific purpose.
Example: public
14. Write one difference between primitive data type and non-primitive data type. [2016]
Ans.
Primitive Data Type Non-Primitive Data Type
They are built-in data types. They are user-defined data types.
To use them "new" operator is not required. The use of "new" operator is mandatory.
15. What are the types of casting shown by the following examples? [2016]
Ans. a. char c = (char)120; //(Explicit type casting) b. int x = 't'; //(Implicit type casting)
16. What are the default values of the primitive data type int and float? [2015]
Ans. a. Default value of int is 0.
b. Default value of float is 0.0F.
17. Identify the literals listed below:
a. 0.5 b. 'A'
c. false d. "a" [2015]
Ans. a. 0.5 Floating-point Literal b. 'A' Character Literal
c. false Boolean Literal d. "a" String Literal
18. Arrange the following primitive data types in ascending order of their size:
a. char b. byte
c. double d. int [2015]
Ans. byte < char < int < double
19. Name the primitive data type in Java that is:
a. a 64-bit integer and is used when you need a range of values wider than those provided by int.
b. a single 16-bit Unicode character whose default value is '\u0000'. [2014]
Ans. a. long b. char
20. State one difference between float and double. [2014]
Ans. float double
Occupies 32 bits Occupies 64 bits
5454 Touchpad Computer Applications-X

