Consider the code to the left.
What is printed out as a result of executing this code?
Unit 5 - Two-Dimensional Arrays
Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Terresa Uzzle
Used 8+ times
FREE Resource
19 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the code to the left.
What is printed out as a result of executing this code?
H
L
M
N
ArrayIndexOutOfBounds
2.
MULTIPLE CHOICE QUESTION
1 min • 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 "PIG".
String[][] letters = { {"A", "B", "C", "D"},
{"E", "F", "G", "H"},
{"I", "J", "K", "L"},
{"M", "N", "O", "P"}};
System.out.println( /* missing code */ );
Which of the following could replace /* missing code */ so that the code segment works as intended?
letters[4][4] + letters[3][1] + letters[2][3]
letters[3][3] + letters[2][0] + letters[1][2]
letters[4][3] + letters[3][0] + letters[2][2]
letters[3][3] + letters[0][2] + letters[2][1]
letters[4][4] + letters[1][3] + letters[3][2]
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following two-dimensional array words.
String[][] words = { {"about", "actor", "admit", "agile"},
{"badge", "basic", "berry", "bingo"},
{"cacti", "cedar", "chair", "close"}};
What is the fifth element visited when row-major traversal is performed on words?
about
agile
badge
basic
cedar
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the Code segment to the left:
What is printed when num has the value 5?
4 1 3
5 6 8
6 7 9
8 5 7
9 6 8
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the Code segment to the left:
What is printed when num has the value 5?
4 1 3
5 6 8
6 7 9
8 5 7
9 6 8
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following two-dimensional array words.
String[][] words = { {"about", "actor", "admit", "agile"},
{"badge", "basic", "berry", "bingo"},
{"cacti", "cedar", "chair", "close"}};
What is the fifth element visited when column-major traversal is performed on words?
about
agile
badge
basic
cedar
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the code to the left:
Which of the following is the reason why an exception is thrown when the code is executed?
The row index is out of range because the for loop on line 5 iterates one time too many.
The column index is out of range because the for loop on line 6 iterates one time too many.
The column index is out of range because the indexes are in the wrong order.
The row index is out of range because the indexes are in the wrong order.
20 questions
APCSA Arrays
Quiz
•
9th - 12th Grade
20 questions
CS Python Fundamentals Test 9 PRACTICE
Quiz
•
9th - 12th Grade
15 questions
Area With Arrays
Quiz
•
10th - 12th Grade
15 questions
Area and Arrays
Quiz
•
10th - 12th Grade
20 questions
APCS A - Array 6.1,6.2,6.3,6.
Quiz
•
9th - 12th Grade
20 questions
GCSE Computer Science: Programming (Data Structures)
Quiz
•
9th - 10th Grade
20 questions
Programming Fundamentals Part 2
Quiz
•
9th - 11th Grade
20 questions
Season 5 #Spaic Python Weekly Quiz
Quiz
•
KG - Professional Dev...
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University