Back to Challenge Set 7

Question Set 3

Difficulty  

divider

What This Is

Six exam-style questions. Most are about compound logic, nested conditions, and randomness — Activities 1.15 and 1.16 — but these sets are cumulative, so everything from Part 1 is still fair game.

The AP exam gives you 70 questions in 120 minutes. That is 1 minute 43 seconds each. You have now done this three times; the target is that it stops feeling like a rush.

How to Do This One

  • Set a timer for 12 minutes before you start. Two more than last time, because one question is a nest and two are about ranges you have to reason through rather than recall.
  • 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. Which values could n display?

Question 1
n ← RANDOM(2, 5)
DISPLAY(n)
  1. 2, 3, 4, 5
  2. 2, 3, 4
  3. 3, 4, 5
  4. 0, 1, 2, 3, 4, 5

Question 2

Which C# expression gives a whole number from 1 to 10, with both 1 and 10 possible?

  1. Random.Shared.Next(1, 10)
  2. Random.Shared.Next(1, 11)
  3. Random.Shared.Next(0, 10)
  4. Random.Shared.Next(10)

Question 3

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

Question 3
a ← 8
b ← 3
IF(a > 5)
{
IF(b > 5)
{
DISPLAY("both")
}
ELSE
{
DISPLAY("first only")
}
}
ELSE
{
DISPLAY("neither")
}
  1. both
  2. first only
  3. neither
  4. Nothing is displayed.

Question 4 — Select all that apply

A variable x holds 10 and a variable y holds 0. Which of the following C# expressions evaluate to true?

  1. x > 5 && y > 5
  2. x > 5 || y > 5
  3. !(y > 5)
  4. x > 5 && !(y > 5)

Question 5

What does the following C# display?

Question 5
bool r = true || false && false;
Console.WriteLine(r);
  1. True
  2. False
  3. Nothing — the program does not compile without parentheses.
  4. It depends on which operator the compiler chooses to apply first.

Question 6 — Data and Impact

A school runs a prize drawing with a program that picks a student at random from a numbered list. The range it uses stops one short, so the last student on the list can never be picked. Which of the following is the strongest reason this matters beyond being a coding mistake?

  • (A) Programs that use randomness run more slowly than programs that do not.
  • (B) One student is systematically excluded from an opportunity, and nothing in the program's output would ever reveal it.
  • (C) Random selection should never be used to make decisions about people.
  • (D) The list of students should have been sorted before the drawing.

Submit

  • Your answer to each question, with sure or unsure
  • Whether you finished inside 12 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