Final Built in Questions Worksheet
Final Built in Questions Worksheet
Computer Science
B
Variable Value
MyGreeting "Happy Birthday"
MyInitial 'C'
AgeInYears
Weight
27
60.5
AI
H
Married TRUE
Children TRUE
ZO
Expression Evaluates to
"Mon" & MID(MyGreeting, 10, 2)
S
AgeInYears + ASC(MyInitial)
INT(MyInitial)
C
MOD(Weight * 2, 10)
Married AND (NOT Children)
[5]
(ii) Programming languages support different data types.
Give an appropriate data type for each of these variables from part (b)(i).
Appendix
Built-in functions (pseudocode)
Each function returns an error if the function call is not properly formed.
B
Example: LEFT("ABCDEFGH", 3) returns string "ABC"
Operators (pseudocode)
Operator Description
Concatenates (joins) two strings
&
Example: "Summer" & " " & "Pudding" produces "Summer Pudding"
Performs a logical AND on two Boolean values
AND
Example: TRUE AND FALSE produces FALSE
Performs a logical OR on two Boolean values
OR
Example: TRUE OR FALSE produces TRUE
2 (a) A program controls the heating system of an energy-efficient house.
Give a suitable identifier name for each of the data items.
Variable Value
Quality 'D'
B
DayNumber 20
MyName "Stephen"
QualityConfirmed
Factor
AI
TRUE
6.5
H
Evaluate each expression in the following table.
ZO
For the built-in functions list, refer to the Appendix on page 15.
Expression Evaluates to
S
20 + ASC(Quality)
QualityConfirmed + 3
MOD(Factor * 2, 9)
[5]
(ii) Programming languages support different data types.
Give an appropriate data type for each of these variables from part (b)(i).
DayNumber
Factor
Quality
MyName
[5]
B
AI
H
ZO
S
C
3
C
S
ZO
H
AI
B
C
S
ZO
H
AI
B
Q2.
C
S
ZO
H
AI
B
C
S
ZO
H
AI
B
Q.2
Q.1
C
S
ZO
H
AI
B
Q.3
Q4.
C
S
ZO
H
AI
B
Q6.
Q5.
C
S
ZO
H
AI
B
C
S
ZO
H
AI
B
18
Appendix
Built-in functions (pseudocode)
Each function returns an error if the function call is not properly formed.
B
Example: RIGHT("ABCDEFGH", 3) returns string "FGH"
returns the integer value representing the remainder when ThisNum is divided by ThisDiv
Operators (pseudocode)
Operator Description
B
AI
H
ZO
S
C