Back to Challenge Set 13

Question Set 6

Difficulty  

divider

What This Is

Six exam-style questions, mostly about arrays — Activities 1.23 and 1.24. These sets are cumulative, so loops, conditions, arithmetic, and Part 0 are all still fair game.

Four of the six are about the places C# and the exam disagree. Two of them are a pair: the same list, the same index, two different answers.

How to Do This One

  • Set a timer for 10 minutes before you start — the same as Question Sets 4 and 5.
  • 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

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

Question 1
aList ← [5, 10, 15]
DISPLAY(aList[1])
  1. 5
  2. 10
  3. 15
  4. An error, because the first element is at index 0

Question 2

What does the following C# display?

Question 2
int[] a = { 5, 10, 15 };
Console.WriteLine(a[1]);
  1. 5
  2. 10
  3. 15
  4. Nothing — the program stops with an exception

Question 3

What does the following C# display?

Question 3
int[] first = { 1, 2, 3 };
int[] second = first;
second[0] = 99;
Console.WriteLine(first[0]);
  1. 1
  2. 99
  3. 2
  4. Nothing — the program stops with an exception

Question 4

What happens when the following C# runs?

Question 4
string[] crew = { "Ada", "Bo", "Cy" };
Console.WriteLine(crew[crew.Length]);
Console.WriteLine("Done");
  1. It displays Cy, then Done
  2. It displays 3, then Done
  3. It displays a blank line, then Done
  4. It stops with an IndexOutOfRangeException, and Done is never displayed

Question 5 — Select all that apply

Which of these are true about lists on the AP exam reference sheet?

  1. The first element of aList is aList[1]
  2. aList ← bList assigns a copy of bList
  3. An index of 0 produces an error and the program terminates
  4. LENGTH(aList) is the number of elements
  5. APPEND(aList, value) puts the value at aList[1]

Question 6 — Data and Impact

A hiring program learns what a good candidate looks like from the résumés of people a company has already hired. Where is bias most likely to enter?

  • (A) In the training data, which reflects who the company hired before
  • (B) In the programming language the program is written in
  • (C) In how fast the program sorts the résumés
  • (D) In how many résumés it processes each day

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