by BlastRoom
Practice tracing function calls, parameters, return values, and scope in pseudocode.
#computer_science

40 questions
One question set, multiple game modes. Tap any game to see it in action. Not sure which to pick?
Answer to place stones and capture territory.
Outrun the snow together.
Earn blasts, then hunt the other team.
Answer to earn energy, then climb.

The class blasts through walls together.
Bid on mystery lots. Most money wins.
Sell tours. Nice, standard, or a total scam.
Answer, restock, and serve the rush.
More correct answers pulls the rope your way.
Answer, then shoot down the alien wave.
Answer, then tap to leap the frozen ridge.
What does the last line display? FUNCTION double(n) RETURN n * 2 END FUNCTION DISPLAY double(7)
DIV discards any remainder. What does the last line display? FUNCTION groups(items, size) RETURN items DIV size END FUNCTION DISPLAY groups(23, 5)
What value does this call return? FUNCTION label(first, last) RETURN first + " " + last END FUNCTION label("Mia", "Chen")
What does the last line display? FUNCTION larger(a, b) IF a > b RETURN a ELSE RETURN b END IF END FUNCTION DISPLAY larger(12, 9)
What value does this call return? FUNCTION discount(price) RETURN price - 5 END FUNCTION discount(18)
MOD gives the remainder after division. What does the last line display? FUNCTION leftover(total, groups) RETURN total MOD groups END FUNCTION DISPLAY leftover(29, 6)
What value does this call return? FUNCTION surround(word) RETURN "[" + word + "]" END FUNCTION surround("code")
What does the last line display? FUNCTION isEven(n) RETURN n MOD 2 = 0 END FUNCTION DISPLAY isEven(14)
What does this program display, in order? FUNCTION cheer(word) RETURN word + "!" END FUNCTION DISPLAY cheer("go") DISPLAY cheer("win")
What does this program display, in order? FUNCTION addOne(n) RETURN n + 1 END FUNCTION DISPLAY addOne(4) DISPLAY addOne(9)
What does this program display, in order? FUNCTION repeat(text) RETURN text + text END FUNCTION DISPLAY repeat("ha") DISPLAY repeat("yo")
What does this program display, in order? FUNCTION square(n) RETURN n * n END FUNCTION DISPLAY square(3) DISPLAY square(5)
What does this program display, in order? FUNCTION after(start) RETURN start + 2 END FUNCTION DISPLAY after(8) DISPLAY after(1)
What does this program display, in order? FUNCTION firstLetter(text) RETURN text[0] END FUNCTION DISPLAY firstLetter("sun") DISPLAY firstLetter("map")
In this pseudocode, / keeps fractional parts. What does this program display, in order? FUNCTION divideByTwo(n) RETURN n / 2 END FUNCTION DISPLAY divideByTwo(18) DISPLAY divideByTwo(7)
What does this program display, in order? FUNCTION check(score) IF score >= 60 RETURN "pass" ELSE RETURN "retry" END IF END FUNCTION DISPLAY check(72) DISPLAY check(54)
In this program, which parameter receives the argument 40? FUNCTION rate(distance, hours) RETURN distance / hours END FUNCTION DISPLAY rate(40, 2)
A call is made as join("red", "blue"). Which values do the parameters receive? FUNCTION join(left, right) RETURN left + right END FUNCTION
In this pseudocode, / keeps fractional parts. What does the last line display? FUNCTION speed(kilometers, hours) RETURN kilometers / hours END FUNCTION DISPLAY speed(3, 120)
A program calls makeTag("p", "Hello"). What value does the call return? FUNCTION makeTag(tag, message) RETURN "<" + tag + ">" + message END FUNCTION
What does this program display? FUNCTION difference(high, low) RETURN high - low END FUNCTION DISPLAY difference(4, 17)
A program calls move("north", 3). What are "north" and 3 called in this call? FUNCTION move(direction, steps) RETURN direction + ": " + steps END FUNCTION
What does this program display, in order? FUNCTION showDouble(n) DISPLAY n * 2 END FUNCTION FUNCTION giveDouble(n) RETURN n * 2 END FUNCTION showDouble(4) SET saved TO giveDouble(4) DISPLAY saved + 1
What appears on the screen? FUNCTION announce(word) DISPLAY word RETURN word + "!" END FUNCTION SET result TO announce("Ready") DISPLAY result
What does this program display? FUNCTION addTax(price) RETURN price + 3 END FUNCTION SET total TO addTax(10) DISPLAY total
Which statement best describes this call? FUNCTION printScore(score) DISPLAY score END FUNCTION SET saved TO printScore(88)
What does this program display, in order? FUNCTION report(n) DISPLAY n + 1 RETURN n + 2 END FUNCTION SET x TO report(5) DISPLAY x
What is the value of answer after this code runs? FUNCTION greet(name) DISPLAY "Hi, " + name RETURN "done" END FUNCTION SET answer TO greet("Ari")
The last line fails. Why? FUNCTION addFee(cost) SET fee TO 2 RETURN cost + fee END FUNCTION SET total TO addFee(12) DISPLAY fee
Where can the variable word be used? FUNCTION makeUpper(text) SET word TO text RETURN word END FUNCTION
What can the last line display? SET school TO "Ridge" FUNCTION welcome(name) RETURN "Welcome, " + name + " to " + school END FUNCTION DISPLAY welcome("Sam")
The last line fails because sum exists only inside makeTotal. Which change makes the program display 5? FUNCTION makeTotal(a, b) SET sum TO a + b RETURN sum END FUNCTION SET result TO makeTotal(2, 3) DISPLAY sum
Which variable can be used on the final line? SET theme TO "blue" FUNCTION choose(color) SET choice TO color RETURN choice END FUNCTION SET selected TO choose("green") DISPLAY ___
A program has this function. Which name still refers to something after the function finishes running? FUNCTION convert(minutes) SET seconds TO minutes * 60 RETURN seconds END FUNCTION
A program contains this definition: FUNCTION area(width, height) RETURN width * height END FUNCTION Which line stores the area of a rectangle 3 wide and 8 high in a?
A program defines FUNCTION isLong(word) and returns True when word has more than 5 characters. Which line correctly calls it with "planet" and stores the result in longWord?
A program contains this definition: FUNCTION subtract(first, second) RETURN first - second END FUNCTION Which line correctly displays the result of subtracting 4 from 15?
A program defines FUNCTION combine(left, right), which returns left + right. Which line correctly stores "sunrise" in result?
A program contains this definition: FUNCTION nextNumber(n) RETURN n + 1 END FUNCTION Which line correctly saves the returned value for 19 in later?
A program defines FUNCTION showMessage(message), which displays its parameter. Which line correctly calls the function to show "Done"?
Crack the passcode before the zombies get in.
Answer, then swat bugs for bonus points.
Race through questions at your own speed.
Same question on every screen. Fastest wins.

Pick a tile, answer, hit bonuses and steals.
Debugging: Syntax, Runtime and Logic Errors
40 questions