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

Subjects · Leaving Cert Computer Science

Leaving Cert Computer Science: Strings & string methods

How often Strings & string methods 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 2023.

OL Asked on 1 of the last 5 Ordinary Level papers, most recently in 2022.

Strings & string methods, Higher Level(7 marks)

Quick ones on Strings & string methods.

(a)What does len('Eile') return?
  1. 3
  2. 4
  3. 5
(b)word = 'Galway'. What does print(word[2]) display?
  1. w
  2. a
  3. l
(c)What does print('Cork'.upper()) display?
  1. CORK
  2. Cork
  3. cork
Show the answers

(a) 4

(b) l

(c) CORK

Your turn: Higher Level questions on Strings & string methods.

Higher Level

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

Every paper, year by year

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

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

More Strings & string methods questions

Strings & string methods, 3 marks

What does print('Lee' in 'Tralee') display?

  1. True
  2. 3
  3. False
Show the answer

False

in checks whether one string appears inside another, and it is case-sensitive. Tralee contains lee with a small l, not Lee, so the result is False.

Strings & string methods, 3 marks

s = 'Offaly'. What does print(s[2:]) display?

  1. ffaly
  2. faly
  3. Of
Show the answer

faly

[2:] starts at index 2 and runs to the end. Indexes start at 0: O is 0, the first f is 1 and the second f is 2, giving faly.

Strings & string methods, 3 marks

s = 'Cork'. What happens when s[0] = 'P' runs?

  1. A TypeError: strings cannot be changed
  2. s is changed to 'Pork' in place
  3. An IndexError: index 0 is out of range
Show the answer

A TypeError: strings cannot be changed

Strings are immutable: their characters cannot be changed in place. Build a new string instead, e.g. s = 'P' + s[1:].

Ordinary Level

Asked on 1 of the last 5 Ordinary Level papers, most recently in 2022.

Every paper, year by year

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

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

More Strings & string methods questions

Strings & string methods, 2 marks

word = 'Galway'. Output of print(word[0])?

  1. a
  2. Galway
  3. G
Show the answer

G

Indexing starts at 0, so word[0] is the first character. word[1] would be 'a'.

Strings & string methods, 2 marks

word = 'Galway'. Output of print(len(word))?

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

6

len() counts the characters: G-a-l-w-a-y is 6. The last index is 5, because indexing starts at 0.

Strings & string methods, 3 marks

word = 'Galway'. Output of print(word[1:4])?

  1. alw
  2. alwa
  3. Gal
Show the answer

alw

A slice runs from the first index up to but NOT including the second: indexes 1, 2, 3 give a, l, w.

Other Computer Science topics

All of Leaving Cert Computer Science