Skip to content
OtisamLMS
Computing

Computing · Quick practice · answer shown after each question

Python: functions, scope and modules

Question 1 of 10

Question 1 of 10

A procedure is a subroutine that

Question 2 of 10

Question 2 of 10

A function can return a value using the return keyword.

Question 3 of 10

Question 3 of 10

A variable that exists only inside a function is a ___ variable.

Question 4 of 10

Question 4 of 10

What is printed? def f(x): return x * x print(f(f(2)))

Question 5 of 10

Question 5 of 10

A docstring in a Python function is used to

Question 6 of 10

Question 6 of 10

Default parameters let a function be called with fewer arguments.

Question 7 of 10

Question 7 of 10

What is printed? def add(a, b=2): return a + b print(add(5))

Question 8 of 10

Question 8 of 10

Differentiate between a parameter and an argument, using an example.

Question 9 of 10

Question 9 of 10

Write a recursive function to calculate the factorial of n and explain how it works for n = 4.

Question 10 of 10

Question 10 of 10

Breaking a large program into functions is called

Questions written by OtisamLMS in the style of the WASSCE. They are not WAEC past questions.