The last set before the exam. Six questions weighted toward procedures, and the whole quarter is fair game.
Set a timer for 10 minutes. On paper, no computer. Mark each answer sure or unsure and then revise whatever the unsure ones point at — that is what this set is for.
What does this print?
local function double(n) local answer = n * 2end
local result = double(4)
print(result)84nilWhat does this print?
local count = 10
local function reset(count) count = 0 return countend
reset(count)
print(count)010nilcount is used twiceIn exam notation, a procedure hands a value back with:
return expressionRETURN(expression)DISPLAY(expression)result ← expressiontally([4, 12, 30, 8, 11], 10) returns:
PROCEDURE tally(scores, limit){ n ← 0 i ← 1 REPEAT LENGTH(scores) TIMES { IF(scores[i] > limit) { n ← n + 1 } i ← i + 1 } RETURN(n)}23553The Create Performance Task requires at least one student-developed procedure. Which of these would count?
love.draw, with forty lines you wrote inside itlove.keypressed(key), because it has a parameterdrawShip(x, y, size), which you wrote and call twicetally(scores, limit), which you wrote and call onceWhat does this print?
local function total(t) local sum = 0
for i, v in ipairs(t) do sum = sum + v return sum endend
print(total({4, 6, 10}))204nil10Six answers with sure or unsure beside each, and your time. For question 5, list every letter you chose.
This is the last set before the exam. Whatever you marked unsure is your revision list, and the four section summaries are where to look.
Worth 4 points, graded on completion.