9618/21

Computer Science 9618/21May/June 2023

Cambridge AS Level · Fundamental Problem-solving and Programming Skills · worked solutions for every part, with the mark scheme

8
questions
75
marks
120
minutes

Topics Programming · Software Development · Algorithm Design and Problem-solving · Data Types and Structures

Q1Software DevelopmentProgrammingAlgorithm Design and Problem-solvingFree sample

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.

(a)

Describe how a typical Integrated Development Environment (IDE) could be used to help debug the program to find the errors in the function Calculate().

4M
(b)

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 ..........................................................................................................................................

3M
(c)

The program contains variables with values as follows:

VariableValue
ActiveTRUE
Points75
ExemptFALSE
(i)

Complete the table by evaluating each expression.

ExpressionEvaluation
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
2M
(ii)

Write expression 4 from the table in part (c)(i) in its simplest form.

1M

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
Loading the full paper…