The leisure centre runs fitness classes - Edexcel - GCSE Computer Science - Question 3 - 2021 - Paper 1
Question 3
The leisure centre runs fitness classes.
(a) This is an algorithm used by instructors to check the Body Mass Index (BMI) of people attending their classes.
Complet... show full transcript
Worked Solution & Example Answer:The leisure centre runs fitness classes - Edexcel - GCSE Computer Science - Question 3 - 2021 - Paper 1
Step 1
Complete the algorithm by filling in the boxes.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Function Declaration: Line 4 can be filled with FUNCTION bmiCalc(pMass, pHeight) to specify the parameters for mass and height.
Calculation Return: Line 22 should be filled with SET calc = pMass / (pHeight * pHeight) to correctly calculate BMI using the formula:
ext{BMI} = rac{ ext{mass}}{ ext{height}^2}
Matching Order: Match the parameter names to the variables being used; this is done by ensuring consistent naming throughout the function.
Step 2
State the process being carried out at line 7 of the algorithm.
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
At line 7, the algorithm is executing a loop that iterates through each element in the arrayAttendance. This means it is processing each value of attendance for the fitness classes.
Step 3
Complete the trace table showing the execution of the algorithm with these five values.
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!