Ceist Eile is in development. Features, questions and prices may change while we refine it.

Subjects · Leaving Cert Computer Science

Leaving Cert Computer Science: Recursion

How often Recursion comes up on the Computer Science papers, every year it was asked, and questions to try.

HL Asked on 2 of the last 5 Higher Level papers, most recently in 2025.

Recursion, Higher Level(8 marks)

Quick ones on Recursion.

(a)In a recursive function, what is the base case?
  1. The first call made to the function
  2. The condition that stops the recursion
  3. The largest input allowed
(b)f(n) returns 1 if n is 0, otherwise n * f(n - 1). What is f(4)?
  1. 16
  2. 10
  3. 24
(c)g(n) returns n if n < 2, otherwise g(n - 1) + g(n - 2). What is g(6)?
  1. 8
  2. 13
  3. 6
Show the answers

(a) The condition that stops the recursion

(b) 24

(c) 8

Your turn: Higher Level questions on Recursion.

Higher Level

Asked on 2 of the last 5 Higher Level papers, most recently in 2025.

Every paper, year by year

YearWhere it came up
2025B14
2024Not asked
2023B15
2022Not asked
2021Not asked

Links open the State Examinations Commission’s paper for that year.

More Recursion questions

Recursion, 3 marks

p(n) returns 1 if n is 0, otherwise 2 * p(n - 1). What is p(5)?

  1. 10
  2. 16
  3. 32
Show the answer

32

p(0) = 1 and each step up doubles it: 1, 2, 4, 8, 16, 32. So p(n) is 2 to the power n, and p(5) = 32. 16 is p(4).

Recursion, 3 marks

s(n) returns 0 if n is 0, otherwise n + s(n - 1). What is s(4)?

  1. 4
  2. 10
  3. 24
Show the answer

10

s(4) = 4 + 3 + 2 + 1 + 0 = 10. This function adds where the factorial function multiplies; 24 would be 4 factorial.

Other Computer Science topics

All of Leaving Cert Computer Science