DP1 paper
DP1 paper
Unit – ADS
Summative Assessment
Sub: CS Date: 27/09/22
Grade: DP2 Marks: 20
Q1. Identify the data type of SAME, and predict the output logic and create the trace table. [4M]
if SAME then
End if
end for
Q2. Outline 2 uses of stacks in computer system and explain what are the stack operations? [4M]
Q3. 18. Arrays or linked lists can be used to implement stacks and queues. [5M]
(a) State when you would use an array to implement a stack or a queue. [1 mark]
(b) Describe the advantage of using an array to implement a stack or a queue. [1 mark]
(c) Describe the advantage of a linked list to implement a stack or a queue. [1 mark]
(4) Using diagrams, show how you would add and delete items from a stack
A[ ] = {34,56,67,78,1,2,3,99};
(b) Outline how the data value 78 can be directly accessed. [1 mark]
(c) Explain why all elements of an array must be of the same data type. [2 marks]