Practice
Video Library Catalogue
2025/May/June·Variant 3·Q10·[15 marks]
HARD2D Arrays
A video collector stores each title in a 2D array Video[1:5, 1:4]: title, format, year (string), storage code. A second 2D array Results[1:3, 1:4] holds search hits.
Menu (re-read until 1, 2 or 3):
- Add a video in the first empty row (title, format, year, code), then return to the menu.
- Search by title. Copy every matching row into
Results(reset to""first). Output the four fields of each hit, orNot found. - Stop.
Invalid menu input outputs You must input 1, 2 or 3.
Input: Menu choices and the data they need.
Output: Menu errors, search rows, or Not found.
Example:
Input: 1
Macbeth
DVD
2015
DG1
2
Macbeth
3
Output: Macbeth
DVD
2015
DG1
Sample Test Cases
Test 1: Add one title then find it
Inputs: 1, Macbeth, DVD, 2015, DG1, 2, Macbeth, 3
Expected: Macbeth
DVD
2015
DG1
Test 2: Search an empty library
Inputs: 2, Macbeth, 3
Expected: Not found