Past-paper question · 2016 October-November · Paper 22 · Q4(c)

Question 4(c) 2016 · October-November · Paper 22 · 3 marks

Original past-paper question for 4(C)
Original past-paper question for 4(C)
Original past-paper question for 4(C)
Reveal official mark-scheme answer Official mark-scheme answer for 4(C)

Official answer for Question 4

Part (c)

Part (c)

Visual Basic

✓
Function GenerateNumber(ByVal AnyName AS INTEGER) AS INTEGER
✓
Pascal
✓
FUNCTION GenerateNumber (AnyName : INTEGER) : INTEGER
✓
Python
✓
def GenerateNumber (AnyName):
✓
•
✓
Mark as follows:
✓
•
✓
Correct keyword + Function name
✓
•
✓
Single input parameter of correct type
✓
•
✓
Return parameter type
[3]

Mark scheme 9608_w16_ms_22.pdf →

Show text version of question

Question 4

Part (c)

Question 4

A social club runs a weekly prize draw. A member can buy a ticket for $2. Each week, the club

sells up to 150 tickets, with consecutive numbers starting from 1. There is a main cash prize of $120 and a further three prizes of $10. The computer program will generate the winning numbers.

Throughout this question, you will need to refer to the list of pseudocode functions in the Appendix.

Part (c)

The prize draw is a success. After six months, the club decided to sell an unlimited number of

tickets each week. In any week, the total number of prizes may vary.

The programmer modifies the code written in part(b).

The revised program will use a function to generate a single winning number. Therefore, in a week when the club offers six prizes, the program will use the function six times to generate the six winning numbers.

The function has identifier GenerateNumber and:

  • has a single parameter for the number of tickets sold that week
  • returns a single winning number.

Write program code for the function header.

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

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

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

[3]

Question 11

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

Keep practising this topic