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

Subjects · Leaving Cert Computer Science

Leaving Cert Computer Science: Variables, data types & operators

How often Variables, data types & operators comes up on the Computer Science papers, every year it was asked, and questions to try.

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

OL Asked on 5 of the last 5 Ordinary Level papers, most recently in 2025. banker

Variables, data types & operators, Higher Level(7 marks)

Quick ones on Variables, data types & operators.

(a)What does print(7 // 2) display?
  1. 3.5
  2. 3
  3. 4
(b)What does print(2 ** 5) display?
  1. 25
  2. 10
  3. 32
(c)What does print(9 / 3) display in Python 3?
  1. 3.0
  2. 0.3
  3. 3
Show the answers

(a) 3

(b) 32

(c) 3.0

Your turn: Higher Level questions on Variables, data types & operators.

Higher Level

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

Every paper, year by year

YearWhere it came up
2025A1
2024A9
2023A1
2022A1, B15
2021A1, A4

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

More Variables, data types & operators questions

Variables, data types & operators, 3 marks

Why does a = b followed by b = a fail to swap two variables?

  1. Python does not allow b = a in a program
  2. b becomes empty after the line a = b runs
  3. The original value of a is overwritten
Show the answer

The original value of a is overwritten

After a = b both variables hold b's value, and a's old value is lost. Store it first: temp = a, a = b, b = temp.

Variables, data types & operators, 2 marks

What does print(23 % 7) display?

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

2

% gives the remainder. 7 goes into 23 three times (21), leaving 2 over. The 3 is what 23 // 7 would give.

Variables, data types & operators, 2 marks

In Python, what data type is the value '42' (with the quotes)?

  1. str
  2. int
  3. float
Show the answer

str

Anything inside quotes is a string, even if it looks like a number. int('42') would turn it into the integer 42.

Ordinary Level

Asked on 5 of the last 5 Ordinary Level papers, most recently in 2025. banker

Every paper, year by year

YearWhere it came up
2025A5, A12, C16
2024A1, A8, B13, B15, C16
2023A6, B13, C16
2022A1, B14, C16
2021A1, C16

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

More Variables, data types & operators questions

Variables, data types & operators, 3 marks

Output of print(7 // 2)?

  1. 3.5
  2. 1
  3. 3
Show the answer

3

// is integer (floor) division: 7 divided by 2 is 3.5, rounded down to 3. Using / would give 3.5.

Variables, data types & operators, 3 marks

Output of print(17 % 5)?

  1. 3.4
  2. 2
  3. 3
Show the answer

2

% gives the remainder after dividing: 17 = 3 × 5 + 2, so the remainder is 2.

Variables, data types & operators, 3 marks

Output of print(2 ** 4)?

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

16

** means to the power of: 2 × 2 × 2 × 2 = 16. 2 * 4 would give 8.

Other Computer Science topics

All of Leaving Cert Computer Science