Back

Question Set 15

Six questions · 11 minutes · the whole quarter

divider

What This Is

The last question set of the quarter, and the one that is shaped like the checkpoint. Everything from Activity 2.1 to 2.20 is in scope, weighted the way the exam weights it — algorithms heaviest, then data.

Two things are different about this set. The notation is mixed and not announced, and one question spans three separate topics at once. That is what the checkpoint does too, which is why this arrives first.

Set a timer for 11 minutes. Work them out on paper; do not run the code. Mark each answer sure or unsure. Guess rather than leave a blank.

Do this before the checkpoint, not after. Whatever you get wrong here is your revision list, and the checklist on Activity 2.22 will tell you where to look.


The Questions

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


Question 1

What does this display?

Question 1
aList ← [5, 10, 15, 20]
PROCEDURE doubleAt(list, i)
{
RETURN(list[i] * 2)
}
DISPLAY(doubleAt(aList, 2))
DISPLAY(doubleAt(aList, 4))
  • (A) 10 20
  • (B) 20 40
  • (C) 30 40
  • (D) An error, because list[4] is out of bounds

Question 2

A sorted list holds 100 items. What is the greatest number of comparisons a binary search could need to find an item, or determine that it is absent?

  • (A) 5
  • (B) 6
  • (C) 50
  • (D) 7

Question 3 — Select all that apply

Which of these are true?

  • (A) An algorithm whose step count grows like n cubed runs in a reasonable amount of time
  • (B) A heuristic guarantees the optimal solution
  • (C) An undecidable problem may still have some instances that can be solved algorithmically
  • (D) Two nested loops give n squared steps only if both bounds depend on n
  • (E) Collecting more data eliminates bias in a dataset

Question 4

What does this display?

Question 4
int count = 5;
Console.WriteLine(Bump());
Console.WriteLine(count);
int Bump()
{
int count = 0;
count = count + 1;
return count;
}
  • (A) 1 then 5
  • (B) 1 then 6
  • (C) 6 then 6
  • (D) An error

Question 5

A 40-character row of pixel data is run through a lossless run-length encoder and comes out as 12 characters. Which statement is best supported?

  • (A) Some of the original detail was discarded to reach 12 characters
  • (B) The original had a lot of repetition, and the row can be rebuilt exactly
  • (C) The compression ratio is 3.33
  • (D) A lossy algorithm would have produced a larger result

Question 6 — Impact of Computing

A mapping service asks its users to report road closures, and uses those reports to reroute other drivers. Gathering contributions from a large group of people this way is called:

  • (A) Data compression
  • (B) A heuristic
  • (C) Crowdsourcing
  • (D) Metadata

Submit

Six answers, each marked sure or unsure, plus how far you got when the timer went off. Worth 5 points, graded on completion.

Start the Timer