2021 DEV1 Test 2 - Exercise For Dev Question
2021 DEV1 Test 2 - Exercise For Dev Question
1 [ 3 marks ]
Given that cost is a numeric variable, which of the following is not a valid pseudocode instruction
a. cost = R500
b. cost = 500-00
c. cost = 500,00
d. All of these
2 [ 3 marks ]
Given that cost is a numeric variable, which of the following is a valid pseudocode instruction to test if the
cost is over R1000-00
a. IF cost > 1000.00 THEN
b. IF cost > R1000-00 THEN
c. IF cost >= 1000 THEN
d. None of these
5 [ 3 marks ]
What is displayed on the screen by the following code if TOT1 is 20 and TOT2 is 5
IF TOT2 * 5 > 30 THEN
DISPLAY TOT2
ELSE
DISPLAY TOT1
ENDIF
a. None of these
b. TOT2
c. 5
d. TOT1
6 [ 3 marks ]
What is displayed on the screen by the following code if SUM is 8 and NUM is 2
IF SUM - NUM > 4 + NUM THEN
SUM = SUM * 2
ENDIF
DISPLAY SUM
a. 8
b. 16
c. NUM
d. SUM
7 [ 3 marks ]
What value is in AVERAGE after this instruction is executed, if MARK1 is 75 and MARK2 is 63
AVERAGE = MARK1 + MARK 2 / 2
a. 138
b. 69
c. 106.5
d. None of these
1
8 [ 3 marks ]
What value is displayed on the screen by the following code if input is: 46
BEGIN
DECLARE temperature AS real
ACCEPT temperature
IF temperature > 35 THEN
DISPLAY “I am going to the beach”
ELSE
DISPLAY “I am staying at home”
ENDIF
END
a. I am going to the beach
b. I am staying at home
c. I AM STAYING AT HOME
d. I AM GOING TO THE BEACH
9 [ 3 marks ]
What is displayed on the screen by the following code if RED is input:
DECLARE MSG, COLOUR AS STRING
ACCEPT COLOUR
IF COLOUR = “RED” THEN
MSG = “YES”
ENDIF
MSG = “NO”
DISPLAY “COLOUR IS RED “ MSG
a. COLOUR IS RED YES
b. COLOUR IS RED NO
c. COLOUR IS YES
d. None of these
10 [ 3 marks ]
Given that XX= 4, XY = 2, and XZ = 1.5, the following code will display FALSE on the screen:
IF XX < XZ THEN DISPLAY “TRUE” ELSE DISPLAY “FALSE” END IF
a. True
b. False
11 [ 2 marks ]
IF WEIGHT <= 50 THEN is the correct condition to use to check if a person weighs more than 50 kgs
a. True
b. False
2
ESSAY QUESTION [ 18 marks ]
The Zundo Health Gym is giving special prices on workout sessions to new members.
The price for one session is based on different criteria as shown below:
a. for anyone whose hometown is not Mthatha: R200
b. for anyone whose age is over 45: R100
They want a program which will accept the person’s hometown and age .
The program must then calculate and display the total price the person will pay for 50 sessions.
DO THE FOLLOWING:
b. Draw the flow chart and algorithm for the program [ 5 marks ]
You can write each column heading and the contents under each other.