AP CSP Practice Test Conditionals Iteration

Big Idea 3 Practice Test - Part 2

Conditionals & Iteration

25 Multiple-Choice Questions

⏱ 30 minutes recommended 📊 25 questions 🎯 Big Idea 3 Focus

Test Instructions

  • This test focuses on Big Idea 3: Conditional statements, loops, iteration, and Boolean logic
  • Select one answer for each question
  • You can change your answers before submitting
  • Click "Submit Test" when finished to see your score and explanations
  • For AP exam practice, try to complete the test in 30 minutes
Question 1
A student must be at least 13 years old OR in grade 9 or higher to attend camp, but must NOT yet be 18 years old. Which Boolean expression correctly represents eligibility?
Question 2
Which Boolean expression evaluates to true if and ONLY if num is even?
Question 3
Which expression evaluates to true if n is a two-digit integer (10-99 inclusive)?
Question 4
What does this code display?
count ← 0 FOR EACH item IN [5, 12, 7, 20, 3] { IF (item > 10) { count ← count + 1 } } DISPLAY(count)
Question 5
Consider this algorithm that counts elements in a list greater than 100. Steps 3 and 4 are missing:

Step 1: Set count to 0 and position to 1
Step 2: If element at position > 100, increase count by 1
Step 3: ?
Step 4: ?
Step 5: Display count

Which completes the algorithm correctly?
Question 6
A score is "within range" if it's within 10 points of a target. Which expression correctly checks this for target = 50?
Question 7
What is displayed after this code executes?
x ← 15 IF (x MOD 3 = 0) { DISPLAY("A") } ELSE { IF (x MOD 5 = 0) { DISPLAY("B") } ELSE { DISPLAY("C") } }
Question 8
Which loop structure is BEST when you know exactly how many times to iterate?
Question 9
What does this code display?
sum ← 0 i ← 1 REPEAT 4 TIMES { sum ← sum + i i ← i + 1 } DISPLAY(sum)
Question 10
An elevator moves when the door is closed AND it's called to a different floor. Variables: onFloor1, onFloor2, callTo1, callTo2. Which expression makes it move?
Question 11
What is displayed?
result ← "" FOR EACH letter IN ["A", "B", "C"] { result ← result + letter } DISPLAY(result)
Question 12
Which Boolean expression is true when grade is an 'A' (90 or above) but NOT perfect (100)?
Question 13
How many times does "Hello" display?
count ← 0 REPEAT UNTIL (count = 3) { DISPLAY("Hello") count ← count + 1 }
Question 14
To compute only the sum of even integers in a list, which programming structure must be added to a basic summation algorithm?
Question 15
What is displayed?
x ← 5 y ← 10 IF (x > y) { DISPLAY(x) } IF (y > x) { DISPLAY(y) } DISPLAY("Done")
Question 16
A list contains both positive and negative numbers. Which code correctly counts only the negative numbers?
Question 17
What is the final value of product?
product ← 1 FOR EACH value IN [2, 3, 4] { product ← product * value } DISPLAY(product)
Question 18
Which Boolean expression correctly checks if year is a leap year? (Leap if divisible by 4, except centuries unless divisible by 400)
Question 19
What is displayed?
max ← 0 FOR EACH num IN [3, 7, 2, 9, 5] { IF (num > max) { max ← num } } DISPLAY(max)
Question 20
A game awards bonus points if score > 1000 AND time < 60. Which is NOT equivalent?
Question 21
How many iterations occur?
i ← 10 REPEAT UNTIL (i < 5) { i ← i - 2 }
Question 22
What is displayed if temp = 75?
IF (temp > 80) { DISPLAY("Hot") } ELSE { IF (temp > 60) { DISPLAY("Warm") } ELSE { DISPLAY("Cold") } }
Question 23
Which loop will ALWAYS execute at least once?
Question 24
What is displayed?
counter ← 0 FOR EACH item IN [10, 20, 30, 40, 50] { IF (item MOD 20 = 0) { counter ← counter + 1 } } DISPLAY(counter)
Question 25
Which Boolean expression is true when password length is between 8 and 20 characters (inclusive) AND contains at least one digit?
--

out of 25

--

Answer Review

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]