Paper 1 Programming Fundamentals Drills

These are original Paper 1-style practice questions. They use concrete data and code fragments so the answers can be checked exactly.

Detailed answers are in Paper 1 Programming Fundamentals Answers.

Revise the topic hub first:

Questions

Question 1: Data Types

A program stores these values for one student:

VariableExample value
student_id"S1042"
age17
height_m1.68
has_paidTrue
class_code"2A"

State a suitable data type for each variable. [5]

Question 2: Identifier Quality

The code below calculates an average mark.

a = 240
b = 4
c = a / b

Suggest better identifiers for a, b, and c, and explain one benefit of using meaningful identifiers. [4]

Question 3: 2D List Indexing

The 2D list below stores marks.

marks = [
    [12, 15, 18],
    [21, 20, 19],
    [8, 14, 16]
]

State the value of:

  1. marks[1][2] [1]
  2. marks[2][0] [1]
  3. marks[0][1] [1]

Question 4: Selection Trace

Trace the code for mark = 82, mark = 50, and mark = 49.

if mark >= 75:
    result = "distinction"
elif mark >= 50:
    result = "pass"
else:
    result = "resit"

State the value of result for each mark. [3]

Question 5: Loop Trace

Complete the trace table for the code below.

total = 0
for number in [3, 5, 2, 4]:
    if number % 2 == 0:
        total = total + number * 2
    else:
        total = total + number
Iterationnumberbranch takentotal after iteration
1
2
3
4

[5]

Question 6: Function Purpose

The expression below appears in five different places in a program.

price * quantity * 1.09

Explain two reasons why this repeated calculation should be placed in a function such as calculate_total(price, quantity). [2]

Question 7: Recursion Base Case

Study the recursive function.

def factorial(n):
    if n == 0:
        return 1
    return n * factorial(n - 1)
  1. Identify the base case. [1]
  2. Explain why the base case is needed. [1]

Question 8: String Operation

Given:

word = "COMPUTING"

State the value of:

  1. word[0] [1]
  2. word[3:7] [1]
  3. word[-1] [1]

Question 9: Coding Standards

The code below is intended to print "large" only when score is at least 50.

score = 72
if score >= 50:
print("large")
  1. Identify the indentation problem and state its effect. [2]
  2. Explain one reason why a purposeful comment or meaningful identifier can make code easier to maintain. [1]

Question 10: Decision Table

A program uses these two Boolean conditions:

  • has_ticket
  • is_late

The rule is:

Allow entry only when the person has a ticket and is not late.

Complete the action column in the decision table. [3]

has_ticketis_lateAction
TrueFalse
TrueTrue
FalseFalse

Review Checklist

After attempting these questions, check whether you can:

  • identify what the command word is asking for;
  • keep the answer within syllabus scope;
  • trace indexes, branches, loops, and recursion carefully;
  • distinguish Python data types and data structures;
  • explain coding standards and indentation;
  • interpret simple algorithmic representations;
  • show exact values when a question requires evidence.