Multiple Choice Questions - Java Data Types
1. . . . . data type is used to save space in large arrays, mainly in place of integers, since a . . . . is four times smaller than an int.
B) long int
D) all of above
2. Which of the following declaration of variable of type int is correct
A) a = 1;
B) b = 2;
C) c = a + b;
D) all of above
3. Java provides a character data type called char. The char type assumes a size of . . . bytes and it can hold only a single character.
4. Default value of any reference variable is . . . . . .
5. You can declare a variable only once in a method.
6. The set of values that can be represented with a primitive type is limited to a specific interval. By applying arithmetic operators to values of a given data type, one could obtain a result that falls outside of this interval, and hence cannot be represented with the same primitive data type. This situation is termed as . . . . . .
7. . . . . . . are similar to Arrays, except that you can grow and shrink an . . . . . as needed. Strings are the main type stored in . . . . . .
A) ArrayMethods, ArrayMethod, ArrayMethods
B) ArrayClasses, ArrayClasse, ArrayClasses
C) ArrayLists, ArrayList, ArrayLists
D) ArrayPiPes, ArrayPiPe, ArrayPiPes
8. A variable can be assigned and re-assigned values only one time after it is declared.
9. Float and double types can also represent four special values:
A) positive infinity, negative infinity, Zero, NaN
B) infinity, Null, Zero, NaN
C) empty, Null, Zero, NaN
D) int, Null, Zero, NaN
10. Floating point literals cannot be expressed in hexadecimal or octal notation.
1) c, 2) d, 3) b, 4) d, 5) a, 6) a, 7) c, 8) b, 9) a, 10) a