
Slides8.1_RowMajor_and_ColumnMajor
Presentation
•
Computers
•
11th Grade
•
Practice Problem
•
Easy
Lauren Wheelwright
Used 1+ times
FREE Resource
4 Slides • 4 Questions
1
Multiple Choice
String[][] x = { {"A", "S" }, {"P" ,"C"} };
Which of the following Strings will store "APCSA"?
String a = x[0][0] + x[1][0] + x[1][1] + x[0][1] + x[0][0];
String b = x[0][0] + x[1][1] + x[0][1] + x[1][0] + x[0][0];
2
Multiple Choice
Print the sum of the four corners of a 3x8 2D array:
int[][] arr = new int[3][8];
System.out.println(arr[0][0] + arr[2][0] + arr[2][7] + arr[0][7]);
System.out.println(arr[0][0] + arr[3][0] + arr[3][8] + arr[0][8]);
3
Row-major vs Column-Major
int[][] x = {
{1,2,3,4},
{5,6,7,8}
}
Row-major
Column-major
1 2 3 4 5 6 7 8
1 5 2 6 3 7 4 8
4
Multiple Choice
What's the column-major order of the following array?
int[][] x = { {2,4,6}, {8,10,12}, {14,16,18} };
2 4 6 8 10 12 14 16 18
2 8 14 4 10 16 6 12 18
2 10 18 4 8 14 6 12 18
5
Multiple Choice
After the code below executes, what's the row-major order for x?
boolean[][] x = new boolean[3][2];
x[0][1] = true;
x[2][0] = true;
false false true true false false
false true false false true false
6
Project 8.1 - 8.1.6 Complete Chessboard
You could initialize every element either on its own line or in a loop:
int[][] arr = new int[8][8];
arr[0][0] = "Rook";
...
for (int i = ___; i < ___; i++) {
arr[?][?] = "Pawn";
}
You could initialize the whole 2D array at once:
int[][] arr = { {"Rook", "Knight", ...}, {...}, ... };
OR
7
Project 8.1 - 8.1.7 Tic Tac Toe Board
Initialize a tic-tac-toe board with dashes:
[
["-", "-", "-"],
["-", "-", "-"],
["-", "-", "-"]
]
For each row:
For each column:
arr[row][col] = "-";
8
Matrix operations
1 | 2 | 3 |
|---|---|---|
4 | 5 | 6 |
7 | 8 | 9 |
String[][] x = { {"A", "S" }, {"P" ,"C"} };
Which of the following Strings will store "APCSA"?
String a = x[0][0] + x[1][0] + x[1][1] + x[0][1] + x[0][0];
String b = x[0][0] + x[1][1] + x[0][1] + x[1][0] + x[0][0];
Show answer
Auto Play
Slide 1 / 8
MULTIPLE CHOICE
Similar Resources on Wayground
7 questions
Pengalamatan Jaringan CIDR
Presentation
•
11th Grade
8 questions
HỆ ĐIỀU HÀNH
Presentation
•
11th Grade
10 questions
Introducción al diseño web
Presentation
•
11th Grade
5 questions
Administrasi Sistem Jaringan
Presentation
•
11th Grade
5 questions
LA EDUCACIÓN VIRTUAL
Presentation
•
11th Grade
7 questions
Inductive Reasoning
Presentation
•
10th - 11th Grade
6 questions
QUIZ KOMPUTER AKUNTANSI
Presentation
•
12th Grade
6 questions
الوسائط المتعددة
Presentation
•
10th Grade
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Assessment 2
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
12 questions
2026 TAP Technology in the Classroom
Presentation
•
Professional Development
15 questions
HCS SCI 05 Summer School Assessment 2 Review
Quiz
•
5th Grade
15 questions
HCS SCI 04 Summer School Review 2
Quiz
•
4th Grade
59 questions
Geometry Unit 3 Review
Quiz
•
9th - 12th Grade
14 questions
FAST ELA READING SMAPLE TEST MATERIALS
Passage
•
3rd Grade