| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice Test
Share
easy Solved by 16 students
2D Array Initialization Type Mismatch
< Prev
Next >

What kind of error will this code produce?

public class Arr2D{
   private int [][] arr;
   Arr2D( int rows, int columns){
     arr = new String[rows][columns];
   }
}
A

ArrayIndexOutOfBoundsException during execution.

B

Runtime error because the array is not initialized properly.

C

No error; the code compiles and runs as intended.

D

Compilation error due to type mismatch: cannot convert String[][] to int[][].

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2psak1211 0m 26s 74
#3y.seong202722 2m 35s 45
#4dobaonam838612 0m 58s 32
#5singhris00011 1m 16s 24
#6ponneban00012 1m 27s 3
#7mullameh00134 7m 30s -160
#8ajcantuwilson032511 16m 54s -914
#9geethasailaja12 20m 57s -1,167
APFIVE © 2020.
Email: [email protected]|Privacy Policy