Java Array MCQs with answers
80 questions tagged Java Array, each with the correct answer and an explanation. Page 1 of 4.
- Which of the following arrays is correctly initialized with values?
- Which import is required for Arrays.sort()?
- Which of the following can store null values?
- What happens if you assign an array to another variable?
- How can you increase the size of an array in Java?
- Which of the following arrays will throw an exception when accessed?
- Which method copies part of an array into a new one?
- What will this print? String[] names = new String[2]; names[1] = "John"; System.out.println(names[0]);
- Can we store mixed types in a single array in Java?
- How to iterate through a String array using enhanced for loop?
- What will be the output? int[] x = {1, 2, 3}; System.out.println(x.length);
- How are multidimensional arrays implemented in Java?
- Which property is used to get the size of an array?
- Which of the following best describes an array?
- Which of these is the correct syntax to declare an array of doubles?
- Which class contains utility methods for array operations?
- Which keyword is used to allocate memory for an array?
- What is printed? int[] a = new int[3]; a[0] = 5; System.out.println(a[0]);
- Which of the following creates a jagged array in Java?
- What is the result of this code? int[] arr = new int[]{1, 2, 3}; System.out.println(arr[3]);