0% found this document useful (0 votes)
50 views12 pages

Cambridge International AS & A Level: Computer Science 9618/ NA

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views12 pages

Cambridge International AS & A Level: Computer Science 9618/ NA

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Cambridge International AS & A Level

COMPUTER SCIENCE 9618/NA


Paper 2 Problem Solving & Programming UNKNOWN
MARK SCHEME
Maximum Mark: 75

Published

This mark scheme is published as an aid to teachers and candidates, to indicate the requirements of the
examination. It shows the basis on which Examiners were instructed to award marks. It does not indicate the
details of the discussions that took place at an Examiners’ meeting before marking began, which would have
considered the acceptability of alternative answers.

Mark schemes should be read in conjunction with the question paper and the Principal Examiner Report for
teachers.

Cambridge International will not enter into discussions about these mark schemes.

Cambridge International is publishing the mark schemes for the NA series for most Cambridge IGCSE™,
Cambridge International A and AS Level components and some Cambridge O Level components.

This document consists of 10 printed pages.

[Turn over
Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Generic Marking Principles

These general marking principles must be applied by all examiners when marking candidate answers.
They should be applied alongside the specific content of the mark scheme or generic level descriptors
for a question. Each question paper and mark scheme will also comply with these marking principles.

GENERIC MARKING PRINCIPLE 1:

Marks must be awarded in line with:

• the specific content of the mark scheme or the generic level descriptors for the question
• the specific skills defined in the mark scheme or in the generic level descriptors for the question
• the standard of response required by a candidate as exemplified by the standardisation scripts.

GENERIC MARKING PRINCIPLE 2:

Marks awarded are always whole marks (not half marks, or other fractions).

GENERIC MARKING PRINCIPLE 3:

Marks must be awarded positively:

• marks are awarded for correct/valid answers, as defined in the mark scheme. However, credit
is given for valid answers which go beyond the scope of the syllabus and mark scheme,
referring to your Team Leader as appropriate
• marks are awarded when candidates clearly demonstrate what they know and can do
• marks are not deducted for errors
• marks are not deducted for omissions
• answers should only be judged on the quality of spelling, punctuation and grammar when these
features are specifically assessed by the question as indicated by the mark scheme. The
meaning, however, should be unambiguous.

GENERIC MARKING PRINCIPLE 4:

Rules must be applied consistently, e.g. in situations where candidates have not followed
instructions or in the application of generic level descriptors.

GENERIC MARKING PRINCIPLE 5:

Marks should be awarded using the full range of marks defined in the mark scheme for the question
(however; the use of the full mark range may be limited according to the quality of the candidate
responses seen).

GENERIC MARKING PRINCIPLE 6:

Marks awarded are based solely on the requirements as defined in the mark scheme. Marks should
not be awarded with grade thresholds or grade descriptors in mind.
Question Answer Marks

1(a) The process involves: 2

1 Breaking down a problem / task into sub problems / steps / smaller parts
2 In order to explain / understand // easier to solve the problem
3 Leading to the concept of program modules // assigning problem parts to
teams

Max 2

1(b) 3
Answer

The number of dimensions of ThisArray 1

The technical terms for minimum and Lower bound, upper bound
maximum values that variable n may take

The technical term for the variable n in the Index / Subscript


pseudocode expression.

One mark per row

1(c) 4
Expression Evaluates to

ASC('C') 67

2 * STR_TO_NUM ("27") 54

INT(27 / 2) 13

"Sub" & MID("Abstraction" , 4 , 5) "Subtract"

One mark per row

Function names must be exactly as shown

1(d) 2
Expression Evaluates to

PressureOK AND HiFlow FALSE

PumpOn OR PressureOK TRUE

NOT PumpOn OR (PressureOK AND NOT HiFlow) TRUE

NOT (PumpOn OR PressureOK) AND NOT HiFlow FALSE

1 mark for any two rows correct


2 marks for all rows correct.
Question Answer Marks

2(a) 5

One mark for each outlined group.

Note:
• Sum and increment steps (bottom-right rectangles) may be in reverse
order in which case sum group will have two output lines

• Max 4 for non-working solution


Question Answer Marks

2(b)(i) One mark for each: 2

Life cycle method: Iterative // Rapid Application Development (RAD)

Reason: Provides a working model / prototype at an early stage for the


principal to approve / review

2(b)(ii) Decisions will be made regarding: 3

• Data structures
• Algorithms / flowcharts / pseudocode
• Program structure (modules) / use of library routines / module - team
allocation
• User interface // Web-page layout / content (for given scenario)
• Testing method / plan
• Choice of programming language / program environment
Max 3

Question Answer Marks

3(a)(i) One mark per point: 2

• EoQ pointer will move to point to location 4 // incremented EoQ (by 1)


• Data value "Octopus" will be stored in location pointed to be EoQ /
location 4

3(a)(ii) One mark for each bullet 2

• Value "Frog" // value pointed to by FoQ / location 0 is assigned to variable


AnimalName
• FoQ pointer will move to point to location 1 / point to "Cat" // incremented
FoQ (by 1)

0 Frog ← Front of queue pointer

1 Cat

2 Fish

3 Elk ← End of queue pointer

3(a)(iii) There is only one data item in the queue 1


Question Answer Marks

3(b)(i) One mark for data values plus one mark for pointers 3

0 Frog

1 Cat

2 Fish ← Front of queue pointer

3 Elk

4 Wasp

5 Bee

6 Mouse ← End of queue pointer

One mark for each pointer


One mark for three new data values

3(b)(ii) 2
0 Shark ← End of queue pointer

1 (Cat)

2 (Fish)

3 (Elk)

4 Wasp ← Front of queue pointer

5 Bee

6 Mouse

7 Dolphin

One mark for BOTH pointers


One mark for all data values as shown

3(c) One mark per point: 3

1 If incremented EoQ = FoQ then error condition: queue is full


2 Increment the EoQ
3 Manage wrap-around
Question Answer Marks

4(a) One mark per row 3


Answer

The number of different inputs 3

The number of different outputs 3

The single input value that could result in S4 Button-Y

Question Answer Marks

4(b) One mark per row 4

Example answer

Note: Accept other valid answers


Question Answer Marks

5(a) Simple Solution: 5

DECLARE ThisInt, Count : INTEGER


Count  0

FOR ThisInt  100 TO 200


IF ThisInt MOD 10 = 7 THEN
OUTPUT ThisInt
Count  Count + 1
ENDIF
NEXT ThisInt

OUTPUT Count

Mark as follows:

1 Declare loop variable and counter as integers, counter initialised


2 Loop 100 to 200, no step defined
3 Test value in a loop
4 Output selected value and incrementing a counter in a loop
5 Output the counter, following a reasonable attempt, after the loop

Alternative Solution:

DECLARE ThisInt, Count : INTEGER


Count  0

FOR ThisInt  107 TO 197 STEP 10


OUTPUT ThisInt
Count  Count + 1
NEXT ThisInt

OUTPUT Count

Mark as follows:

1 Declare loop variable and counter as integers, , counter initialised


2 Loop (107 to 197)
3 STEP 10 or explicit increment if conditional loop used
4 Output each value and incrementing a counter in a loop
5 Output the counter, following a reasonable attempt, after the loop
Question Answer Marks

5(b) IF MySwitch = 1 THEN 4


ThisChar  'a'
ELSE
IF MySwitch = 2 THEN
ThisChar  'y'
ELSE
IF MySwitch = 3 THEN
ThisChar  '7'
ELSE
ThisChar  '*'
ENDIF
ENDIF
ENDIF

Mark as follows:

1. ANY test of MySwitch = 1, 2 or 3


2. All three comparisons and corresponding assignments
3. OTHERWISE, or initial assignment of default value
4.. Completel correct IF...THEN...ELSE...ENDIF syntax

Question Answer Marks

6(a) FUNCTION IsPalindrome(InString : STRING) RETURNS BOOLEAN 7


DECLARE IsPal : BOOLEAN
DECLARE Index, Num : INTEGER
DECLARE CharA, CharB : CHAR

IsPal  TRUE
Index  1

Num  INT(LENGTH(InString) / 2)

WHILE Index <= Num AND IsPal = TRUE


CharA  MID(InString, Index, 1)
CharB  MID(Instring, LENGTH(Instring) – Index + 1,
1)
IF UCASE(CharA) <> UCASE(CharB) THEN
IsPal  FALSE // RETURN FALSE
ENDIF
Index  Index + 1
ENDWHILE

RETURN IsPal // RETURN TRUE

ENDFUNCTION

Mark as follows:

1 Functions header including parameter, ending and return type


2 Calculation of number of pairs to match (length or half length)
3 Loop for half or whole string
4 …Extracting characters to compare // create reverse string
5 Convert characters to same case
6 Check for mismatch of characters inside loop / test for mismatch after
loop for reversed string
7 Returning Boolean in both cases
Question Answer Marks

6(b) 4
Label
a ext

A Set OutString to ""

B Is Index > LENGTH(InString)?

C Is MID(InString, Index, 1) = " "?

Set OutString to OutString & MID(InString, Index,


D
1)

E Set Index to Index + 1

F YE

G NO

Mark for each of:


 B
 D
 C
 ...F and G

Note: The mark for F and G is dependent on a reasonable attempt at C

Qustion Answer Marks

7(a) PROCEDURE InitArrays() 4

DECLARE Index : INTEGER

FOR Index ← 1 TO 10000


TagString[Index] ← ""
TagCount[Index] ← 0
ENDFOR

ENDPROCEDURE

1 mark for each of the following:

1 Procedure heading and ending (as shown)


2 Declaration of Index (e.g.) as integer
3 Loop for 10000 iterations
4 Initialise TagString element to ""
Question Answer Marks

7(b) FUNCTION SaveArrays() RETURNS INTEGER 8

DECLARE Index, NumUnused : INTEGER


DECLARE FileString : STRING
CONSTANT COMMA = ','

NumUnused ← 0

OPEN "Backup.txt" FOR WRITE


FOR Index ← 1 to 10000
IF TagString[Index] <> ""
THEN
FileString ← TagString[Index] & COMMA & NUM_TO_STRING(TagCount[Index])
WRITEFILE "Backup.txt", FileString
ELSE
NumUnused ← NumUnused + 1
ENDIF
ENDFOR
CLOSEFILE "Backup.txt"

RETURN NumUnused
ENDFUNCTION

1 mark for each of the following:

1 Function heading and ending


2 Open the file Backup.txt in write mode and close file
3 Loop through 10000 elements
4 Test if TagString[Index] is "" in a loop
5 If not then form FileString from array elements with separator and using NUM_TO_STRING()in a loop
6 Write string to file in a loop
7 Count the number of unused elements
8 Return NumUnused not in a loop
Question Answer Marks

7(c) ‘Pseudocode’ solution included here for development and clarification of mark scheme. 8
Programming language example solutions appear in the Appendix.
Max 8 marks from 9 available mark points

FUNCTION LoadArrrays() RETURNS INTEGER

DECLARE ArrayIndex, Index, CountLen, Count : INTEGER


DECLARE FileString, HashTag : STRING
CONSTANT COMMA = ','

ArrayIndex ← 0 // first element

OPEN "Backup.txt" FOR READ


WHILE NOT EOF("Backup.txt")
READFILE "Backup.txt", FileString
Index ← 1
HashTag ← ""
WHILE MID(FileString, Index, 1) <> COMMA // hashtag
HashTag ← HashTag & MID(FileString, Index, 1)
Index ← Index + 1
ENDWHILE
TagString[ArrayIndex] ← HashTag
CountLen ← LENGTH(FileString) - LENGTH(HashTag) - 1
Count ← STR_TO_NUM(RIGHT(FileString, CountLen)) // count
TagCount[ArrayIndex] ← Count
ArrayIndex ← ArrayIndex + 1
ENDWHILE

CLOSE "Backup.txt"

RETURN ArrayIndex
ENDFUNCTION

You might also like