Question 5(c)(ii) 2015 · May-June · Paper 22 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (c)
(ii)
(ii)
Show text version of question
Question 5
Part (c)
(ii)
Question 5
A company creates two new websites, Site X and Site Y, for selling bicycles.
Various programs are to be written to process the sales data.
These programs will use data about daily sales made from Site X (using variable SalesX) and Site Y (using variable SalesY).
Data for the first 28 days is shown below.
SalesDate SalesX SalesY 1 03/06/2015 0 1 2 04/06/2015 1 2 3 05/06/2015 3 8 4 06/06/2015 0 0 5 07/06/2015 4 6 6 08/06/2015 4 4 7 09/06/2015 5 9 9 11/06/2015 4 1 …
The company wants a program to output the total monthly sales for one of the selected websites.
The programmer codes a function with the following function header:
FUNCTION MonthlyWebSiteSales(ThisMonth : INTEGER, ThisSite : CHAR) RETURNS INTEGER
The function returns the total number of bicycles sold for the given month and website.
The function will use the following:
Identifier Data type Description Represents the month number e.g. ThisMonth INTEGER 4 represents April Coded as: ThisSite CHAR • X for website X
- Y for Website Y
(ii)
Some of the following function calls may be invalid.
Mark each call with:
- a tick (✓), for a valid call
- a cross (✗), for an invalid call
For any function calls which are invalid, explain why.
Tick (✓) Explanation Function call / cross (✗) (if invalid)
MonthlyWebSiteSales(1, "Y")
MonthlyWebSiteSales(11, 'X', 'Y')
MonthlyWebSiteSales(12, 'X')
Question 15
Why this question appears here
71% assigned-topic match · Programming › Constructs
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
