Time allowed: 1 hour 30 minutes
(a) Match the computational thinking terms to their definitions.
Term A: Abstraction | Term B: Decomposition | Term C: Algorithmic Thinking
1. The process of removes unnecessary detail to focus on key areas.
2. The process of creates a step-by-step logic to solve a task.
3. The process of breaks the problem down into sub-tasks.
(b) Explain why Abstraction is a necessary step when designing a computer model of a real-world hospital waiting room.
(a) Tick (✓) one box in each row to show whether the statement applies to a Compiler, an Interpreter, or Both.
| Statement | Compiler | Interpreter | Both |
|---|---|---|---|
| Translates high-level code into machine code | |||
| Translates and executes the code line-by-line | |||
| Produces a final executable file that can be distributed | |||
| Stops translating as soon as the first error is found |
(b) State two features found in an Integrated Development Environment (IDE) that assist a programmer in writing code (excluding debugging tools).
1:
2:
(a) Describe the difference between a Syntax Error and a Logic Error.
(b) Explain the difference between Iterative Testing and Terminal Testing during the software development lifecycle.
(a) A program uses the string variable hospitalName = "General Infirmary".
Complete the table to show the output of each string manipulation statement.
| Statement | Output |
|---|---|
print(hospitalName.left(7)) | |
print(hospitalName.length) | |
print(hospitalName.substring(8, 9)) | |
print(hospitalName.upper) |
(b) Write a single line of OCR Reference Language to extract the word "mary" from the variable hospitalName and store it in a variable called endPart.
(a) A database table Patients stores the PatientID, WardName, and PriorityLevel.
Write an SQL query to output the PatientID and WardName of all patients where the PriorityLevel is equal to 1.
(b) State what the * (asterisk) symbol represents when used in an SQL SELECT statement.
(a) Complete the table to justify the most appropriate data type for each variable.
| Variable | Data Type | Justification |
|---|---|---|
BedNumber (e.g. 14) | ||
Temperature (e.g. 37.5) | ||
Discharged (e.g. True) |
(b) State the output of the following arithmetic operations:
23 MOD 5 =
23 DIV 5 =
Context: Hospital Triage and Patient Management
(a) The hospital uses an Insertion Sort algorithm to organise patients by their arrival time.
Describe the step-by-step process of an Insertion Sort.
(b) If the list of patients is already almost entirely sorted in the correct order, explain why an Insertion Sort would be more efficient than a Bubble Sort.
A trace table is used to test the algorithm below, which calculates patient priority scores.
Complete the trace table for this algorithm.
| priority | flag | p | Output |
|---|---|---|---|
| 5 | True | ||
(a) The hospital records the waiting time (in minutes) for 50 patients in a 1D array called triageTimes.
Write an algorithm using iteration that:
triageTimes array.(b) Explain two reasons why it is more efficient for the programmer to store the 50 waiting times in an array rather than using 50 separate variables (e.g. time1, time2).
(a) A programmer has written a flawed function to determine if a patient should be admitted.
Identify the line number of the logic error regarding parameter usage, and state how it should be corrected.
Line number of error:
Correction:
(b) Identify two ways the programmer can make the above code more maintainable, and explain why each helps.
Method 1:
Reason:
Method 2:
Reason:
(c) A subroutine is called using the following statement:
assignBed(patientID, wardName, requiresOxygen)
State how many parameters are being passed to this subroutine.