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 ... 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 requirement is a text file. This structure is capable of storing large amounts of data persistently, allowing for retrieval and manipulation at a later time.
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
For storing an alphabetically sorted list of names, a one-dimensional array is the most suitable data structure. It allows for easy sorting and access to each name in the list.
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
The ideal data structure for storing scores in rows and columns is a two-dimensional array. This structure efficiently organizes data in a tabular form, making it easier to represent scores by participant and event.
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
To track the name of the player who achieved the highest score, a variable can be used. This allows for dynamic updating as scores are evaluated and easily keeps track of the top scorer.
Step 5
5.2.1 Object-orientated 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 principle of restricting access to the internal state of an object and requiring all interaction to be performed through an object's methods, thus protecting the integrity of the object's data.
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
Developers can work on separate modules of the software independently, which saves time and helps in managing project complexity.
Code can be reused more easily, as object-oriented principles allow for classes and instances to be leveraged across different parts of the application.
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
(a) More than one object of a class can be instantiated. TRUE
(b) The number of parameters received by a constructor must always be the same as the number of private attributes. 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
Step 9
5.4.1 Use the following headings and complete the trace table with the number 4 as the randomly generated number.
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?
4 0 1 True
4 0 2 True
4 0 3 False
Step 10
5.4.2 Indicate the line number and the edited contents to produce the same output as the question.
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
Line 3 of the pseudocode should be edited to read: