ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions

N5 Computing Science 2018 Question 21

11 marks · Selection and logical operators

Using a design technique of your choice, refine step 4. Customers who spend £50 or more on tickets qualify for a number of food vouchers. Step 5 of the algorithm has been implemented below. . . . Line 23 IF totalCost < 50 THEN Line 24 SEND "Sorry, no food voucher" TO DISPLAY Line 25 ELSE Line 26 IF totalCost >100 THEN Line 27 SEND "You have been awarded 2 food vouchers" TO DISPLAY Line 28 ELSE Line 29 SEND "You have been awarded 1 food voucher" TO DISPLAY Line 30 END IF Line 31 END IF . . . State the output if: the total cost is 104; the total cost is 50. When the completed code is tested, a user enters 2.5 for the number of adult tickets. The program continues to run and calculates the total cost. Explain how the program could be made fit for purpose. State the processor component that calculates the total cost. Name the part of the computer system that transfers the value of totalCost from main memory to the processor. A program will calculate the total cost when customers purchase tickets to a theme park. Adults pay £25 per ticket; children pay £10. If there are two or more adults with more than two children a discount of £5 is subtracted from the total cost. Algorithm 1. Store cost of adult and child ticket 2. Get name of person making booking 3. Get quantity of tickets 4. Calculate total cost 5. Display food voucher message Refinement 2.1 Get first name 2.2 Get second name 3.1 Get quantity of adult tickets 3.2 Get quantity of child tickets

Marking scheme

One mark each for: • basic calculation (adults * 25 + children * 10) • basic calculation stored • adults >=2 • AND, & • children >2 • subtraction of discount within condition (- 5) Condition for adults tickets (which is an integer) may also be: adults > 1 You have been awarded 2 food vouchers You have been awarded 1 food voucher Any one from: • ensure only integers are accepted • input validation with appropriate explanation. Also accept: • no decimal places • whole numbers If candidate states round they must state to 0 decimal places. Arithmetic Logic Unit (ALU) Data bus

Previous question: N5 Computing Science 2018 Question 20

Next question: N5 Computing Science 2018 Question 22