Professional Documents
Culture Documents
Data Types & Conversions (QS)
Data Types & Conversions (QS)
A Integer
B Boolean
C Real
D Character
E String
For each of the values in the table, write the label of the most suitable data type. Use a label only
once.
Label
Value
(A – E)
43.13
"Curry-Howard"
978
(Total 3 marks)
2. The following function calculates the second hand price of different models of car. The parameter
condition is an integer with a value between 1 and 4 where 1 is excellent and 4 is very bad.
CASE condition OF
1: cost ← cost – 100
2: cost ← cost – 300
3: cost ← cost – 500
4: cost ← cost – 1000
ENDCASE
RETURN cost
ENDFUNCTION
Page 1 of 3
(a) FUNCTION and ENDFUNCTION are keywords in CarPrice that indicate it is a function. Which
other keyword indicates that it is a function?
___________________________________________________________________
___________________________________________________________________
(1)
(b) Tick the most appropriate data type of the variable cost.
Boolean
Character
Real
String
(1)
(c) Complete the trace table below showing the changes in the variable cost when the
function CarPrice is called with the following arguments:
CarPrice('Tidy', 4, 2)
cost
(4)
(Total 6 marks)
Page 2 of 3
3. Which three of the following are common data types that most programming languages provide?
Boolean
Except
Length
Integer
While
Character
Maximum
(Total 3 marks)
___________________________________________________________________
(1)
___________________________________________________________________
(1)
___________________________________________________________________
(1)
(Total 3 marks)
Page 3 of 3