
AP Computer Science A Unit 4 Section 1 (While loops)
Authored by Herman Galioulline
Computers
10th - 12th Grade
Used 30+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
About
This quiz focuses on while loops in Java programming, specifically designed for AP Computer Science A students at the high school level (grades 10-12). The questions assess students' understanding of loop execution, trace analysis, and conditional logic within iterative structures. Students need to demonstrate their ability to mentally execute code step-by-step, predict output values, identify correct loop conditions, and recognize potential infinite loop scenarios. The core concepts required include understanding how while loop conditions are evaluated, how variables are modified within loop bodies, and how loops terminate when conditions become false. Students must also apply knowledge of integer division, modulus operations, and string concatenation within the context of loop iterations. Created by Herman Galioulline, a Computers teacher in Switzerland who teaches grades 10-12. This quiz serves as an excellent formative assessment tool for students beginning their study of iterative control structures in AP Computer Science A. Teachers can use this as a warm-up activity to gauge student readiness before introducing more complex loop concepts, or as homework following initial instruction on while loops. The quiz effectively supports classroom instruction by requiring students to trace through code execution, identify logical errors in loop conditions, and predict program output—all essential skills for success in computer science. This assessment aligns with College Board standards for AP Computer Science A, specifically addressing learning objectives related to iteration (Unit 4) and helping students develop computational thinking skills through code analysis and debugging practice.
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What, if anything, is printed as a result of executing the code segment?
21
161116
161161
16111621
Nothing is printing because of an infinite loop.
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What will be the value of count after executing the code segment?
6
5
4
1
0
3.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
This code segment is intended to store the sum of all multiples of 10 between 10 and 100, inclusive (10 + 20 + ... + 100), in the variable total.
What should /* missing code */ be?
x < 100
x <= 100
x > 10
x >= 10
x != 10
4.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
This code is intended to print the sum of the digits in num. For example, when num is 12345, the code segment should print 15, which represents the sum 1 + 2 + 3 + 4 + 5.
What should /* missing loop header */ be?
while (num > 0)
while (num >= 0)
while (num > 1)
while (num > 2)
while (num > sum)
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What, if anything, is printed as a result of executing the code segment?
0
1
2
3
Nothing is printed.
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?