Data Structures
12 Grade 10 Computer Studies questions on Data Structures, with worked marking schemes. 12 questions are available on this topic in full.
Question 1
3 marksState three advantages of storing the names of 40 learners in an array instead of using 40 separate variables.
(3 marks)
Marking scheme
1 mark each, maximum 3. Any three of: - One name refers to the whole set of values, so far fewer variable names must be invented and remembered. - All the names can be processed with a single loop, which makes the program much shorter. - Any name can be reached directly by its subscript, which makes searching and sorting straightforward. - The whole set can be passed to another part of the program as one item. - The values are held together in one block of memory in a known order.
Question 2
1 markAn array named MilkYield uses zero-based indexing and holds the litres collected on each of 30 days. Which subscript refers to the yield of the twelfth day?
A. MilkYield[12]
B. MilkYield[13]
C. MilkYield[11]
D. MilkYield[10]
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 3
2 marksDistinguish between a stack and a queue as used in programming.
(2 marks)
Marking scheme for this question
Create a free account to see itQuestion 4
4 marksExplain the terms stack overflow and stack underflow, and state one situation in which each occurs.
(4 marks)
Marking scheme for this question
Create a free account to see itQuestion 5
6 marksA program holds the admission numbers of 200 learners in a one-dimensional array. Describe the steps the program would follow to find out whether an admission number typed by a clerk is held in the array, and to report the result.
(6 marks)
Marking scheme
1 mark each, maximum 6: - Read (input) the admission number being looked for into a variable. - Set a marker variable, for example Found, to false before the search begins. - Use a loop whose counter runs from the subscript of the first element to that of the last (1 to 200, or 0 to 199). - On each pass, compare the element at the current subscript with the number being looked for. - If the two are equal, set Found to true, keep the current subscript as the position, and leave the loop. - After the loop, display the position if Found is true; otherwise display a message that the admission number is not in the array. (Accept a search that continues to the end of the array without leaving the loop early.)
Question 6
1 markCrates of soda are piled one on top of another in a school canteen store, and only the crate at the top can be taken. Which statement best describes the structure formed by the crates?
A. A stack, in which the crate placed last is the first to be removed
B. A linked list, in which each crate stores the position of the next crate
C. A queue, in which the crate placed first is the first to be removed
D. A two-dimensional array, in which each crate is reached by a row and a column
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 7
1 markA two-dimensional array stores the rainfall recorded at 5 weather stations for each of the 12 months of one year. How many elements does the array hold?
A. 5
B. 17
C. 12
D. 60
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 8
1 markA school keeps, for every learner, an admission number, a name, a date of birth and a fee balance. Which data structure is designed to hold these related items of different data types as one unit?
A. A stack
B. A one-dimensional array
C. A record
D. A queue
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 9
1 markA program keeps the names of visitors reporting at a county office during the day, and the number of visitors is not known before the office opens. Why is a linked list more suitable than an array for this list?
A. It allows any name to be reached directly by quoting its subscript
B. It can grow or shrink while the program is running
C. It is the only structure that can hold names, which are text
D. It arranges the names in alphabetical order without being told to
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 10
5 marksExplain how a two-dimensional array would be used to hold the marks of 30 learners in 6 subjects, and how the program would work out the total mark of one learner.
(5 marks)
Marking scheme
1 mark each, maximum 5: - Declare a two-dimensional array with 30 rows and 6 columns, of a numeric data type. - The row subscript identifies the learner and the column subscript identifies the subject. - Each element holds exactly one mark, that of a named learner in a named subject. - Set a total variable to zero, then loop through the six columns of that learner's row, adding each element to the total. - Display the total after the loop has finished, once all six subject marks have been added.
Question 11
1 markLearners' print jobs wait in a queue in a school computer laboratory. What is the name of the operation that removes the job at the front of the queue?
A. Dequeue
B. Push
C. Enqueue
D. Pop
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 12
4 marksA program stores the litres of milk that a dairy farmer in Kiambu delivers on each of the seven days of a week in a one-dimensional array. Describe how the array would be set up and used.
(4 marks)
Marking scheme for this question
Create a free account to see it9 more marking schemes are on this page. A free account opens all of them, and lets you build your own paper on the topics you have actually taught, laid out in KNEC format with its full marking scheme.
Create a free account