Three problems on selection. Two ask you to trace exam notation and say exactly what appears on the screen; one asks you to translate a Lua chain into notation that has no elseif.
Do this on paper. There is nothing to run and nothing to type. On exam day you get this notation on a printed sheet and no computer, so practicing it any other way practices the wrong thing.
Everything you need for this page. This is the same notation the College Board uses on the exam.
a ← expression assign a copy of the result to aDISPLAY(expression) show the value, FOLLOWED BY A SPACEINPUT() take a value from the user
+ - * / 17 / 5 is 3.4 (no truncation)a MOD b remainder. 17 MOD 5 is 2RANDOM(a, b) whole number from a to b, BOTH INCLUDED
= ≠ > < ≥ ≤ comparison. = means EQUALSNOT / AND / OR boolean operators
IF(condition) no ELSE IF exists - nest an IF inside an ELSE{ ... }ELSE{ ... }Two things catch people every time. DISPLAY puts a space after whatever it shows, so two DISPLAY calls in a row give you A B on one line — not two lines and not AB. And = means equals here, not assignment. Assignment is ←.
What does this display?
temp ← 55
IF(temp > 70){ DISPLAY("Warm")}ELSE{ DISPLAY("Cool")}DISPLAY("Reading done")What does this display?
a ← 8b ← 8
IF(a = b){ DISPLAY("same")}ELSE{ DISPLAY("different")}Then answer this: a student says line 4 changes a to 8. Explain in one sentence why they are wrong.
And this. Here is what that student was thinking of, written in Lua. Say what happens when you run it, and why the exam notation cannot make the same mistake:
local a = 8local b = 8
if a = b then print("same")endRewrite this in exam notation. Remember: the reference sheet has no ELSE IF, so a chain has to be built out of nested IF and ELSE blocks.
local speed = 45
if speed > 70 then print("Too fast")elseif speed > 40 then print("Fine")else print("Too slow")endLua gives you elseif and the exam does not. That is one of the six places the two disagree, and the translation is where you feel it.
Your three answers, plus the two short explanations from problem 2. For the traces, write the output exactly as it appears, including spacing.
Worth 3 points, graded on completion. Show your working for the traces — a wrong answer with visible reasoning is worth more to both of us than a right one with none.