Kramizo
Log inSign up free
CIE IGCSE·💻 Computer Science

CIE IGCSE Computer Science — Paper 2 (Problem-Solving + Programming)

105 minutes📊 75 marks📄 Paper 2 (Problem-Solving + Programming)
📚 Subject revision notes↩ All exam papers
ℹ️ About this paper: This is an exam-board-aligned practice paper written in the style of CIE IGCSE — not an official past paper. Use it for timed practice, then check against the mark scheme included below. For official past papers, see the exam board's website.
00:00of 105:00

CIE IGCSE Computer Science — Paper 2 (Problem-Solving + Programming)

Total marks: 75 · Duration: 105 minutes

Instructions to candidates

  • Answer all questions in both Section A and Section B.
  • Write your answers in the spaces provided on the question paper.
  • You may use an HB pencil for any diagrams or graphs.
  • Calculators are permitted.
  • The number of marks is given in brackets [ ] at the end of each question or part question.
  • The total number of marks for this paper is 75.
  • Section A carries 45 marks and Section B carries 30 marks.

Paper

Section A — Structured Questions (45 marks)

QUESTION 1

A school library system stores data about books and members in two arrays.

The array BookData stores information about each book:

  • BookData[1 TO 500, 1 TO 3]
  • Column 1: BookID (string)
  • Column 2: Title (string)
  • Column 3: Available (boolean, TRUE if available for loan)

The array MemberData stores information about members:

  • MemberData[1 TO 200, 1 TO 2]
  • Column 1: MemberID (string)
  • Column 2: MemberName (string)

(a) State the number of elements in the array BookData. [1]

(b) Explain why a boolean data type is appropriate for storing whether a book is available. [2]

(c) A linear search algorithm is used to find a book by its BookID.

Complete the pseudocode algorithm below:

BookFound ← FALSE
Counter ← 1
SearchID ← "B347"

REPEAT
    IF BookData[Counter, 1] = SearchID
    THEN
        BookFound ← _______________
        OUTPUT BookData[Counter, 2]
    ENDIF
    Counter ← _______________
UNTIL _______________

[3]

(d) The library decides to store loan data in a file called Loans.txt.

Each record contains:

  • BookID
  • MemberID
  • DueDate

Describe two advantages of using a file rather than an array to store the loan data. [4]


QUESTION 2

A programmer is developing a game where players must guess a random number between 1 and 100. The program should give feedback after each guess.

Here is pseudocode for part of the program:

01  SecretNumber ← RANDOM(1, 100)
02  Attempts ← 0
03  Guessed ← FALSE
04
05  REPEAT
06      OUTPUT "Enter your guess: "
07      INPUT PlayerGuess
08      Attempts ← Attempts + 1
09
10      IF PlayerGuess = SecretNumber
11      THEN
12          Guessed ← TRUE
13          OUTPUT "Correct!"
14      ELSE
15          IF PlayerGuess > SecretNumber
16          THEN
17              OUTPUT "Too high"
18          ELSE
19              OUTPUT "Too low"
20          ENDIF
21      ENDIF
22  UNTIL Guessed = TRUE OR Attempts = 10
23
24  IF Guessed = FALSE
25  THEN
26      OUTPUT "Game over. The number was ", SecretNumber
27  ENDIF

(a) Identify the line number where a count-controlled loop begins. [1]

(b) State the maximum number of times the loop can execute. [1]

(c) Explain the purpose of the variable Guessed in this algorithm. [2]

(d) The programmer wants to add validation to ensure the player enters a number between 1 and 100.

Write pseudocode to replace lines 06 and 07 that includes this validation. The program should continue to ask for input until a valid number is entered. [5]


QUESTION 3

A function is used to calculate the cost of tickets for a cinema.

The rules are:

  • Adult tickets cost $12.00
  • Child tickets cost $8.00
  • If 4 or more tickets are purchased, a 10% discount applies to the total

(a) Complete the function definition below:

FUNCTION CalculateCost(AdultTickets : INTEGER, ChildTickets : INTEGER) RETURNS REAL
    TotalCost ← 0.0
    TotalTickets ← _______________
    
    TotalCost ← (AdultTickets * 12.0) + (ChildTickets * _______________)
    
    IF TotalTickets >= 4
    THEN
        TotalCost ← TotalCost * _______________
    ENDIF
    
    RETURN _______________
ENDFUNCTION

[4]

(b) State the output of the following function call:

OUTPUT CalculateCost(2, 3)

[1]

(c) Explain one advantage of using a function rather than writing the calculation code directly in the main program each time it is needed. [2]


QUESTION 4

A bubble sort algorithm is applied to the following list of numbers:

34, 12, 56, 23, 78

(a) Show the state of the list after the first complete pass of the bubble sort algorithm. [2]

(b) State how many comparisons are made during the first pass. [1]

(c) The programmer considers using an insertion sort instead.

