CSA Unit 1 Lesson 7
Name(s) __________________________________________________ Period _______ Date _____________________
Extra Practice - Loops
Check for Understanding
Which of the following is ALWAYS true about a while loop?
A.
A while loop always makes decisions about whether or not to run the code in the body of the loop.
B.
The code inside the body of a while loop always runs forever.
C. The code inside the body of a while always runs multiple times.
D. The code inside the body of a while loop always runs only once.
E.
The code inside the body of a while loop never runs.
AP Exam Prep
Consider the code segment below. How many times will the code on Line 4 run?
1
Painter amy = new Painter();
2
3
while (amy.canMove()) {
4
5
A.
0 times
B.
1 time
amy.move();
}
C. 3 times
D. 8 times
1
Extra Practice
Do This: You’ve learned a lot of code and vocabulary so far. How are you feeling about AP Computer Science
A? What strategies did you use so far to be successful with the content? How can you continue to use these
strategies throughout the year?
2