Programming — Python
22 past questions across 7 years (2020–2026).
Start here
Choose your study mode
The full question list is on the right. Use notes or quiz mode when you want focused revision.
Notes
Notebook-style AI notes for this topic.
Quiz mode
Exam-style answers with marking-scheme feedback.
Print pack
Clean print view for paper-based study.
Open inline study tools (notes + practice generator)
Study notes
AI-written notes for Programming — Python in a notebook-style page — with tables, diagrams and worked examples.
Practice question
A fresh exam-style question, generated on demand.
Past exam questions
Quiz2026
1 question · 9 parts- Question 16Part C2026 · Part C · Page 4Full paperLoading the exam page…Q16 (a)(80 marks)Q16 (a)(i)Q16 (a)(ii)Q16 (a)(iii)Q16 (a)(iv)Q16 (a)(v)Q16 (a)(vi)Q16 (a)(vii)Q16 (b)(80 marks)Has diagram
2025
4 questions · 13 parts- Question 1Part A
State the output of the following Python code. 1 a = 5 2 b = a + 2 3 b = 10 4 print(a) 5 print(b) 6 a = b * 2 7 c = a // b 8 print(a) 9 print(c) 10 a = a + 1 11 print (a % b) 12 print (b == c) Output:
- Question 9Part A2025 · Part A · Page 7Full paperLoading the exam page…Q9 (a)Q9 (b)
- Question 14Part A2025 · Part A · Page 13Full paperLoading the exam page…
- Question 16Part C2025 · Part C · Page 4Full paperLoading the exam page…Q16 (a)Q16 (a)(i)Q16 (a)(ii)Q16 (a)(iii)Has diagramQ16 (a)(iv)Q16 (a)(v)Q16 (a)(vi)Q16 (a)(vii)Q16 (b)Has diagram
2024
4 questions · 15 parts- Question 2Part A2024 · Part A · Page 3Full paperLoading the exam page…
- Question 9Part A2024 · Part A · Page 7Full paperLoading the exam page…
- Question 14Part A2024 · Part A · Page 16Full paperLoading the exam page…Q14 (b)(i)Q14 (b)(ii)Q14 (b)(iii)Q14 (b)(iv)Q14 (b)(v)
- Question 16Part C2024 · Part C · Page 4Full paperLoading the exam page…Q16 (a)(i)Q16 (a)(ii)Q16 (a)(iii)Q16 (a)(iv)Q16 (a)(v)Q16 (a)(vi)Q16 (a)(vii)Q16 (b)(80 marks)Has diagram
2023
4 questions · 15 parts- Question 7Part A2023 · Part A · Page 6Full paperLoading the exam page…(25 marks)Has diagram
- Question 11Part AQ11 (a)(25 marks)
Figure 6 depicts a flowchart of a Python algorithm which can be used to generate new usernames for students. You can assume that the date is in the format: ddmmyyyy. [Flowchart: Start -> first_name -> surname -> date_of_birth -> first_name = first_name[0:2] -> date_of_birth = date_of_birth[4:8] -> username = first_name + surname + date_of_birth -> username -> Stop] Name one input and one output of the algorithm. Input: Output:
Q11 (b)(25 marks)Referring to the relevant step(s) in the flowchart explain how the algorithm uses string slicing and string concatenation. String slicing: String concatenation:
- Question 15Part AQ15 (b)(i)(130 marks)
The Python code below shows an implementation of a binary search function. 1 def binary_search1(v, L): 2 3 lo = 0 4 hi = len(L) - 1 5 6 while (lo <= hi): 7 mid = (lo + hi)//2 8 9 if L[mid] > v: 10 hi = mid - 1 11 elif L[mid] < v: 12 lo = mid + 1 13 else: 14 return mid 15 16 return len(L) In the code there is one example of iteration. State on which lines the iteration starts and ends and explain what it does. Start line number: End line number: Explain:
Q15 (b)(ii)(130 marks)The function contains two examples of a return statement – line 14 and line 16. What is the purpose of a return statement?
Q15 (b)(iii)(130 marks)Explain the reason for len(L) on line 16.
Q15 (c)(iii)(130 marks)Given a list of names, initialised as shown below, write a line of code to call the function binary_search2 to find the name Natalia. You should store the result of the function in a variable called result. names = ["Amir", "Dean", "Eoin", "Helen", "Natalia", "Steve", "Terry"]
- Question 16Part C2023 · Part C · Page 4Full paperLoading the exam page…Q16 (a)Has diagramQ16 (a)(i)Q16 (a)(ii)Q16 (a)(iii)Q16 (a)(iv)Q16 (a)(v)Q16 (a)(vi)Q16 (b)Has diagram
2022
3 questions · 17 parts- Question 1Part A2022 · Part A · Page 3Full paperLoading the exam page…(30 marks)
- Question 15Part A2022 · Part A · Page 22Full paperLoading the exam page…Q15 (b)(i)Q15 (b)(ii)Q15 (b)(iii)Q15 (b)(iv)Q15 (c)(i)Has diagramQ15 (c)(ii)Q15 (c)(iii)Q15 (c)(iv)
- Question 16Part C2022 · Part C · Page 4Full paperLoading the exam page…Q16 (a)Q16 (i)Q16 (ii)Q16 (iii)Q16 (iv)Q16 (v)Q16 (vi)Q16 (vii)
2021
3 questions · 10 parts- Question 1Part A2021 · Part A · Page 3Full paperLoading the exam page…(30 marks)
- Question 13Part A2021 · Part A · Page 16Full paperLoading the exam page…Q13 (c)(i)Q13 (c)(v)
- Question 16Part C2021 · Part C · Page 3Full paperLoading the exam page…Q16 (a)Q16 (i)Q16 (ii)Q16 (iii)Q16 (iv)Q16 (v)Q16 (vi)
2020
3 questions · 17 parts- Question 11Part A2020 · Part A · Page 9Full paperLoading the exam page…Has diagram
- Question 13Part A2020 · Part A · Page 11Full paperLoading the exam page…
- Question 16Part C2020 · Part C · Page 3Full paperLoading the exam page…Q16 (a)(80 marks)Has diagramQ16 (a)(i)Q16 (a)(ii)Q16 (a)(iii)Q16 (a)(iv)Q16 (a)(v)Q16 (a)(vi)Q16 (a)(vii)Q16 (a)(viii)Has diagramQ16 (b)(80 marks)Has diagramQ16 (b)(i)Has diagramQ16 (b)(ii)Has diagramQ16 (b)(iii)Has diagramQ16 (b)(iv)Q16 (b)(v)Has diagram