← AP CSP

Selection: AP CSP practice

if, else and nested conditions. 3 questions in the style of the AP CSP exam.

Sample questions

What is displayed? In AP pseudocode, DISPLAY shows a value followed by a space, so type every displayed value on one line, separated by single spaces.

score ← 74
IF (score ≥ 80)
{
   DISPLAY("B")
}
ELSE
{
   IF (score ≥ 70)
   {
      DISPLAY("C")
   }
   ELSE
   {
      DISPLAY("F")
   }
}
DISPLAY(score MOD 10)