Figure 7 shows a pseudo-code subroutine called testSub.
Say what task the subroutine in Figure 7 performs.
Our own questions on this topic, marked straight away, so you see what to revise. Free now.
Show model answer for 07.1Hide model answer for 07.1
It tests whether a number is even. It returns True for an even number and False for an odd one.
How the marks are earned
- It finds out whether a number is odd or even, or a multiple of 2.
- Or it returns True if the number is even and False if it is odd.
- Or it returns True if the number is a multiple of 2 and False if it is not.
- Or True comes back when the remainder after dividing by 2 is 0, and False when the remainder is 1 or anything other than 0.
List the two values output when testSub(10) is called.
See how you would score on Pseudocode & FlowchartsShow model answer for 07.2Hide model answer for 07.2
Program code Output
OUTPUT number 10
OUTPUT x 0How the marks are earned
- OUTPUT number prints 10.
- OUTPUT x prints 0.
Why it scores
The first output is the parameter itself, 10. The second output is what is left over after dividing 10 by 2, which is 0.
Revise Pseudocode & FlowchartsGive the value testSub(8) returns.
See how you would score on Pseudocode & FlowchartsShow model answer for 07.3Hide model answer for 07.3
True. Dividing 8 by 2 leaves a remainder of 0, so the subroutine takes the THEN branch and returns True.
Name the parameter of testSub.
See how you would score on Pseudocode & FlowchartsShow model answer for 07.4Hide model answer for 07.4
number. It is the name in the brackets on the first line, which receives the value passed in.
Give two features of programming in a structured way.
See how you would score on Computational ThinkingShow model answer for 07.5Hide model answer for 07.5
1. The program is split into subroutines, each doing one job. 2. The subroutines use parameters to receive values and return values to give results back.
How the marks are earned
- Any two different ideas from this list and the points below earn the two marks. Idea 1: the program is modular, meaning it is split into sections, chunks or modules, uses subroutines, or uses named blocks of code, or blocks of code kept out of line; these phrasings count as one idea.
- It uses parameters.
- It uses return values.
- It uses local variables.
- It uses selection.
- It uses iteration.
- It has well documented interfaces, meaning clearly documented inputs and outputs of its subroutines.
Why it scores
Each line is a different feature, so the two marks are separate. The second line names two features, parameters and return values, and only one of them is needed for its mark.
Revise Computational Thinking