ExamsFirst
LCHigher Level Computer Science

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.

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.

Open notebook & generate

Practice question

A fresh exam-style question, generated on demand.

Past exam questions

Quiz
Year

2026

1 question · 9 parts
  • Question 16
    Part C
    2026160 marks total
    2026 · Part C · Page 4Full paper
    Loading 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 1
    Part A
    2025

    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 9
    Part A
    2025
    2025 · Part A · Page 7Full paper
    Loading the exam page…
    Q9 (a)
    Q9 (b)
  • Question 14
    Part A
    2025
    2025 · Part A · Page 13Full paper
    Loading the exam page…
  • Question 16
    Part C
    2025
    2025 · Part C · Page 4Full paper
    Loading the exam page…
    Q16 (a)
    Q16 (a)(i)
    Q16 (a)(ii)
    Q16 (a)(iii)Has diagram
    Q16 (a)(iv)
    Q16 (a)(v)
    Q16 (a)(vi)
    Q16 (a)(vii)
    Q16 (b)Has diagram

2024

4 questions · 15 parts
  • Question 2
    Part A
    2024
    2024 · Part A · Page 3Full paper
    Loading the exam page…
  • Question 9
    Part A
    2024
    2024 · Part A · Page 7Full paper
    Loading the exam page…
  • Question 14
    Part A
    2024
    2024 · Part A · Page 16Full paper
    Loading the exam page…
    Q14 (b)(i)
    Q14 (b)(ii)
    Q14 (b)(iii)
    Q14 (b)(iv)
    Q14 (b)(v)
  • Question 16
    Part C
    202480 marks total
    2024 · Part C · Page 4Full paper
    Loading 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 7
    Part A
    202325 marks
    2023 · Part A · Page 6Full paper
    Loading the exam page…
    (25 marks)Has diagram
  • Question 11
    Part A
    202350 marks total
    Q11 (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 15
    Part A
    2023520 marks total
    Q15 (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 16
    Part C
    2023
    2023 · Part C · Page 4Full paper
    Loading the exam page…
    Q16 (a)Has diagram
    Q16 (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 1
    Part A
    202230 marks
    2022 · Part A · Page 3Full paper
    Loading the exam page…
    (30 marks)
  • Question 15
    Part A
    2022
    2022 · Part A · Page 22Full paper
    Loading the exam page…
    Q15 (b)(i)
    Q15 (b)(ii)
    Q15 (b)(iii)
    Q15 (b)(iv)
    Q15 (c)(i)Has diagram
    Q15 (c)(ii)
    Q15 (c)(iii)
    Q15 (c)(iv)
  • Question 16
    Part C
    2022
    2022 · Part C · Page 4Full paper
    Loading 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 1
    Part A
    202130 marks
    2021 · Part A · Page 3Full paper
    Loading the exam page…
    (30 marks)
  • Question 13
    Part A
    2021
    2021 · Part A · Page 16Full paper
    Loading the exam page…
    Q13 (c)(i)
    Q13 (c)(v)
  • Question 16
    Part C
    2021
    2021 · Part C · Page 3Full paper
    Loading the exam page…
    Q16 (a)
    Q16 (i)
    Q16 (ii)
    Q16 (iii)
    Q16 (iv)
    Q16 (v)
    Q16 (vi)

2020

3 questions · 17 parts
  • Question 11
    Part A
    2020
    2020 · Part A · Page 9Full paper
    Loading the exam page…
    Has diagram
  • Question 13
    Part A
    2020
    2020 · Part A · Page 11Full paper
    Loading the exam page…
  • Question 16
    Part C
    2020160 marks total
    2020 · Part C · Page 3Full paper
    Loading the exam page…
    Q16 (a)(80 marks)Has diagram
    Q16 (a)(i)
    Q16 (a)(ii)
    Q16 (a)(iii)
    Q16 (a)(iv)
    Q16 (a)(v)
    Q16 (a)(vi)
    Q16 (a)(vii)
    Q16 (a)(viii)Has diagram
    Q16 (b)(80 marks)Has diagram
    Q16 (b)(i)Has diagram
    Q16 (b)(ii)Has diagram
    Q16 (b)(iii)Has diagram
    Q16 (b)(iv)
    Q16 (b)(v)Has diagram