12 Scenario Based Questions
12 Scenario Based Questions
The 2D array StudentMark[]contains the mark for each subject, for each student.
The position of each student’s data in the two arrays is the same, for example, the student in position 10
in StudentName[] and StudentMark[] are the same.
All students study the same number of subjects. The arrays and variables have already been set up and
the data stored. Student grades are awarded using the average mark, if an average mark is:
∙ greater than or equal to 55 and less than 70 then a merit grade is awarded
∙ greater than or equal to 40 and less than 55 then a pass grade is awarded
∙ calculates the combined total mark for each student for all their subjects
∙ calculates the average mark for each student for all their subjects, rounded to the nearest
whole number
– name
– average mark
– selected grade
∙ calculates, stores and outputs the number of distinctions, merits, passes and fails for the
whole class.
A customer can check whether the parcel is suitable for delivery by entering the weight and the
Dimension (length, width and height) of each parcel.
The prices for a parcel are based on the weight as shown in the following table:
∙ requires a customer to input the weight and the Dimensions of the parcel to be checked, with a
suitable prompt
∙ uses a function or procedure to check if the parcel has a valid weight and valid Dimensions:
∙ requires the customer to input whether they need to check a new parcel, with a suitable prompt:
A separate two-dimensional (2D) array Readings[] stores the latest data recorded about each patient.
The array already contains the readings taken by a nurse for each patient:
The hospital number given to the patient is used for the index on both arrays, this is a value between 1
and 1000 inclusive.
When the data for a patient is checked a warning is given if any of the readings are out of range. If both
readings are out of range, then a severe warning is given. Write a procedure, using pseudocode or
program code, that meets the following requirements:
• outputs an error message and exits the procedure if the number is not valid
– output ‘Warning’ and the name of the reading e.g. ‘Pulse’ if one reading is out of range
– output ‘Severe warning’ and the names of the two readings ‘Pulse and temperature’ if both readings
are out of range
– exits the procedure. You must use pseudocode or program code and add comments to explain how
your code works.
The one-dimensional (1D) array TeamName[] contains the names of teams in a sports league.
The two-dimensional (2D) array TeamPoints[] contains the points awarded for each match.
The position of each team’s data in the two arrays is the same. For example, the team stored at
The variable LeagueSize contains the number of teams in the league. The variable MatchNo
contains the number of matches played. All teams have played the same number of matches.
The arrays and variables have already been set up and the data stored.
Each match can be played at home or away. Points are recorded for the match results of each
• 3 – away win
• 2 – home win
• 1 – drawn match
• 0 – lost match.
• calculates the total points for all matches played for each team
• counts the total number of away wins, home wins, drawn matches and lost matches for each
team
– name
– total points
– total number of away wins, home wins, drawn matches and lost matches
• finds and outputs the name of the team with the highest total points
• finds and outputs the name of the team with the lowest total points.
You do not need to declare any arrays, variables or constants; you may assume that this has already
been done.
The number of people currently staying in each room is stored in an array with the identifier room.
Array room
Index 1 2 3 4 5 6 8 8 9
Data 2 1 3 2 1 0 0 4 1
Customers at a hotel can stay between 1 and 5 (inclusive) nights and can choose between a basic room
or a premium room.
(a) When a new booking is recorded, the following details are entered into a program
a. Firstname and surname of each customer
b. Type of the Room
c. Number of Nights Stay
A two-dimensional (2D) array Account[] contains account holders’ names and passwords for a
banking program. A 2D array AccDetails[] has three columns containing the following details:
• column one stores the balance – the amount of money in the account, for example 250.00
• column two stores the overdraft limit – the maximum total amount an account holder can borrow
from the bank after the account balance reaches 0.00, for example 100.00
• column three stores the withdrawal limit – the amount of money that can be withdrawn at one time,
for example 200.00
The amount of money in a bank account can be negative (overdrawn) but not by more than the
overdraft limit. For example, an account with an overdraft limit of 100.00 must have a balance that is
greater than or equal to –100.00
Suitable error messages must be displayed if a withdrawal cannot take place, for example if the
overdraft limit or the size of withdrawal is exceeded.
The bank account ID gives the index of each account holder’s data held in the two arrays. For example,
account ID 20’s details would be held in:
The data are stored in two 1D arrays named WoodType[] and Price[]. The index of the wood
type and price in their arrays share the same index number.
Write a program that meets the following requirements:
• input a new customer’s name, room length and room width
• check that each measurement is valid
• output an error message and require the measurement to be re‑entered until it is valid
• calculate the area of the room by multiplying together the length of the room and the width of
the room
• input the choice of wood and find its price per square metre
• calculate the price of the wood needed
• store all data in the relevant array
• output the customer’s quotation to include: the name of the customer, the choice of wood and
the calculated price of the wood required
• continue to accept the next customer.
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.
You will need to initialise WoodType[] and Price[]
All inputs and outputs must contain suitable messages.
Scenario Based Question 12
A weather station takes temperature readings once an hour for a week. These temperatures are stored
in a two-dimensional (2D) array Temperatures[]
Each column contains 24 readings for a single day. The first temperature is recorded at 00:00 and the
final temperature at 23:00. There are seven columns, one for each day of the week, starting with
Monday and ending with Sunday.
The variables MaxDay, MinDay and AvDay are used to store the maximum, minimum, and average
temperatures for a day. The variables MaxWeek, MinWeek and AvWeek are used to store the
maximum, minimum, and average temperatures for the week.
The array has already been set up and the data stored. Write a program that meets the following
requirements:
• finds the maximum and minimum temperatures for each day
• calculates the average temperature for each day
• outputs for each day:
– name of the day, for example Monday
– maximum temperature
– minimum temperature
– average temperature
• finds the maximum and minimum temperatures for the week
• calculates the average temperature for the week
• outputs:
– maximum temperature for the week
– minimum temperature for the week
– average temperature for the week.
All temperatures output must be rounded to two decimal places.
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.