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

Subjects · Leaving Cert Computer Science

Leaving Cert Computer Science: Functions & modules

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

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

Functions & modules, Higher Level(7 marks)

Quick ones on Functions & modules.

(a)def double(n): return n * 2. What does print(double(4) + 1) display?
  1. 10
  2. 9
  3. 8
(b)Which keyword sends a value back from a function to the code that called it?
  1. def
  2. print
  3. return
(c)What is a variable created inside a function called?
  1. A local variable
  2. A constant
  3. A global variable
Show the answers

(a) 9

(b) return

(c) A local variable

Your turn: Higher Level questions on Functions & modules.

Higher Level

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

Every paper, year by year

YearWhere it came up
2025C16
2024Not asked
2023C16
2022A1
2021C16

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

More Functions & modules questions

Functions & modules, 2 marks

After from random import choice, what can choice(['R', 'G', 'B']) return?

  1. All three items
  2. Only R
  3. Any one of R, G or B
Show the answer

Any one of R, G or B

choice() picks one item from the list at random, so each run may give a different one. It never returns more than one item.

Functions & modules, 3 marks

def sq(n): return n * n. What does print(sq(sq(2))) display?

  1. 4
  2. 16
  3. 8
Show the answer

16

The inner call runs first: sq(2) = 4. Then sq(4) = 16. The value one function returns can be passed straight into another.

Functions & modules, 3 marks

def add1(x): x = x + 1, then return x. After n = 5, then add1(n), what is n?

  1. 5
  2. 6
  3. None
Show the answer

5

The function changes its own local x, not n. The 6 it returns is thrown away because it is not stored anywhere, so n stays 5.

Other Computer Science topics

All of Leaving Cert Computer Science