AP Computer Science Aeasymcq1 pt

Which declaration creates a 2D array with 2 rows and 5 columns?

A.int[][] a = new int[2][5];
B.int[][] a = new int[5][2];
C.int[2][5] a;
D.int[][] a = new int[2, 5];

Explanation

Core Concept

The row size is first.

Correct Answer

Aint[][] a = new int[2][5];

More Unit 8: 2D Array practice questions

Try a random question →

Practice more AP Computer Science A questions with full explanations

Practice Unit 8: 2D Array Questions →