Back to Challenge Set 5

Question Set 2

Difficulty  

divider

What This Is

Six exam-style questions. Most are about decisions — Activities 1.11 through 1.13 — but these sets are cumulative, so earlier material is still fair game and will be all year.

The AP exam gives you 70 questions in 120 minutes. That is 1 minute 43 seconds each, including the ones with code to read. If Question Set 1 felt rushed, that is the point of doing these early rather than in April.

How to Do This One

  • Set a timer for 10 minutes before you start. One more than last time, because two of these have nested code to read.
  • When the timer ends, stop. Mark anything unfinished as unfinished — that is real information, not a failure.
  • Work them out. Do not run the code. On exam day there is no computer.
  • For each question, also write sure or unsure. This is graded on completion, so an honest unsure costs you nothing and tells us both where to look.

Guessing beats leaving it blank. There is no penalty for a wrong answer on the AP exam, so a blank is a guaranteed zero where a guess is not.


The Questions

Five of these have exactly one correct answer. One asks you to select all that apply — the real exam has eight questions like that, and they are the ones students lose points on by stopping at the first true statement.


Question 1

The following is written in AP exam notation. What does it display?

Question 1
score ← 74
IF(score ≥ 70)
{
DISPLAY("Pass")
}
ELSE
{
DISPLAY("Fail")
}
DISPLAY("Done")
  1. Pass
  2. Pass Done
  3. Fail Done
  4. Pass Fail Done

Question 2

What does the following code display?

Question 2
int n = 85;
if (n > 50)
{
Console.WriteLine("Big");
}
else if (n > 80)
{
Console.WriteLine("Huge");
}
  1. Big
  2. Huge
  3. Big and Huge, on separate lines
  4. Nothing is displayed.

Question 3

The following is written in AP exam notation. What does it display?

Question 3
a ← 5
b ← 5
DISPLAY(a = b)
  1. true
  2. 5
  3. a = b
  4. Nothing — that line is an assignment, not a value.

Question 4 — Select all that apply

A variable age holds the number 16. Which of the following C# expressions evaluate to true?

  1. age >= 16
  2. age != 16
  3. age < 20
  4. age == 16

Question 5

A student writes the following C# and is surprised that it displays Go. What is wrong with it?

Question 5
bool isReady = false;
if (isReady = true)
{
Console.WriteLine("Go");
}
  1. Nothing is wrong. isReady is false, so Go is correct.
  2. The condition assigns true to isReady instead of comparing, so it is always true.
  3. A bool cannot be used as a condition without == true.
  4. The program does not compile, so nothing is displayed.

Question 6 — Data and Impact

A school's course-registration program decides who may enroll in an advanced class using a single condition: whether the student passed a placement test. Which of the following is the strongest reason to review that decision rule?

  • (A) A single condition runs faster than several conditions.
  • (B) The rule may exclude students who would succeed, if the test measures something other than readiness.
  • (C) Programs should always use else if rather than if.
  • (D) The rule cannot be written in exam notation.

Submit

  • Your answer to each question, with sure or unsure
  • Whether you finished inside 10 minutes, and if not, how far you got
  • One sentence: which question took you longest, and what slowed you down?

This is graded on completion, not accuracy. A thoughtful wrong answer earns the same as a right one. What is being built here is speed and stamina, and both require being allowed to get things wrong cheaply.

Start the Timer