This collection of Java Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “Data structures (Arrays)”.
1. What is the type of variables “b” and “d” in the following code?
int a, b; int c, d;
A ‘b’ and ‘d’ are of type int
B ‘b’ and ‘d’ are arrays of type int
C ‘b’ is a variable of type int; ‘d’ is an array of type int
D ‘d’ is a variable of type int; ‘b’ is an array of type int
2. Which of the following statements is incorrect?
int arr; arr = new int;
int arr = int  new;
int  arr = new int;
int arr = new int ;
3. What does this code display?
int arr = new int ; System.out.print(arr);
C value stored in arr
D Garbage value
4. What does this code display?
Object cars = new String; cars = new Integer(0);
A The code runs successfully
B Compilation error
5. Generic type in java does not work with _______?
6. How to sort an array?
7. How to copy the contents of an array?
8. Can you make an array volatile?
9. The elements of an array is always stored in ________ memory?
B Sequential and random
D Binary search
10. Array are stored in which memory space?
A heap space
B stack space
C heap space and stack space
D first generation memory