The exercise-1 editor asks you to write branches. These six ask what runs when, because an if that compiles and does the wrong thing never announces itself.
Applied Practice
6 questions · scenario driven · every answer is recorded for your teacher
Question 1 of 6Analyze
A student writes if (score > 90); then a print statement on the next line, indented.
What does the print statement do?
Incorrect. It runs unconditionally, not never.
Incorrect. An empty statement is legal, which is exactly why this is dangerous.
Incorrect. The empty statement is the entire body of the if.
Correct. Correct, and indentation is the trap: it shows the intent while the semicolon decides the behavior.
Question 2 of 6Apply
A grading chain is written as three separate if statements: if (s >= 90) A, if (s >= 80) B, if (s >= 70) C.
What does a score of 95 print?
Incorrect. All three conditions are true for 95.
Incorrect. That would require else if, which makes the tests mutually exclusive.
Correct. Correct. Independent ifs do not know about each other.
Incorrect. All three run, not just the last.
Question 3 of 6Analyze
The same grading chain is rewritten with else if, but ordered lowest threshold first: if (s >= 70) C, else if (s >= 80) B, else if (s >= 90) A.
What does a score of 95 print?
Incorrect. The A branch is never reached.
Correct. Correct. An else if chain must run from most restrictive to least, and this is the bug that ordering causes.
Incorrect. The code is perfectly legal; it is just wrong.
Incorrect. The chain stops at the first true test, which is C.
Question 4 of 6Apply
A student omits braces and writes an if followed by two indented statements.
What is the effect?
Correct. Correct, and this is the second silent detachment after the stray semicolon.
Incorrect. The first still runs when the condition holds.
Incorrect. A braceless single-statement body is legal.
Incorrect. Without braces, the body is exactly one statement.
Question 5 of 6Evaluate
Two versions of a method differ only in that one uses if/else and the other uses two independent ifs with opposite conditions.
When do they behave differently?
Incorrect. Compound conditions behave the same way in both forms.
Incorrect. Sign has nothing to do with it.
Incorrect. They are equivalent only while the tested value is untouched.
Correct. Correct. This is the real distinction and it is easy to miss when reading quickly.
Question 6 of 6Apply
A method must return "positive", "negative" or "zero" for an int.
How many conditions are strictly required?
Incorrect. Three outcomes need at most two tests.
Incorrect. Testing the third case is redundant work that also risks a gap if the tests disagree.
Correct. Correct. A final else is exhaustive by construction and cannot leave a value unhandled.
Incorrect. One condition can only split the values two ways.
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.
34.8% of Tanner’s CSP students score 5s. The national average is 9.6%.
I’m a Student
I’m a Teacher
✓Free AP CSP Big Ideas cheat sheet (PDF)
✓Daily practice questions covering all 5 Big Ideas
✓Create Task tips that actually work — from a real AP teacher
✓Free class codes with student progress tracking
✓3 full practice exams + Top 100 questions for your class
✓Create Task guidance and pseudocode reference sheets
Which AP CS exams are you prepping for?
✓
You’re in!
Your Big Ideas cheat sheet is on its way.
No thanks, I’ll figure it out myself
Avg student improvement: 2+ score levels | Real AP teacher, not just a tutor
AP Cybersecurity — National Launch 2026–27
Get Early Access to AP Cyber
AP Cyber launches nationally fall 2026. Get in early to help shape the course — start free with Unit 1 and the free teacher gradebook.
✓
You’re in — you’re on the AP Cyber early-access list!
Tanner will follow up personally within 48 hours. Your feedback will directly shape what gets built.
Step 1 of 4
Early Access — Limited Spots
Who are you?
Are you a teacher or a student?
I’m a Teacher
I’m a Student
Free to start — Unit 1 and the teacher gradebook are always free, no credit card.
Founding teachers unlock all 5 units and get direct input on what we build.
Not interested right now
Step 2 of 4
Your School
Tell us about your class
Other AP CS courses you teach
Your Situation
Tell us about yourself
Step 3 of 4
Classroom Needs
What does your classroom need? (select all that apply)
How You Study
What would help you most? (select all that apply)
Step 4 of 4
Almost Done
Where should we send your early-access details?
Free gradebook + Unit 1 | Your feedback shapes the course | Built by a real AP teacher