Given the code shown here, what are the first and last numbers output?
AP CS A Quiz 4 Practice

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Scott Chamberlain
Used 1+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
5 11
5 12
6 11
6 12
none (error)
2.
CLASSIFICATION QUESTION
3 mins • 7 pts
Organize these statements into the right categories of loops
Groups:
(a) for loop is best
,
(b) while loop is best
,
(c) either type of loop is ok
to control a loop with user input
when you know the number of iterations ahead of time
to repeat code an extremely large number of times
to perform a series of calculations
to stop looping when a certain condition is met
to repeat an entire block of code
to use an integer variable to control how many times a loop runs
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Choose which three values should replace the blanks in the for loop so that it loops through the numbers:
2 7 12 17 22 27
1, <=27, +=2
2, <=27, +=5
5, <27, +=2
2, <27, +=3
0, <=27, +=5
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
How many times will the "while" loop execute in this code?
30
26
22
18
infinite loop
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What changes are needed to the code shown here in order to print the odd numbers from 11 to 25 inclusive?
x+=2 should be x++
x < 25 should be x <= 25
x+=2 should occur after the println
int x = 11 should be int x = 9
correct as is - no changes needed
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the code shown here?
This is an infinite loop
1 2 0 9 5
2 0 9 5 1
9 0 2 1 0
5 9 0 2 1
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Choose which three values should replace the blanks in the for loop so that it loops through the numbers:
11 9 7 5 3 1
11, <=11, --
1, <11, +=2
11, >=1, -=2
11, >1, --
1, <=11, -=2
8.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the following possible replacements for /* missing code */.
Which option(s) will cause the code segment to print only the values:
2 22 42 62 82 ?
I. x < 100
II. x <= 80
III. x != 100
I only
II only
I and II only
II and III only
I, II, and III
9.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the code segment shown here?
36
24 12
36 24 12
36 32 28 24 20 16 12 8 4 0
36 33 30 27 24 21 18 15 12 9 6 3
Similar Resources on Quizizz
10 questions
Python Loops

Quiz
•
9th - 12th Grade
10 questions
Y9 Java (Karel the dog)

Quiz
•
9th Grade
10 questions
while loop

Quiz
•
9th Grade
10 questions
Quiz 16 - Arrays and Loops

Quiz
•
11th Grade
10 questions
Iteration Assessment

Quiz
•
9th - 10th Grade
10 questions
Programming Basics

Quiz
•
9th - 10th Grade
10 questions
Pseudocode WHILE Loops

Quiz
•
10th - 12th Grade
10 questions
Pseudocode - Iteration

Quiz
•
7th - 11th Grade
Popular Resources on Quizizz
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
Discover more resources for Computers
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