Past-paper question · 2018 October-November · Paper 41 · Q2(b)

Question 2(b) 2018 · October-November · Paper 41 · 4 marks

Original past-paper question for 2(B)
Original past-paper question for 2(B)
Reveal official mark-scheme answer Official mark-scheme answer for 2(B)

Official answer for Question 2

Part (b)

Question 1

mark per bullet point to max 4:

Question 4

✓
•
✓
Function header
✓
•
✓
« taking ISBN as parameter
✓
•
✓
Converting ISBN to integer
✓
•
✓
Calculating Hash (ISBN mod 2000 + 1)
✓
•
✓
Returning the calculated Hash
✓
Examples:
✓
Python:
✓
def Hash(ISBN):
✓
ISBNint = int(ISBN)
✓
Hash = (ISBNint % 2000) + 1
✓
VB.NET:
✓
Function Hash (ISBN As String) As Integer
✓
ISBNint = convert.toInt32(ISBN)
✓
Hash = (ISBNint MOD 2000) + 1
✓
End Function
✓
Pascal:
✓
function Hash(ISBN : String) : Integer
✓
begin
✓
ISBNint = StrToInt(ISBN)
✓
Hash = (ISBNint MOD 2000) + 1
✓
end;
✓
9608/41
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November 2018
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w18_ms_41.pdf →

Show text version of question

Question 2

Part (b)

Question 2

Kendra collects books. She is writing a program to store and analyse information about her books.

Her program stores information about each book as a record. The following table shows the information that will be stored about each book.

Field name Description Title The title of the book Author The first listed author of the book

A
13-digit code that uniquely identifies the book,

ISBN for example: Fiction If the book is fiction (TRUE) or non-fiction (FALSE) LastRead The date when Kendra last read the book

Part (b)

The records are stored in a random access file.

The function, Hash(), takes as a parameter the ISBN and returns the hash value.

The disk address of the record in the hash table is calculated as: ISBN modulus 2000 plus 1.

Write program code for the function Hash().

Programming language ............................................................................................................

Program code ...........................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

..............................................................................................................................................

[4]

Question 6

Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Structured programming

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_w18_qp_41.pdf

Keep practising this topic