ExamBank Scot · AH Computing Science question bank · All AH Computing Science questions
15 marks · Development methodologies
The user interface of the robot control software was updated several times based on feedback from end users. Name the development methodology used to design the user interface and describe one benefit of this approach for the competition organisers. In the first challenge, the robot must complete the maze below. Each team programs their robot in advance by entering the set of instructions to be executed. Within the control software, the list of instructions is stored in a queue structure. Explain why a queue structure is suitable in this situation. The robot control software provides a backtracking option which returns the robot to the start position by retracing its path through the maze. During the competition, as each instruction is executed by the robot, it is removed from the queue structure mentioned in part (b) and added to a stack structure which is used to store the instructions for the backtracking path. The stack is implemented using a 1D array. Use pseudocode to design an algorithm which would allow an executed instruction to be added to the stack structure. Explain why most programmers would prefer to implement the stack using a linked list rather than a 1D array. Fifty teams are taking part in the RobotMaze competition. When completing a challenge, each robot is awarded scores out of ten from five judges. The results are held in a 2D array called results as shown below. Index [0] A1 Allstars [1] [2] [49] Zoe’s Zephyrs [0] [1] [2] [3] [4] [5] 6 9 8 7 8 7 Adam’s Aunt 5 4 3 4 4 Allie’s Angels 8 8 8 8 8 … …………… 10 9 7 8 The organisers want to add a search facility to the software. The search facility will make use of the binary search algorithm. The user will be asked to enter the name of one of the teams and the results for that team should be displayed. Use pseudocode to design the search facility. You should assume that the contents of the results array have already been sorted into ascending order of team name as shown above. In the last challenge, the robots navigate their own way through the maze by making independent decisions about their route. These robots are examples of intelligent systems. Similar intelligent systems are used in driverless vehicles. Describe one ethical and one social implication of the increasing use of intelligent systems in driverless vehicles. In the national RobotMaze competition, teams build a robot and then program their robot to complete a series of challenges. The competition organisers have developed specialist control software that will be used by all teams in the competition.
Iterative prototyping/RAD/agile (1 mark) It is easier to change layout of user interface if end user feedback is received early on in the development. (1 mark) 1 mark for correct technique. 1 mark for benefit for developers. As the data structure is FIFO, the instructions the team programs will be stored then executed in the correct order. 1 mark for appropriate explanation that relates to the scenario. 1. if pointer < stackSize then 2. set pointer = pointer + 1 3. set stack[pointer] = instruction 4. else 5. display stack full message 6. end if 1 mark each for any 3 of the following: • for IF to check for overflow • for pointer increment • for assignment of instruction • for stack full message. (c) Linked list is a dynamic data structure which allows instruction sets of differing lengths to be stored. (1 mark) Only data that needs to be stored will be added to the linked list. (1 mark) Use of a linked list provides a better high-level model for the programmer. (1 mark) As a consequence of providing a better high level model the solution is likely to be less error-prone. (1 mark) 1 mark each for any 2 of the following: • dynamic nature of linked list structure • ease of insertion and deletion of data • storage of only necessary data • better high level model • less error–prone solution. Alternative answers are possible. 1 mark for initialisation of low, high and midpoint. 1 mark for entering team name and displaying data for team name. 1 mark for suitable conditional loop (accept upper<low). 1 mark for correct updating of low and high. 1 mark for correct use of 2D array. NOTE: not found message is not required for full marks. Alternative line 20 display results[mid,1], results[mid,2], … results[mid,5] 1. set low = 0 2. set high = 49 3. set found = false 4. enter team name 5. start conditional loop 6. set mid = (low + high)/2 7. if results[mid,0]<teamName then 8. set low = mid + 1 9. end if 10. if results[mid,0]>teamName then 11. set high = mid - 1 12. end if 13. if results[mid,0]=teamName then 14. set found = true 15. end if 16. loop until (found = true) or (low > upper) 17. if found = false then 18. display ‘not found’ message 19. else 20. display data for team name 21. end if Various answers are possible. For example: Ethical Issue: Ethical issue may refer to decisions made by a driverless vehicle – for example, when deciding whether to crash the vehicle into a wall (injuring the only passenger as a result) in order to avoid hitting an on-coming car that has several passengers. (1 mark) Social Issue: Social issue may relate to the impact of driverless cars on employment, for example, no need for taxi drivers or truck drivers. (1 mark) 1 mark for an appropriate description of an ethical issue. 1 mark for an appropriate description of a social issue.
Previous question: AH Computing Science 2017 Question 4 (CfE)