#P3001. CAIE IGCSE CS Speciman Paper B 2023 Paper 2 Problem 13
CAIE IGCSE CS Speciman Paper B 2023 Paper 2 Problem 13
The names of patients are stored in the one-dimensional (1D) array of type string.
A separate two-dimensional (2D) array stores the latest data recorded about each
patient. The array contains the readings taken by a nurse for each patient:
- temperature measured to one decimal place
- pulse rate, a whole number.
Temperature readings should be in the range to inclusive.
Pulse readings should be in the range to inclusive.
The hospital number given to the patient is used for the index on both arrays, this is a value between and 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:
- takes the hospital number as a parameter
- checks if the number is valid
- outputs an error message and exits the procedure if the number is not valid
- if the hospital number is valid: – output the patient’s name – output ‘Normal readings’ if both the readings are within range – 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.
INPUT FORMAT
The first line contains , the ClassSize, and , representing queries
The second line contains patients' names
The third line contains patients' Temperature
The fourth line contains patients' Pulse Rate
After that, there are lines, each line contains one
OUTPUT FORMAT
For each queries, if the hospital number is valid
- Output the patient’s name
- Output
Normal readingsif both the readings are within range - Output
Warningand the name of the reading, andPulse RateorTemperature - Output
Severe warningand the names of the two readingsPulse Rate and Temperatureif both readings are out of range
Otherwise, Output Invalid and exits the procedure if the number is not valid
You should declare all variables you used
SAMPLE
INPUT
5 7
Alice Bob Carol Dave Eve
36.5 38.0 36.8 30.0 31.6
72 80 104 110 55
1
2
3
4
5
0
6
OUTPUT
Alice
Normal readings
Bob
Warning Temperature
Carol
Warning Pulse Rate
Dave
Severe warning Pulse Rate and Temperature
Eve
Normal readings
Invalid
Invalid