
AL-Two-Dimensional Array
Authored by Arasaka Teacher
Computers
9th - 12th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
13 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
3 mins • 1 pt
Modify the top-right element of a 2D array to 1:
public class TwoDArrayOperations {
public static int[][] changeTopRight(int[][] arr) {
// Modify the top - right element to 1
return arr;
}
2.
DRAG AND DROP QUESTION
1 min • 1 pt
Calculate the sum of all even numbers in a 2D array
public static int sumEvenNumbers(int[][] arr) {
int sum = 0;
(a) {
(b) {
// 填写代码...
(c) {
(d) ;
}
}
}
return sum;}
3.
FILL IN THE BLANK QUESTION
3 mins • 2 pts
Find the maximum value in a 2D array
// 3. Count the number of all odd numbers in a 2D array
public static int countOddNumbers(int[][] arr) {
int count = 0;
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
______
{
_____
}
}
}
return count;
}
Answer explanation
countOddNumbers: Iterates through each element of the 2D array and checks if it is odd. If it is, increments the count.
countOddNumbers: Iterates through each element of the 2D array and checks if it is odd. If it is, increments the count.
4.
FILL IN THE BLANK QUESTION
1 min • 2 pts
// 4. Calculate the sum of each row in a 2D array
public static int[] sumEachRow(int[][] arr) {
int[] rowSums = new int[arr.length];
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
————————
;
}
}
return rowSums;
}
5.
FILL IN THE BLANK QUESTION
3 mins • 2 pts
// 5. Calculate the sum of each column in a 2D array
public static int[] sumEachColumn(int[][] arr) {
int[] colSums = new int[————————];
for (int j = 0; j < arr[0].length; j++) {
for (int i = 0; i < arr.length; i++) {
——————————;
}
}
return colSums;
}
6.
FILL IN THE BLANK QUESTION
3 mins • 1 pt
// 6. Find the maximum value in a 2D array
public static int findMax(int[][] arr) {
int —————— = arr[0][0];
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
if (_______) {
max = arr[i][j];
}
}
}
return max;
}
7.
FILL IN THE BLANK QUESTION
2 mins • 3 pts
// 7. Find the minimum value in a 2D array
public static int findMin(int[][] arr) {
int min = arr[0][0];
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
_______ {
min = arr[i][j];
}
}
}
return min;
}
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
13 questions
Direcciones IP v4
Quiz
•
10th - 12th Grade
10 questions
JSPS Competition Hackathon - Scratch Language - Grade 1
Quiz
•
2nd Grade - University
14 questions
Input, output and storage de
Quiz
•
8th Grade - Professio...
16 questions
BÀI 7 - TIN 12
Quiz
•
12th Grade
10 questions
TIN 11 - PYTHON - PHÉP TOÁN - BIỂU THỨC - CÂU LỆNH GÁN
Quiz
•
11th Grade
10 questions
QBASIC Programming
Quiz
•
5th - 10th Grade
10 questions
Cos’è la ROM?
Quiz
•
6th - 12th Grade
10 questions
Bài 13-Bổ sung các đối tượng đồ hoạ
Quiz
•
10th Grade
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade