CAMBRIDGE IGCSE COMPUTER SCIENCE
Summer 2025 · Paper 23 · Question 8 · 15 marks
← 0478 CS Hub Paper 23 · Summer 2025 0478 / Paper 2 Question 8 15 MARKS
15-mark question lab · start here

From null strings to a searchable video library.

Build the solution in a sensible order: understand the two record arrays, plan the menu loop, initialise Video[] once and Results[] before every search, add each video into the first free slot, copy every title match into Results[] and report a miss gracefully. Learn the reasoning before revealing the complete program.

2D string arraysNull-string initialisationValidated menu loopFirst-free-slot insertSearch and copy matches15 marks

Learning targets

By the end, you should be able to explain the algorithm before writing it.

Lesson overview

01 · Understand

Identify the two 2D string arrays, the four columns of a video record, and which array must be re-initialised before every search.

02 · Construct

Use a validated menu loop, a first-free-slot insertion and a title scan that copies every matching record into Results[].

03 · Complete

Output the results from Results[] or a suitable not-found message, and return to the menu until the user chooses to stop.

!

How Cambridge awards the marks: the mark scheme gives AO2 a maximum of 9 marks and AO3 a maximum of 6 marks. It lists requirements R1–R5, but does not assign a separate fixed mark total to each R requirement. The stage-to-mark links in this guide show alignment, not invented stage marks.

Source question

Read the whole question first

Do not begin coding after the first paragraph. The null-string initialisation, the validated menu and the copy-every-match rule all decide where your loops sit.

Question 8 · 15 marks
Cambridge IGCSE Computer Science · 0478/23 · Question 8

A collector needs a video library system for a collection of videos stored on 4K Blu-ray discs, standard Blu-ray discs, DVD, or as digital downloads.

The two-dimensional (2D) array Video[] is used to store, for each video item, the title, the format of the video (4K Blu-ray disc, standard Blu-ray disc, DVD, or digital download), the year it was released stored as a string and a storage code to represent where the video can be found in the collection, for example:

Video[1,1]is "Macbeth"
Video[1,2]is "digital download"
Video[1,3]is "2015"
Video[1,4]is "DG276"

The two-dimensional (2D) array Results[] is used to store the results of a search to find a specific video. The search uses the video title, and if the video is found, its data is copied from the array Video[] to the array Results[]. The search continues and if other videos with the same title are found, this data is also copied to the array Results[]. The search ends when the end of the data is reached.

Write a program that meets the following requirements:

  • The video library array needs to be initialised with the null string (""), allowing for up to 10 000 records. The array Results[] must be initialised before every search with the null string and must be able to hold up to 20 search results with the same title.
  • Create a menu to add a new video to the library to search for an existing video by title, or to stop, with validation of the input.
  • When the user enters a new video, the following data is stored in the first available location of the relevant array:
    • video title
    • format (4K Blu-ray disc, standard Blu-ray disc, DVD, digital download)
    • year of release as string
    • storage code
  • Allow input of data for another video if required.
  • When searching for an existing video, if a match is found, transfer all the data for that video into the array Results[], and continue to search until all videos with the same title have been found.
  • Output the results from the array Results[]
  • If the video title is not found, output a suitable message.
  • The system returns to the menu after completing the input or the output, until the user chooses to stop.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays, variables or constants. You may assume that this has already been done.

All inputs and outputs must contain suitable messages.

Before you move on

These are the five required techniques identified by the Cambridge mark scheme.

Mark-scheme map
R1

Initialise Video[] with the null string for up to 10 000 records, and re-initialise Results[] (up to 20 results) before every search.

R2

Create a validated menu offering add, search and stop, and return to it after every action until the user chooses to stop.

R3

Store a new video’s title, format, year (as a string) and storage code in the first available location, then allow another entry.

R4

Copy the data of every video whose title matches the search into Results[], then output the results from Results[].

R5

Output a suitable not-found message when no video matches the search title.

Use the tabs along the top to work through the seven stages. The complete solution is kept in its own tab, and the interactive visualisation is the final tab.