Score: 0/0
Question 1 of ∞
Table 1 shows some the descriptions of five variables.
Table 1
| Variable |
Data Type |
| Name |
|
| Age |
|
| Height (m) |
|
| Phone number |
|
| Employed? |
|
Complete Table 1 by adding the most appropriate data types.
Name: String (names are collections of characters)
Age: Integer (an age is usually represented as a whole number)
Height: Float / Real (height in metres is usually a number with a decimal part)
Phone number: String (phone numbers start with a 0, which would not be possible to represent as an integer)
Employed?: Boolean (there are only two possible options here: true or false)
(a) The data type of a variable
(b) The data type of a constant
(c) The value of a variable
(d) The value of a constant
Which of the above can be changed as a program runs?
(c) The value of a variable
Example 1 shows an algorithm written in pseudo-code.
Example 1
date ← "Thu, 1 Jan 1970"
OUTPUT LEN(date)
OUTPUT POSITION(date, 'a')
OUTPUT SUBSTRING(1, 7, date)
What is the output of Example 1?
15
8
"hu, 1 J"
What is the output of
NOT(5 ≥ 9
OR 4 > 7)
XOR (6 ≠ 2
AND 8 < 1)?
True
Give two reasons why a developer might want to include random number in their game.
So that the game is different every time it is played
To simulate something that is random in real life
So that the game is unpredictable and challenging
[Other valid answers]
Why would a 2D array be used to store the top three athletes in each event at a sports day?
Because the data is split by two categories: in each event there is a list of three athletes to store.
Describe what is meant by structured programming.
Breaking down the main program into smaller, manageable modules
Designing, coding, and testing each module separately
Putting it all back together
Describe two suitable validation checks for a postcode input.
Presence check
to see if the postcode has been left blank
Format check
to see if the postcode contains only letters and numbers
Length check
to see if the postcode is between 5 and 7 characters
Format check
to see if the postcode ends with a number and two letters
Describe how a good test plan can help find logic errors.
A good test plan will check most of the possible paths of the program
It should test normal, boundary, and erroneous data
If any of the outputs are not equal to the expected output, there is a logic error
Explain two advantages of low-level programming languages.
Low-level languages have more control over the hardware
so e.g., the programmer can control exactly how memory is used in the program
Very efficient code can be written for a particular type of processor
so programs in low-level languages generally execute faster and use less memory than programs in high-level languages
Commands in machine code can be executed directly by the computer
so a translator is not required
Explain how an interpreter works.
The interpreter reads in the file statement by statement
It calls machine code subroutines to carry out commands
The interpreter stops if it finds a runtime error
No machine code is outputted by the interpreter so the program needs to be translated each time it is executed