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
Quick ones on Variables, data types & operators.
- 3.5
- 3
- 4
- 25
- 10
- 32
- 3.0
- 0.3
- 3
Show the answers
(a) 3
(b) 32
(c) 3.0
Higher Level
Asked on 5 of the last 5 Higher Level papers, most recently in 2025. banker
Every paper, year by year
| Year | Where it came up |
|---|---|
| 2025 | A1 |
| 2024 | A9 |
| 2023 | A1 |
| 2022 | A1, B15 |
| 2021 | A1, 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?
- Python does not allow b = a in a program
- b becomes empty after the line a = b runs
- 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?
- 16
- 2
- 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)?
- str
- int
- 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
| Year | Where it came up |
|---|---|
| 2025 | A5, A12, C16 |
| 2024 | A1, A8, B13, B15, C16 |
| 2023 | A6, B13, C16 |
| 2022 | A1, B14, C16 |
| 2021 | A1, 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)?
- 3.5
- 1
- 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)?
- 3.4
- 2
- 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)?
- 16
- 8
- 6
Show the answer
16
** means to the power of: 2 × 2 × 2 × 2 = 16. 2 * 4 would give 8.
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
- 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
- Strings & string methods
- Heuristics
- Turing machines