Back to Challenge Set 17

Question Set 10

Difficulty  

divider

What This Is

Six exam-style questions through Activity 2.7, weighted toward scope, refactoring, and abstraction. These sets are cumulative, so anything earlier is still fair game.

Question 3 matters more than it looks. It is about which code counts as yours for the Create task, and getting it wrong there costs more points than any other single mistake in this course.

How to Do This One

  • Set a timer for 11 minutes before you start.
  • 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
int count = 10;
Console.WriteLine(Bump(count));
Console.WriteLine(count);
int Bump(int count)
{
count = count + 1;
return count;
}
  • (A) 11 then 11
  • (B) 11 then 10
  • (C) 10 then 11
  • (D) Nothing — it will not build

Question 2

Why will this C# not build?

Question 2
Console.WriteLine(Area(4, 5));
Console.WriteLine(result);
int Area(int w, int h)
{
int result = w * h;
return result;
}
  • (A) Area is never called
  • (B) result is local to Area and does not exist outside it
  • (C) result has to be returned twice
  • (D) Console.WriteLine cannot print a variable

Question 3 — Select all that apply

A student writes a Raylib program. Which of these count as student-developed procedures for the Create Performance Task?

  • (A) DrawFish(x, y, size, color), which the student wrote and calls
  • (B) Raylib.DrawCircle
  • (C) The main program's while loop, including its IsMouseButtonPressed check
  • (D) CalculateTotal(price, quantity), which the student wrote and calls
  • (E) A method a library calls automatically whenever the mouse is clicked

Question 4

Refactoring is best described as:

  • (A) Making a program run faster
  • (B) Changing how code is written without changing what it does
  • (C) Adding new features to existing code
  • (D) Fixing bugs in a working program

Question 5

A method can use a variable declared in the main program, but the main program cannot use a variable declared inside a method. This is:

  • (A) A bug in C#
  • (B) Scope
  • (C) Refactoring
  • (D) Composition

Question 6 — Data and Impact

A photo shared online carries the date, the camera model, and often the location where it was taken. This information is called:

  • (A) Compression
  • (B) Encryption
  • (C) Metadata
  • (D) A protocol

Submit

Six answers, each marked sure or unsure, plus how far you got when the timer went off.

Start the Timer