Conditionals FRQ Practice

Responses receive AI feedback against a rubric after submission. Scores are practice estimates.

Question 1 of 5

Consider:

IF (n <= 0)
{
  DISPLAY ("nonpositive")
}
ELSE
{
  DISPLAY ("positive")
}

(a) What displays when n = 0? (b) What displays when n = 1? (c) What displays when n = -3?

Question 2 of 5

A store discounts when total >= 50.

IF (total >= 50)
{
  DISPLAY ("discount")
}
ELSE
{
  DISPLAY ("full price")
}

(a) Outcome for total = 50? (b) Outcome for total = 49.99 (treat as below 50)? (c) Explain the role of the equal boundary in >=.

Question 3 of 5

Both branches below describe plausible parking messages.

IF (cars < 100)
{
  DISPLAY ("spaces available")
}
ELSE
{
  DISPLAY ("lot full")
}

(a) What displays when cars = 100? (b) What displays when cars = 99? (c) Why might a programmer mistakenly expect spaces available at 100?

Question 4 of 5

Trace with humidity = 40.

IF (humidity > 40)
{
  status โ† "humid"
}
ELSE
{
  status โ† "ok"
}
DISPLAY (status)

(a) Is the IF condition true or false? (b) What is displayed? (c) Give one humidity value that would display humid.

Question 5 of 5

Write AP CSP pseudocode IF/ELSE that displays "cold" when temp is below 60, and "warm" otherwise (including 60).

(a) Write the IF condition. (b) Write both branches. (c) State what displays when temp = 60.