Back

Question Set 1

Six questions · 10 minutes · Activities 1.1 – 1.6

divider

What This Is

Six exam-style questions on values, assignment and arithmetic. Some are written in Lua and some in exam notation, and nothing tells you which is coming — the same as in May.

Set a timer for 10 minutes. Work them out on paper and do not run the code. Mark each answer sure or unsure. Guess rather than leave a blank; the AP exam has no penalty for a wrong answer.


The Questions


Question 1

What does this display?

Exam notation
x ← 5
x ← x + 3
DISPLAY(x)
  • (A) 5
  • (B) 8
  • (C) 53
  • (D) Nothing; a name cannot appear on both sides

Question 2

What does this print?

Lua
print("Score: " .. 3 + 4)
  • (A) Score: 34
  • (B) Score: 7
  • (C) Score: 3 4
  • (D) An error

Question 3

23 MOD 4 evaluates to:

  • (A) 5
  • (B) 5.75
  • (C) 3
  • (D) 4

Question 4

19 / 4 evaluates to:

  • (A) 4
  • (B) 4.75
  • (C) 5
  • (D) 3

Question 5

The person types 12. Which of the following is true?

Lua
io.write("How many? ")
local n = io.read()
  • (A) n * 3 raises an error
  • (B) n == 12 evaluates to true
  • (C) n * 3 evaluates to 36
  • (D) n holds the number 12

Question 6

What does this display?

Exam notation
DISPLAY("A")
DISPLAY("B")
  • (A) AB
  • (B) A and B on two lines
  • (C) A B on one line
  • (D) An error; DISPLAY can only be used once

Submit

Hand in your six answers with sure or unsure beside each, and your time.

The unsure marks are the useful part. A right answer you were unsure of is a topic to revisit; a wrong answer you were sure of is a bigger one.

Worth 4 points, graded on completion.

Start the Timer