Skip to main content
O-LevelComputer ScienceProgramming2210/22 · Oct/Nov 2024 · Q1115 Marks

A one-dimensional (1D) array Rooms [] contains the names of up to 20 rooms in a house. A two-dimensional (2D) array Dimensions [] is used to store the length, width and area of each room. The position of any room's data is the same in both arrays. For example, the data in index 5 of Dimensions [] belongs to the room in index 5 of Rooms[] The variable Number stores the number of rooms for which data is to be input. There must be at least 3 rooms but no more than 20. Write a program that meets the following requirements: • allows the number of rooms for which data is required to be input, stored and validated • allows the name of the room and the length and width of the room, in metres, to be entered and stored • allows the area of each room to be calculated as length multiplied by width and stored as square metres rounded to two decimal places • calculates the average size of all the rooms by area, in square metres, rounded to two decimal places • finds the largest room and smallest room by area • outputs the names of all rooms with their dimensions and area • outputs the names of the largest room and smallest room by area • outputs the total area of the house and the average size of all the rooms by area. You must use pseudocode or program code and add comments to explain how your code works. You do not need to declare any arrays or variables; you may assume that this has already been done. All inputs and outputs must contain suitable messages.

  1. (a)A one-dimensional (1D) array Rooms [] contains the names of up to 20 rooms in a house. A two-dimensional (2D) array Dimensions [] is used to store the length, width and area of each room. The position of any room's data is the same in both arrays. For example, the data in index 5 of Dimensions [] belongs to the room in index 5 of Rooms[] The variable Number stores the number of rooms for which data is to be input. There must be at least 3 rooms but no more than 20. Write a program that meets the following requirements: • allows the number of rooms for which data is required to be input, stored and validated • allows the name of the room and the length and width of the room, in metres, to be entered and stored • allows the area of each room to be calculated as length multiplied by width and stored as square metres rounded to two decimal places • calculates the average size of all the rooms by area, in square metres, rounded to two decimal places • finds the largest room and smallest room by area • outputs the names of all rooms with their dimensions and area • outputs the names of the largest room and smallest room by area • outputs the total area of the house and the average size of all the rooms by area. You must use pseudocode or program code and add comments to explain how your code works. You do not need to declare any arrays or variables; you may assume that this has already been done. All inputs and outputs must contain suitable messages.[15]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.

  1. [9] AO2 (maximum 9 marks)
  2. [6] AO3 (maximum 6 marks)
  3. [1] Data Structures required with names as given in the scenario: Arrays or lists Rooms[], Dimensions[]
  4. [1] Variables Number
  5. [1] R1: Input and store number of rooms, the names of the rooms and their dimensions, including validation of number of rooms (input with prompts, (nested) iteration, use of variables, 1D and 2D arrays, validation).
  6. [1] R2: Calculate and store the area of each room, the total area of the house and the average room area rounded to two decimal places. Find the smallest and largest rooms (calculation, totalling, rounding, finding maximum and minimum values, iteration).
  7. [1] R3: Output the results, including contents of the arrays and the calculated data (iteration, output).

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Programming, O-Level Computer Science (syllabus 2210). Structured question, 15 marks.
Source
O-Level Computer Science, Oct/Nov 2024 Paper 2 Variant 2, question 11.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep