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.
A) char
B) long int
C) byte
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.
A) 1
B) 2
C) 3
D) 4
4. Default value of any reference variable is . . . . . .
A) 0
B) empty
C) gibberish
D) null
5. You can declare a variable only once in a method.
A) True
B) False
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 . . . . . .
A) overflow
B) infinite
C) exception
D) underflow
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.
A) True
B) False
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.
A) True
B) False
Answers