Compare the bubble sort and insertion sort algorithms in terms of their efficiency when sorting a list that is already in order. [3]


QUESTION 5

A database table called STUDENTS stores information about students:

StudentID FirstName LastName YearGroup HousePoints
S001 Ahmed Khan 10 45
S002 Sarah Jones 11 67
S003 Li Chen 10 52
S004 Emma Brown 9 38
S005 James Wilson 11 71

(a) State the primary key in this table. [1]

(b) Write an SQL query to display the FirstName and LastName of all students in YearGroup 10. [3]

(c) Write an SQL query to calculate and display the average HousePoints for all students. [2]

(d) A second table called CLASSES is created with the fields: ClassID, ClassName, TeacherName.

A third table called ENROLMENTS links students to classes.

Explain why a third table is necessary rather than adding class information directly to the STUDENTS table. [3]


QUESTION 6

A program uses the following procedure to validate a password:

PROCEDURE CheckPassword(Password : STRING)
    LengthValid ← FALSE
    HasDigit ← FALSE
    
    IF LENGTH(Password) >= 8
    THEN
        LengthValid ← TRUE
    ENDIF
    
    FOR Counter ← 1 TO LENGTH(Password)
        Character ← MID(Password, Counter, 1)
        IF Character >= "0" AND Character <= "9"
        THEN
            HasDigit ← TRUE
        ENDIF
    NEXT Counter
    
    IF LengthValid = TRUE AND HasDigit = TRUE
    THEN
        OUTPUT "Password accepted"
    ELSE
        OUTPUT "Password rejected"
    ENDIF
ENDPROCEDURE

(a) State two validation checks performed by this procedure. [2]

(b) Describe the purpose of the MID function in this procedure. [2]

(c) The procedure is called with the following:

CALL CheckPassword("computer")

State the output and justify your answer. [2]

(d) Suggest one additional validation check that could improve password security. [1]


Section B — Extended Response (30 marks)

QUESTION 7

A delivery company uses a computer system to plan routes for its drivers. The system needs to:

  • Read delivery addresses from a file
  • Calculate the optimal route order
  • Update delivery status
  • Handle errors such as invalid addresses

The company is deciding between using:

  • Option A: A high-level programming language (such as Python or Visual Basic)
  • Option B: A low-level programming language (such as assembly language)

(a) Discuss the suitability of high-level and low-level programming languages for developing this delivery route planning system.

Your answer should consider:

  • Ease of development and maintenance
  • Execution speed
  • Hardware control
  • Portability
  • Cost of development

[12]

(b) The system stores delivery data in a text file called Deliveries.txt.

Each line contains: AddressID, PostalCode, Status

For example:

D001,SW1A 1AA,Pending
D002,E1 6AN,Delivered
D003,W1A 0AX,Pending

Write an algorithm using pseudocode that:

  1. Opens and reads the file Deliveries.txt
  2. Counts how many deliveries have the status "Pending"
  3. Outputs the total number of pending deliveries
  4. Closes the file

You should include appropriate error handling for file operations. [8]

(c) Explain why it is important to close a file after finishing file operations. [2]


QUESTION 8

An online shopping system allows customers to search for products. The system stores product data in an array sorted by ProductID in ascending order.

The following binary search algorithm is used:

FUNCTION BinarySearch(SearchArray, SearchValue) RETURNS INTEGER
    Lower ← 1
    Upper ← LENGTH(SearchArray)
    Found ← FALSE
    Position ← -1
    
    WHILE Found = FALSE AND Lower <= Upper
        Middle ← (Lower + Upper) DIV 2
        
        IF SearchArray[Middle] = SearchValue
        THEN
            Found ← TRUE
            Position ← Middle
        ELSE
            IF SearchArray[Middle] > SearchValue
            THEN
                Upper ← Middle - 1
            ELSE
                Lower ← Middle + 1
            ENDIF
        ENDIF
    ENDWHILE
    
    RETURN Position
ENDFUNCTION

Consider the sorted array: [12, 24, 35, 47, 58, 69, 73, 85, 91]

(a) Show the values of Lower, Upper, and Middle for each iteration when searching for the value 35. Present your answer as a table. [4]

(b) Evaluate the use of binary search compared to linear search for this product search system.

Your answer should include:

  • A comparison of the efficiency of both algorithms using Big O notation
  • The preconditions required for binary search to work
  • Situations where linear search might be more appropriate

[6]


📋 Mark Scheme & Sample Answers

Hidden by default — attempt the paper first, then check your work against the examiner-style mark scheme.

⚡ Unlock with Pro
Mark schemes are a Pro feature

Unlock full examiner-style mark schemes and grade-tiered sample answers across every paper.

See Pro pricing →
Finished the paper?

Reveal the mark scheme above, then dive into the topic notes to firm up anything you missed.

📚 Open subject revision notes →