Back to Challenge Set 10

Question Set 5

Difficulty  

divider

What This Is

Six exam-style questions, mostly about counted loops and the four loop patterns — Activities 1.19 and 1.20. These sets are cumulative, so while, conditions, arithmetic, and Part 0 are all still fair game.

The AP exam gives you 70 questions in 120 minutes, which is 1 minute 43 seconds each.

How to Do This One

  • Set a timer for 10 minutes before you start — the same as last time. Question Set 4 dropped from twelve to ten; the target now is holding that pace rather than cutting it further.
  • 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

Four have exactly one correct answer, one asks you to select all that apply, and the last is about data or the impact of computing rather than about code.


Question 1

What does the following C# display?

Question 1
for (int i = 0; i < 4; i++)
{
Console.Write(i);
}
  1. 0123
  2. 1234
  3. 01234
  4. 123

Question 2

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

Question 2
i ← 1
REPEAT 3 TIMES
{
i ← i + 1
DISPLAY(i)
}
  1. 1 2 3
  2. 2 3 4
  3. 1 2 3 4
  4. 0 1 2

Question 3

A program reads five temperature readings in a loop. Which line answers the question “how many readings were above 20?”

A
total = total + reading;
B
if (reading > 20)
{
count = count + 1;
}
C
if (reading > 20)
{
count = count + reading;
}
D
total = total + 20;

Question 4 — Select all that apply

A program finds the largest of five readings, and on this particular day every reading is below zero. Which starting values for highest still give the correct answer?

  1. int highest = 0;
  2. int highest = -999;
  3. int highest = 999;
  4. The first reading, assigned on the first pass.

Question 5

What does the following C# display?

Question 5
int total = 7;
int count = 2;
double average = total / count;
Console.WriteLine($"{average:F1}");
  1. 3.5
  2. 3.0
  3. 4.0
  4. 3

Question 6 — Data and Impact

A city publishes the average household income for each neighborhood. One neighborhood contains a single household with an extremely high income. Which statement best describes the effect on that neighborhood's published figure?

  • (A) The average is unaffected, because it is only one household out of many.
  • (B) The average is pulled upward and may no longer describe a typical household there.
  • (C) The average is pulled upward, and the median would move by the same amount.
  • (D) The data must have been collected incorrectly.

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