← All topics
Quiz: Java Arrays: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. What is the last valid index of an array with length 10?
- Q3. What does this print? (code)
- Q4. Which prints the contents of int[] nums as [1, 2, 3]?
- Q5. What does grid.length give for int[][] grid = new int[3][5];?
- Q6. What does this print? (code)
- Q7. int[] a = new int[5]; What happens at a[a.length] = 1;?
- Q8. What does this print? (code)
- Q9. What does each element of new String[3] hold before you assign anything?
- Q10. What does this print? (code)