Skip to content

Course home

Sign up

Subprograms

EasyMediumHard
12345678910111213141516
Question 7

The partially completed pseudocode for a different algorithm to calculate the total booking cost of concert tickets is shown below. It uses a subprogram.

Complete the pseudocode by supplying the correct terms, parameters, or statements for the blanks on Line 8, Line 9, Line 23, and Line 33.

6 SET greeting TO "Welcome to the booking calculator"
7
8 _____ calcFinalPrice ( _____ )
9 BEGIN _____
10     SET greeting TO "Review your ticket fees below"
11     # calculate discount amount
12     SET discountVal TO inDiscount * inBase
13
14     # add booking fee to discounted price
15     SET totalCost TO (inBase - discountVal) + inFee
16
17     # print breakdown
18     SEND greeting TO DISPLAY
19     SEND "Total Cost: " & totalCost TO DISPLAY
20     SEND "Base Price: " & inBase TO DISPLAY
21     SEND "Discount: " & discountVal TO DISPLAY
22     SEND "Booking Fee: " & inFee TO DISPLAY
23 END _____
24
25 SEND greeting TO DISPLAY
26 # input base price, discount rate, and booking fee
27 SEND "Enter base ticket price (e.g., 50.00):" TO DISPLAY
28 RECEIVE ticketPrice FROM (REAL) KEYBOARD
29 SEND "Enter discount rate (e.g., 0.15):" TO DISPLAY
30 RECEIVE discRate FROM (REAL) KEYBOARD
31 SEND "Enter booking fee:" TO DISPLAY
32 RECEIVE bookingFee FROM (REAL) KEYBOARD
33 _____
[5]
Markscheme

Subprograms Questions

  1. GCSE
  2. /Computer Science
  3. /Subprograms

29 exam-style questions on Edexcel GCSE Computer Science Subprograms, covering Built-in and user-devised subprograms, Functions versus procedures, and Global and local variables. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank