Six exam-style questions, weighted toward lists. Two of them are about places where Lua and the reference sheet do different things, so read the title on each code block before you answer.
Set a timer for 10 minutes. On paper, no computer, and mark each answer sure or unsure.
Given this table, what are pets[1] and #pets?
local pets = {"cat", "dog", "fish", "bird"}"dog" and 4"cat" and 4"cat" and 3"dog" and 3In Lua, pets[9] on that same four-element table gives:
nil, and the program carries onWhat happens here?
aList ← [4, 8, 15]DISPLAY(aList[7])150What does this print?
local orig = {1, 2, 3}local other = orig
other[2] = 50
print(orig[2])250nilWhat does this print?
local pets = {"cat", "dog", "fish", "bird"}
for i, p in ipairs(pets) do if i % 2 == 1 then print(p) endendcat and fishdog and birdcat onlyxs has 5 values and ys has 3. A loop walks xs and draws a circle at xs[i], ys[i]. Which are true?
nil valueSix answers with sure or unsure beside each, and your time. For question 6, list every letter you chose.
Questions 2 and 3 are the same situation in two notations. If you gave them the same answer, one of them is wrong.
Worth 4 points, graded on completion.