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

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

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

Official answer for Question 4

Part (b)

Part (b)

‘Pseudocode’ solution included here for development and clarification of mark scheme.

✓
Programming language example solutions appear in the Appendix.
✓
Expected Loop-based solution:
✓
DECLARE i , NextNumber : INTEGER
✓
FOR i ← 1 TO 4
✓
NextNumber ← 1 + INT(Rnd() * 150)
✓
OUTPUT NextNumber
✓
ENDFOR
✓
Mark as follows:
  • Declaration of all variables used including data types
  • Loop
  • Assignment / calculation of (four) different random numbers (0 to 150) in a loop
  • Output of four values
✓
ALTERNATIVE Non-Loop version
✓
DECLARE Num1, Num2, Num3, Num4 : INTEGER
✓
Num1
✓
←
✓
INT(RND()
✓
*
✓
150))
✓
+

Question 1

✓
Num2
✓
←
✓
INT(RND()
✓
*
✓
150))
✓
+

Question 1

✓
Num3
✓
←
✓
INT(RND()
✓
*
✓
150))
✓
+

Question 1

✓
Num4
✓
←
✓
INT(RND()
✓
*
✓
150))
✓
+

Question 1

✓
OUTPUT Num1, Num2, Num3, Num4
✓
Mark as follows:
  • Declaration of all variables used including data types
  • Assignment of four different random numbers (0 to 150)
  • Assignment to four separate variables
  • Output of four values
[4]
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International AS/A Level – October/November 2016
✓
9608

Question 22

Mark scheme 9608_w16_ms_22.pdf →

Show text version of question

Question 4

Part (b)

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 (b)

Write program code to generate and output four winning numbers.

Ignore the issue that duplicate numbers may be generated.

Visual Basic and Pascal: You should include declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.

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

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

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

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

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

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

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

[4]
Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Programming basics

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