| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice TestPractice Test
Share
About Exam
medium Solved by 5 students
2D Array Column Extraction
< Prev
Next >

Consider the following client code and method:

int[][] numbers = {{10, 20, 30}, {40, 50, 60}, {70, 80, 90}, {100, 110, 120}};
int[] myArr = mystery(numbers, 1);
for (int j: myArr)
   System.out.print(j + " ");

public static int[] mystery(int[][] arr, int n)
{
   int[] m = new int[arr.length];
   for (int i = 0; i < arr.length; i++)
      m[i] = arr[i][n];
   return m;
}

What will be printed after the code executes?

A

20 60 80 110

B

20 50 80 110

C

10 40 70 100

D

40 50 60

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

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy