Standard difficulty · 20 questions · 40 marks · Time: 43 minutes
Show your working for Sections B and C. Answers are on the last page — try every question first!
Functions · AW-12CS-FNC-2026-V1 · For parents — fold back or tear off before handing the sheet to your child.
| Q | Answer | Working |
|---|---|---|
| 1 | (d) arguments | — |
| 2 | (d) 49 81 | b takes its default value only when it is not passed |
| 3 | (a) 46 | match keyword arguments by name, the rest by position; missing ones take their defaults |
| 4 | (c) 29 | global x makes the function change the variable outside it |
| 5 | (a) 135 11 | the x inside show() is a new local variable; the global x is unchanged |
| 6 | (a) 24 11 | return a + b, a * b returns a tuple of two values |
| 7 | (c) show(city='Pune') | name and age are missing |
| 8 | (c) 216.0 216 | math.pow() always returns a float; ** on two ints gives an int |
| 9 | A parameter is the name in the function header; an argument is the value passed in the function call. | — |
| 10 | (a) 63; (b) 57 | b takes its default value only when it is not passed |
| 11 | 27 | match keyword arguments by name, the rest by position; missing ones take their defaults |
| 12 | 80 | global x makes the function change the variable outside it |
| 13 | [27, 23, 17, 13] 10 | the list is the same object inside the function, so changes to it stay; n is a new local name |
| 14 | T, S, T, S, T, S, T, S | a def only defines a function; it runs when called, and two() calls one() |
| 15 | (a) 60; (b) None | double() prints but returns nothing, so r is None |
| 16 | 90 | 3 ** 4 = 81, then + 9 |
| 17 | def f(a, b=2, c=3): return a + b * c. f(1) = 7, f(1, 4) = 13, f(1, c=5) = 11, f(c=5, a=1) = 11. Default parameters must come after the others in the header; in a call, keyword arguments come after positional ones and no parameter may get two values. | — |
| 18 | (a) [33, 27, 27, 19] 7; (b) 285 15. A list passed to a function is the same object, so changing its items is seen outside; assigning to a name inside a function makes a new local variable. | mutable list changed in place; local names hide global ones |
| 19 | (a) 4; (b) 132; (c) (2, 82) | above 21: 46, 22, 36, 28; above 31: 46, 36 |
| 20 | (a) 57 6; (b) 6; (c) without it, count = count + 1 makes count local and reading it first gives an UnboundLocalError. | x takes 2, 5, 8, 11, 14, 17 |