Time allowed: 40 minutes
| Centre number |
| | | |
|
Candidate number |
| | | |
| First name |
|
Last name |
INSTRUCTIONS
- Use black ink.
- Answer all the questions.
INFORMATION
- The total mark for this paper is 24.
- The marks for each question are shown in brackets [ ].
Turn over
Section A: Core Skills
1
A software development company has a team of 20 programmers working on a single large project.
(a) Explain why the use of comments is essential when multiple programmers are working on the same file.
[2]
(b) Apart from comments, state
one other technique that makes code easier to read for other programmers.
[1]
Section B: Applied Maintenance
2
The following algorithm calculates the pay for a worker. However, the programmer has used poor variable names, making it difficult to maintain.
x = float(input("Enter number: "))
y = float(input("Enter number: "))
z = x * y
print("Total is: " + str(z))
Rewrite the algorithm above.
You must change the variable names to be meaningful and follow standard conventions. The logic must remain exactly the same.
[3]
3
In Python, indentation defines the structure (blocks) of the code.
Look at the two code snippets below. They contain the exact same text, but the indentation of
Line 04 is different.
Snippet A:
01 score = 10
02 if score > 5:
03 print("Start")
04 print("End")
Snippet B:
01 score = 10
02 if score > 5:
03 print("Start")
04 print("End")
(a) State the output of Snippet A.
[1]
(b) State the output of Snippet B if
score is changed to 2.
[1]
(c) Explain how the indentation of Line 04 changes the logic of the program between Snippet A and Snippet B.
[2]
Turn over