1Z0-811 Arrays and Methods Practice Question
A programmer writes code to transpose a 2D array (matrix). Given: int[][] matrix = {{1,2},{3,4}}; int[][] result = new int[2][2]; for (int i=0; i<2; i++) for (int j=0; j<2; j++) result[j][i] = matrix[i][j]; What is the value of result[1][0]?
⚠ Common exam trap
Watch out — candidates often confuse the indices: candidates often mistakenly think result[1][0] corresponds to matrix[1][0] (value 3) instead of correctly swapping to matrix[0][1] (value 2).
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
2
The code transposes the matrix by assigning matrix[i][j] to result[j][i]. For result[1][0], we need the value where j=1 and i=0, which comes from matrix[0][1] = 2. Thus, result[1][0] = 2, making option C correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
4
Why it's wrong here
That is result[1][1].
- ✗
3
Why it's wrong here
That is result[0][1].
- ✓
2
Why this is correct
After transpose, result[1][0] equals original matrix[0][1].
- ✗
1
Why it's wrong here
That is result[0][0].
Go deeper
Related to this question
About these practice questions
This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.