5.1 The following data structures can be used in the application programs:
- One-dimensional array
- Two-dimensional array
- Variable
- Text file
Which ONE of the data structures above will be the most suitable to use in EACH of the following cases?
NOTE: Each data structure from the list above can be used once only as an answer - NSC Information Technology - Question 5 - 2017 - Paper 2
Question 5
5.1 The following data structures can be used in the application programs:
- One-dimensional array
- Two-dimensional array
- Variable
- Text file
Which ONE of the d... show full transcript
Worked Solution & Example Answer:5.1 The following data structures can be used in the application programs:
- One-dimensional array
- Two-dimensional array
- Variable
- Text file
Which ONE of the data structures above will be the most suitable to use in EACH of the following cases?
NOTE: Each data structure from the list above can be used once only as an answer - NSC Information Technology - Question 5 - 2017 - Paper 2
Step 1
5.1.1 A large amount of data about the participants needs to be saved to be used at a later stage.
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 most suitable data structure for this scenario is a text file since it allows for the storage of a large amount of data that can be easily saved and retrieved later.
Step 2
5.1.2 An alphabetically-sorted list of names of the organisers is required.
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
The best choice here is a one-dimensional array, as it can store a list of names that can easily be sorted alphabetically.
Step 3
5.1.3 The scores of participants need to be stored in rows and columns.
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
For this case, a two-dimensional array is most appropriate since it can accommodate the scores of participants in a structured format of rows and columns.
Step 4
5.1.4 Find the name of the player who achieved the highest score.
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
A variable would be suitable to hold the name of the player with the highest score, allowing for easy updates as the scores are compared.
Step 5
5.2.1 Object-oriented programming uses encapsulation. Give the definition of encapsulation.
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
Encapsulation is the concept of restricting access to certain components of an object and bundling the data with the methods that operate on it. This is done by declaring the attributes as private.
Step 6
5.2.2 State TWO advantages of using object-oriented programming when multiple developers are involved in coding an application.
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
Separation of concerns: Developers can work on separate modules independently, allowing for faster and more efficient collaboration.
Code reusability: Code can be written once and re-used, which saves time and effort.
Step 7
5.2.3 Indicate whether the following statements about object-oriented programming are TRUE or FALSE.
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
5.2.3(a) TRUE
5.2.3(b) FALSE
Step 8
5.3 Write a solution to the problem in the form of pseudocode.
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
Counter ← 1
NumberOfRows ← input from keyboard
Loop K from 1 to NumberOfRows
RowLine ← ""
Loop L from 1 to 2 * K - 1
RowLine ← RowLine + Counter + " "
Increment (Counter)
Display RowLine
This pseudocode initializes a counter and gathers the user input for the number of rows. It then constructs each row by incrementing the counter according to the specified formula.
Step 9
5.4.1 Show EACH step of your trace.
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
number
sum
Loop index
number modulus index = 0?
number = sum?
Display
4
0
1
False
False
4
4
2
True
True
4
Step 10
5.4.2 Indicate the line number and the edited contents to produce the same output as the given solution.
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!