
2D Arrays in Java Quiz
Authored by Mister Swagner
Computers
12th Grade
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you declare a 2D array in Java?
`int[][] array2D;`
`int array2D[][];`
`int[2][2] array2D;`
Both A and B are correct.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to initialize a 2D array in Java?
`int[][] array2D = new int[2][2];`
`int array2D[][] = {{1, 2}, {3, 4}};`
`int[][] array2D = {{1, 2}, {3, 4}};`
All of the above.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you access the first element in the second row of a 2D array named `array2D`?
`array2D[1][0];`
`array2D[0][1];`
`array2D[2][1];`
`array2D[1][1];`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does `array2D.length` return for a 2D array named `array2D`?
The number of columns in the array.
The number of rows in the array.
The total number of elements in the array.
The length of the first row.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you iterate through all elements of a 2D array named `array2D` using a nested for loop?
`for(int i = 0; i < array2D.length; i++) { for(int j = 0; j < array2D[i].length; j++) { // access element } }`
`for(int i = 0; i < array2D.length; i++) { for(int j = 0; j < array2D.length; j++) { // access element } }`
`for(int i = 0; i < array2D[0].length; i++) { for(int j = 0; j < array2D.length; j++) { // access element } }`
`for(int i = 0; i < array2D.length; i++) { for(int j = 0; j < array2D[0].length; j++) { // access element } }`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to pass a 2D array named `array2D` to a method in Java?
`public void processArray(int[][] array2D) { // process array }`
`public void processArray(int array2D[][]) { // process array }`
`public void processArray(int[] array2D[]) { // process array }`
All of the above.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements will correctly create a 2D array with 3 rows and 2 columns?
`int[][] array2D = new int[3][2];`
`int array2D[][] = new int[2][3];`
`int[] array2D = new int[3][2];`
`int[][] array2D = new int[][3];`
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Elements and Principles
Quiz
•
9th - 12th Grade
15 questions
Algoritmos Simples
Quiz
•
12th Grade
15 questions
Excel
Quiz
•
12th Grade
20 questions
Administrasi Infrastruktur Jaringan - Firewall - Proxy - Bandwidth - PTS Gasal
Quiz
•
12th Grade
15 questions
Casting in Java
Quiz
•
11th - 12th Grade
20 questions
PLC
Quiz
•
12th Grade - Professi...
17 questions
Первое весеннее занятие
Quiz
•
1st - 12th Grade
22 questions
C# start
Quiz
•
11th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade