Question 4(c) 2016 · October-November · Paper 22 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (c)
Part (c)
Visual Basic
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 ............................................................................................................
...................................................................................................................................................
..............................................................................................................................................
Question 11
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
