An online game stores a player's unique ID, their total score and the number of minutes they have played the game - Scottish Highers Computing Science - Question 6 - 2022
Question 6
An online game stores a player's unique ID, their total score and the number of minutes they have played the game. The game also stores three attributes for the play... show full transcript
Worked Solution & Example Answer:An online game stores a player's unique ID, their total score and the number of minutes they have played the game - Scottish Highers Computing Science - Question 6 - 2022
Step 1
Explain why a program produced from this design would not be fit for purpose.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The design for the program doesn't adequately account for scenarios where multiple players achieve the same highest score. It assumes that finding the player with the shortest playing time is automatically possible. Additionally, the program design lacks the ability to handle updates to player attributes dynamically, which may result in inaccurate data being displayed. Therefore, it fails to meet the functional requirements of maintaining game integrity.
Step 2
Using a programming language of your choice, define a suitable record data structure to store the data.
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
RECORD player IS
STRING uniqueID;
INTEGER score;
REAL minutes;
INTEGER speed;
INTEGER strength;
INTEGER agility;
END RECORD;
Step 3
array of (10,000) records using data structure from (i)
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
DECLARE allPlayers AS ARRAY OF player INITIALIZED [NULL] * 10000;
Step 4
Using a programming language of your choice, write the code to implement this.
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
FOR index FROM 0 TO 9999 DO
IF allPlayers[index].minutes > 500 THEN
allPlayers[index].speed = allPlayers[index].speed + 3;
END IF
END FOR
Step 5
Describe two other benefits of creating modular code.
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Code Reusability: Modular code allows developers to reuse existing sub-programs in different parts of the application or even in other projects, which reduces redundancy and saves time.
Easier Debugging and Testing: When code is divided into smaller, self-contained modules, it becomes simpler to isolate and fix bugs. Each module can be tested independently, resulting in more reliable code.
Step 6
Describe one benefit of having a comprehensive test plan.
97%
121 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
A comprehensive test plan ensures that all components of the program are systematically tested for functionality, performance, and reliability. This thorough testing helps identify potential issues before the software is released, leading to higher quality and reduced maintenance costs after deployment.
Join the Scottish Highers students using SimpleStudy...