
CAI710: WQ1
Authored by Ayesha Abdullah
Computers
12th Grade
Used 65+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What are the contents of mat after the code segment has been executed?
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
A two-dimensional array arr is to be created with the following contents.
boolean[][] arr = {{false, true, false} ,
{false, false, true}};
Which of the following code segments can be used to correctly create and initialize arr ?
boolean arr[][] = new boolean[2][3];
arr[0][1] = true;
arr[1][2] = true;
boolean arr[][] = new boolean[2][3];
arr[1][2] = true;
arr[2][3] = true;
boolean arr[][] = new boolean[3][2];
arr[0][1] = true;
arr[1][2] = true;
boolean arr[][] = new boolean[3][2];
arr[1][0] = true;
arr[2][1] = true;
boolean arr[][] = new boolean[3][2];
arr[2][1] = true;
arr[3][2] = true;
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Consider the following code segment, which is intended to declare and initialize the two-dimensional (2D) String array things.
/* missing code */ = {{"spices", "garlic", "onion", "pepper"},
{"clothing", "hat", "scarf", "gloves"},
{"plants", "tree", "bush", "flower"},
{"vehicles", "car", "boat", "airplane"}};
Which of the following could replace /* missing code */ so that things is properly declared?
new String[][] things
new(String[][]) things
String[] String[] things
String[][] things
[][]String things
4.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Consider the following code segment.
int[][] array2D = {{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12},
{13, 14, 15, 16}};
for (int[] i : array2D){
for (int x : i){
System.out.print(x + " ");
}
System.out.println(" ");
}
How many times will the statement System.out.print(x + " ") be executed?
3 times
4 times
6 times
12 times
16 times
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Assume that a two-dimensional (2D) array arr of String objects with 3 rows and 4 columns has been properly declared and initialized.
Which of the following can be used to print the elements in the four corner elements of arr ?
System.out.print(arr[0, 0] + arr[0, 3] + arr[2, 0] + arr[2, 3]);
System.out.print(arr[1, 1] + arr[1, 4] + arr[3, 1] + arr[3, 4]);
System.out.print(arr[0][0] + arr[0][2] + arr[3][0] + arr[3][2])
System.out.print(arr[0][0] + arr[0][3] + arr[2][0] + arr[2][3]);
System.out.print(arr[1][1] + arr[1][4] + arr[3][1] + arr[3][4]);
6.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Consider the following code segment, where letters is a two-dimensional (2D) array that contains possible letters. The code segment is intended to print "DIG".
String[][] letters = {{"A", "B", "C"},
{"D", "E", "F"},
{"G", "H", "I"}};
System.out.println( /* missing code */ );
Which of the following could replace /* missing code */ so that the code segment works as intended?
letters[1][0] + letters[2][2] + letters[2][0]
letters[2][1] + letters[3][3] + letters[3][1]
letters[2][0] + letters[2][2] + letters[1][0]
letters[1][2] + letters[3][3] + letters[1][3]
letters[0][1] + letters[2][2] + letters[0][2]
7.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Consider the following code segment, where nums is a two-dimensional (2D) array of integers. The code segment is intended to print "test1234".
System.out.print("test" + nums[0][0] + nums[1][0] + nums[1][1] + nums[0][1]);
Which of the following code segments properly declares and initializes nums so that the code segment works as intended?
int[][] nums = {{1, 2}, {3, 4}};
int[][] nums = {{1, 4}, {2, 3}};
int[][] nums = {{1, 2}, {4, 3}};
int[][] nums = {{1, 3}, {2, 4}};
int[][] nums = {{1, 4}, {3, 2}};
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
10 questions
Trắc nghiệm Tin học 12 - Bài 3 Cấu trúc bảng
Quiz
•
12th Grade
10 questions
Conosci Eoc-Desk?
Quiz
•
1st - 12th Grade
10 questions
Bài 10-Thực hành khai thác tài nguyên trên Internet
Quiz
•
10th - 12th Grade
10 questions
Microcontroller
Quiz
•
11th Grade - University
13 questions
CCIS 104 Quiz #1.2
Quiz
•
12th Grade
10 questions
BRIKER IP-PBX
Quiz
•
12th Grade
10 questions
ZOOM QUIZ
Quiz
•
1st - 12th Grade
10 questions
X.4_Project2_SMANSA
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade