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

N5 Computing Science 2016 Question 21

10 marks · Design techniques

State one benefit of using the design notation shown above instead of pseudocode. Name the algorithm illustrated in the bowling alley program design. Is number of games acceptable? No Yes Display: “Booking Accepted” Using pseudocode or a programming language of your choice, complete the conditional statement at Line 3 below to implement this section of the design. Line 3 numPlayers and numGames Line 4 SEND “Booking Accepted” TO DISPLAY The program is tested using a set of test data. Complete the table below to show three examples of test data types and the expected result for each type. Test data type Test data Expected Result numPlayers = 3 numGames = 2 Normal Booking accepted numPlayers = 4 numGames = 3 Booking accepted numPlayers = 6 numGames = 3 The character “£” is entered as a test value for the number of players. This causes the program to crash. State the type of error that would cause this crash. Error detection and correction in a program is easier if the code is readable. State one technique that can be used to ensure readability of code. A software developer is creating an online booking system for a bowling alley. Customers can book a bowling lane for a maximum of 4 people playing a maximum of 3 games. The developer has used a flow chart to produce the program design. Part of the design is shown below. Input: number of players No Is number of players Display: “Not valid no of players” acceptable? Yes Input: number of games No Is number Display: of games “Invalid number of games” acceptable? Yes Display: “Booking Accepted”

Marking scheme

Any one from: • Provides a visual representation which can be easier to understand • Illustrates flow of data/sequence of processes Input validation IF/while (1 mark) numPlayers <=4 (1 mark) numGames <=3 (1 mark) or numPlayers <5 (1 mark) numGames <4 (1 mark) No specific mark for use of AND as it is stated in the decision. No formal syntax is required as candidates can write answer in “pseudocode”. For example, use of ‘<=’ and ‘=<’ or ‘less than or equal to’ would all be acceptable. Test Data Type Expected Result Normal Booking accepted Extreme Booking accepted Not valid number of players Exceptional Allow Normal for first answer as extreme test data is a sub-set of normal test data. Run time/Execution error Any one from: • Internal commentary • Meaningful identifiers • Indentation/white space • Highlight keywords • Modular code

Previous question: N5 Computing Science 2016 Question 20

Next question: N5 Computing Science 2017 Question 1