← IB Computer Science

Recursion: IB Computer Science practice

Functions that call themselves. 3 questions in the style of the IB Computer Science exam.

Sample questions

(HL) What does this program print?

def echo(n):
    if n == 0:
        return
    print("in", n)
    echo(n - 1)
    print("out", n)

echo(2)