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.
Quick ones on Strings & string methods.
- 3
- 4
- 5
- w
- a
- l
- CORK
- Cork
- cork
Show the answers
(a) 4
(b) l
(c) CORK
Higher Level
Asked on 2 of the last 5 Higher Level papers, most recently in 2023.
Every paper, year by year
| Year | Where it came up |
|---|---|
| 2025 | Not asked |
| 2024 | Not asked |
| 2023 | A11 |
| 2022 | Not asked |
| 2021 | B13, 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?
- True
- 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?
- ffaly
- faly
- 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?
- A TypeError: strings cannot be changed
- s is changed to 'Pork' in place
- 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
| Year | Where it came up |
|---|---|
| 2025 | Not asked |
| 2024 | Not asked |
| 2023 | Not asked |
| 2022 | C16 |
| 2021 | Not 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])?
- a
- Galway
- 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))?
- 7
- 6
- 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])?
- alw
- alwa
- 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
- Abstraction & pattern recognition
- Binary & hexadecimal
- CPU, memory & storage
- Embedded systems & sensors
- Ethics & social impact
- Flowcharts & pseudocode
- Internet, WWW & protocols
- Loops & trace tables
- Problem solving & puzzles
- Selection & Boolean logic
- Universal design & accessibility
- Variables, data types & operators
- Algorithmic complexity
- Data analytics & data quality
- Functions & modules
- Logic gates & truth tables
- Roles, teams & stakeholders
- Searching algorithms
- Testing & debugging
- AI & machine learning
- ASCII & Unicode
- Design process & SDLC
- History & emerging trends
- Lists
- Privacy & cybersecurity
- Basic electronics
- Databases
- Modelling & simulation
- Operating systems
- Quicksort
- Recursion
- Sorting algorithms
- Heuristics
- Turing machines