What a program prints, how variables change, and the four data types the exam names.
Section C (programming) is 80 of the exam's 210 marks, and Section A usually opens with a "what does this print?" question. Both start here.
print() shows a value on the screen, then moves to a new line. Text goes in quotes; numbers don't.
Give print() several values separated by commas and it prints them on one line, with a space between each. The quotes themselves are never printed.
print("Leaving Cert")
print(2027)
print("Points:", 625)Quick check. What exactly does this print?
print("Room", 12)
A variable is a name that holds a value. = means store the value on the right in the name on the left. It isn't "equals" from maths.
Storing a new value replaces the old one. Copying one variable into another copies the value at that moment: changing the first one later doesn't change the copy.
score = 40
best = score # best is 40
score = score + 15 # score is now 55, best is still 40
print(score, best) # 55 40What does this program print?
lives = 3
start = lives
lives = lives - 1
print(start)
| Type | What it holds | Examples |
|---|---|---|
int | whole numbers | 7, -3, 2027 |
float | numbers with a decimal point | 3.0, 0.5, -2.75 |
str | text, always in quotes | "7", 'Dublin', "" |
bool | True or False (no quotes) | True, False |
The quotes decide it: 7 is an int, "7" is a str. And 3.0 is a float even though it looks whole.
A program stores a student's average mark as average = 71.0. What data type is average?
Which of these values are strings (str)? Choose all that apply.
In "what does this print?" questions, examiners give one mark per printed value, in order. Write every line, in order, without the quotes.
Write each line this program prints, in order.
name = "Aoife"
print("Hi", name)
year = 2026
print(year + 1)
print("year")
| line of output | what it shows |
|---|---|
A trace table records each variable's value after every line. The exam asks for one most years: one row per line, top to bottom.
Complete the trace table for this program. The first row is done for you.
x = 4 # line 1
y = x * 3 # line 2
x = y - 5 # line 3
y = x + y # line 4
| line | x | y |
|---|---|---|
One go at each question. Your score is shown at the end, and you can retake the quiz.
What data type does input() always return?
What does this print?
x = 2
x = x * 3
x = x - 1
print(x)
Which of these is a bool value?
Complete the trace table. The first row is done for you.
a = 1 # line 1
b = a + 4 # line 2
a = b * 2 # line 3
b = a - b # line 4
| line | a | b |
|---|---|---|
What exactly does this print?
print("A", "B", 3)