Past-paper question · 2015 May-June · Paper 22 · Q4(b)(i)

Question 4(b)(i) 2015 · May-June · Paper 22 · 20 marks

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

The answer for this question is in the official mark scheme: open the mark scheme.

Mark scheme 9608_s15_ms_22.pdf →

Show text version of question

Question 4

Part (b)

(i)

Question 4

Terminates the program Ends

Complete the pseudocode for the design in part (b), shown again below, to respond to each menu choice.

CONSTANT i 3 CALL DisplayMenu NoOfAttempts 0 REPEAT OUTPUT "Enter choice (1..4)" INPUT Choice NoOfAttempts NoOfAttempts + 1 UNTIL (Choice >= 1 AND Choice <= 4) OR NoOfAttempts = i

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

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

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

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

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

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

...............................................................................................................................................[3]

Question 7

Part (d)

The algorithm in part

Part (c)

is to be amended. The program will:

  • repeatedly display the menu and respond to the user’s choice
  • terminate when the user enters 4

Write program code for this final design which will be made up of:

  • the main program
  • procedure ReadFile
  • procedure DisplayMenu

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

...............................................................................................................................................[8]

Question 8

3 When the guarantee on a computer runs out, the owner can take out insurance to cover breakdown and repairs.

The price of the insurance is calculated from:

  • the model of the computer
  • the age of the computer
  • the current insurance rates

Following an enquiry to the insurance company, the customer receives a quotation letter with the price of the insurance.

A
program is to be produced.

The structure chart below shows the modular design for this process:

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

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

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

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

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

.................................... .................................... Premium rates

Premium rates

access premium rates database ....................................

Question 9

Using the letters E to J, complete the labelling on the chart opposite.

Some of these letters will be used more than once.

Data items E CustomerName F CustomerEmail G Model H Age I PolicyCharge J PolicyNumber

[4]

Question 10

4 A game is played between two players:

  • they take turns at rolling a six-sided die (numbered 1 to 6) and record their throw
  • a player scores 1 point if their throw is higher than their opponent
  • they each roll the die 20 times
  • if the player’s throw is the same as their opponent, the total points is unchanged
  • the winner is the player with the larger number of points after 20 throws

The pseudocode will use variable NoOfThrows as shown.

Identifier Data type Description NoOfThrows INTEGER Loop control variable

(i)

Complete the pseudocode for the given algorithm.

FOR ....................................................................................................................................

INPUT Player1Throw

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

IF Player1Throw > Player2Throw THEN

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

ENDIF IF Player2Throw > Player1Throw THEN Player2Total Player2Total + 1 ENDIF

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

IF Player1Total > Player2Total THEN OUTPUT "Player1 is the winner" ELSE OUTPUT "Player2 is the winner" ENDIF

[5]
Topic relevance

Why this question appears here

72% 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_s15_qp_22.pdf

Keep practising this topic