← Back to Dashboard

2.2.1 Programming fundamentals

A-Level Computer Science

1. A programmer creates this function shown in Fig. 5 using a high-level language.
Question Image
a) State the value output by the line print(mystery(10,20))
[1]
Login to save your answers
/ 1
b) State the value output by the line print(mystery(0,70))
[1]
Login to save your answers
/ 1
c) State the value output by the line print(mystery(45,55))
[1]
Login to save your answers
/ 1
2. A doCheck() function takes an integer value as a parameter, carries out a series of calculations
and returns an integer value. The function is shown here.
Question Image
a) State the value returned from the function when doCheck(3178) is called
[1]
Login to save your answers
/ 1
b) Write an algorithm that will:
• allow the user to enter an integer value
• pass the value entered into the doCheck() function as a parameter
• store both the value input and the value returned from the function in a text file with
name "storedvalues.txt"

You should write your algorithm using either pseudocode or program code.
[5]
Login to save your answers
/ 5
Please login to save your answers and marks.