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

Subjects · Leaving Cert Computer Science

Leaving Cert Computer Science: Loops & trace tables

How often Loops & trace tables 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 4 of the last 5 Ordinary Level papers, most recently in 2025. most years

Loops & trace tables, Higher Level(8 marks)

Quick ones on Loops & trace tables.

(a)How many times does for i in range(5): print(i) print?
  1. 4
  2. 5
  3. 6
(b)What is the last value printed by for i in range(2, 10, 3): print(i)?
  1. 11
  2. 10
  3. 8
(c)Which values does range(10, 1, -3) produce?
  1. 10, 7, 4
  2. 10, 7
  3. 10, 7, 4, 1
Show the answers

(a) 5

(b) 8

(c) 10, 7, 4

Your turn: Higher Level questions on Loops & trace tables.

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
2025B14
2024A2, C16
2023A7, C16
2022B15, C16
2021A5

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

More Loops & trace tables questions

Loops & trace tables, 2 marks

What usually causes an infinite while loop?

  1. The loop uses range()
  2. The loop body has no print
  3. The condition never becomes False
Show the answer

The condition never becomes False

A while loop stops only when its condition is False. If nothing in the body changes the tested variable, for example a missing count = count + 1, it runs forever.

Loops & trace tables, 2 marks

How many times does for i in range(3, 11): print(i) print?

  1. 7
  2. 8
  3. 9
Show the answer

8

range(3, 11) runs from 3 up to 10, because the stop value 11 is left out. That is 11 - 3 = 8 values.

Loops & trace tables, 3 marks

What does for i in range(0, 10, 4): print(i, end=' ') display?

  1. 0 4 8
  2. 4 8
  3. 0 4 8 12
Show the answer

0 4 8

Start at 0 and add 4 each time: 0, 4, 8. The next value, 12, is past the stop value 10, so the loop ends there.

Ordinary Level

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

Every paper, year by year

YearWhere it came up
2025C16
2024B13
2023B13, C16
2022Not asked
2021A9, C16

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

More Loops & trace tables questions

Loops & trace tables, 2 marks

How many numbers does for i in range(5): print(i) print?

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

5

range(5) gives 0, 1, 2, 3, 4: five values. It starts at 0 and stops before 5.

Loops & trace tables, 3 marks

Last number printed by for i in range(2, 8): print(i)?

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

7

range(start, stop) stops BEFORE the stop value, so this gives 2, 3, 4, 5, 6, 7.

Loops & trace tables, 3 marks

Numbers printed by for i in range(1, 10, 3): print(i)?

  1. 1 4 7
  2. 1 4 7 10
  3. 3 6 9
Show the answer

1 4 7

Start at 1 and add 3 each time: 1, 4, 7. The next value, 10, is not less than 10, so the loop stops.

Other Computer Science topics

All of Leaving Cert Computer Science