Computer Science 9618/21 — May/June 2023
Cambridge AS Level · Fundamental Problem-solving and Programming Skills · worked solutions for every part, with the mark scheme
Topics Programming · Software Development · Algorithm Design and Problem-solving · Data Types and Structures
Refer to the insert for the list of pseudocode functions and operators.
A programmer has written a program which includes the function Calculate(). When the program is run, the function returns an unexpected value.
Describe how a typical Integrated Development Environment (IDE) could be used to help debug the program to find the errors in the function Calculate().
The algorithm for function Calculate() contains the three pseudocode statements shown.
Describe the error in each statement or write ‘no error’ if the statement contains no error.
Assume any variables used are of the correct type for the given function.
Statement 1: Index ← STR_TO_NUM(("27") + 2)
Error ..........................................................................................................................................
Statement 2: Index ← STR_TO_NUM(MID("CPE1704TKS", 4, 2))
Error ..........................................................................................................................................
Statement 3: IF MONTH(ThisDate) > '6' THEN
Error ..........................................................................................................................................
The program contains variables with values as follows:
| Variable | Value |
|---|---|
| Active | TRUE |
| Points | 75 |
| Exempt | FALSE |
Complete the table by evaluating each expression.
| Expression | Evaluation | |
|---|---|---|
| 1 | (Points > 99) OR Active | |
| 2 | (Points MOD 2 = 0) OR Exempt | |
| 3 | (Points <= 75) AND (Active OR Exempt) | |
| 4 | (Active OR NOT Active) AND NOT Exempt |
Write expression 4 from the table in part (c)(i) in its simplest form.
The rest of this paper
7 more questions- Q2Algorithm Design and Problem-solving · Data Types and Structures · Programming7M
- Q3Data Types and Structures · Algorithm Design and Problem-solving · Programming11M
- Q4Programming6M
- Q5Software Development6M
- Q6Data Types and Structures · Programming6M
- Q7Algorithm Design and Problem-solving · Software Development · Programming8M
- Q8Programming · Data Types and Structures · Software Development21M