Past-paper question · 2015 October-November · Paper 22 · Q4(g)

Question 4(g) 2015 · October-November · Paper 22 · 4 marks

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

Official answer for Question 4

Part (g)

Part (g)

Pseudocode …

✓
(SELECT) CASE (OF) CardValue
✓
+ ENDCASE
[1]
✓
(CASE) 1: CardName ← "Ace"
✓
1 mark for any one correct
[1]
✓
(CASE) 11: CardName ← "Jack"
✓
(CASE) 12: CardName ← "Queen"
✓
(CASE) 13: CardName ← "King"
✓
(final three cases …)
[1]
✓
OTHERWISE (/ELSE) CardName ← CardValue
✓
//
✓
(CASE) 2 TO 10: CardName ← CardValue)
[1]
✓
ENDCASE // ENDSELECT
✓
Note: Must be double quotes present and correct case
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International AS/A Level – October/November 2015
✓
9608

Question 22

✓
Visual Basic
✓
Select Case CardValue
✓
Case 1
✓
CardName = "Ace"
✓
Case 11
✓
CardName = "Jack"
✓
Case 12
✓
CardName = "Queen"
✓
Case 13
✓
CardName = "King"
✓
Case Else // Case 2 to 10

CardName = Str(CardValue)[4]

✓
End Select
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International AS/A Level – October/November 2015
✓
9608

Question 22

Mark scheme 9608_w15_ms_22.pdf →

Show text version of question

Question 4

Part (g)

Question 4

The standard pack of playing cards has four suits – called Clubs, Diamonds, Hearts and Spades.

Each card has a value shown by its number or a name: 1 (Ace), 2, 3, … 10, 11 (Jack), 12 (Queen), 13 (King). The pack of cards has one combination for each suit and value.

A
program is to be written which simulates a magician dealing all 52 cards from the card pack.

The program generates pairs of random numbers:

  • the first, in the range 1 to 4, to represent the suit
  • the second, in the range 1 to 13, to represent the card value

Part (g)

Line 18 in the design shows which new card is dealt each time.

When an Ace, Jack, Queen or King is dealt, the output displays the number for that card, not the name of the card.

Card value Card name 1 Ace 11 Jack 12 Queen 13 King

A
new requirement is to display the name of the card, where appropriate.

Write a CASE structure using variable CardValue.

Assign to a new variable CardName either:

  • the card value (2, 3, 4, 5, 6, 7, 8, 9 or 10)
  • or where appropriate, the card name Ace, Jack, Queen or King

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

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

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

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

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

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

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

...............................................................................................................................................[4]

Question 11

Topic relevance

Why this question appears here

82% assigned-topic match · Hardware › Logic gates and logic circuits

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

Keep practising this topic