Evaluation (SQA National 5 Computing Science): Exam Questions

Exam code: X816 75

3 mins3 questions
1
1 mark

Part of a program is shown below.

…
Line 34 RECEIVE xyz FROM (INTEGER) KEYBOARD
Line 35 SET abc TO xyz ^ 2
…

The programmer has not used internal commentary or white space in their code.

State one other way to improve the readability of this code.

2
1 mark

A gym wants to encourage members to burn more calories than their monthly target.

It uses a program to calculate additional calories burned over a 12‑month period.

....

April

May

June

....

....

6821.34

5129.89

4997.67

....

The design below shows how a member’s average additional calories burned is calculated and displayed.

  1. Store each month’s additional calories burned

  2. Calculate the average additional calories burned

  3. Display the average additional calories burned

The data structure calories is used to store additional calories burned each month. The variable avgCalories is used to store the user’s average additional calories burned

State the term used at the evaluation stage, to describe a program’s capability to handle unexpected or incorrect data being entered without crashing.

3
1 mark

A program is being designed to allow users to search for properties for sale.

A username and password are added to allow users to save searches. Part of the code is shown below.

…
Line 9 RECEIVE un FROM KEYBOARD
Line 10 RECEIVE pwd FROM KEYBOARD
Line 11 IF un = sUn OR pwd = sPwd THEN
Line 12 SEND "Welcome to saved searches" TO DISPLAY
Line 13 END IF
…

(i) Explain how indentation is used to make the code above more readable.

(ii) Describe how Line 11 could be made more readable.