Ten questions that mostly have to be traced rather than recalled: a loop with two additions on every pass, a recursion four levels deep, a local variable…
10 questions • Zestly
• Consider this pseudocode: total = 0. FOR i FROM 1 TO 4: total = total + i. total = total + 1. END FOR. PRINT total. What is the final value…
• Consider the recursive function: FUNCTION calc(n): IF n < 2 THEN RETURN 1. ELSE RETURN n + calc(n - 1). END IF. END FUNCTION. What is the…
• Consider this pseudocode: count = 5. PROCEDURE tally(): DECLARE count AS LOCAL. count = 20. PRINT count. END PROCEDURE. CALL tally(). PRINT…
• A BankAccount class keeps its balance in a field that no code outside the class can reach, and offers deposit and withdraw methods that…
• Two classes, Printer and Scanner, both need a method to log activity. If you force a 'Printer inherits from Scanner' relationship, what is…
• A team must process a long stream of sensor readings: each reading is transformed, the results are filtered, and what survives is combined…
• A function accepts an integer between 1 and 100 inclusive. Which set of test values best exercises the boundary conditions?
• A program runs to completion but calculates the wrong total because a variable was initialised to 1 instead of 0. What type of error is…
Want to check what you know — or test someone else?
Create your own quiz
See the full breakdown →