6-Algorithms and Data Structures.Candidate practical assessment
6-Algorithms and Data Structures.Candidate practical assessment
061306T4CSC
COMPUTER SCIENCE LEVEL 6
ICT/OS/CS/CR/08/6/A
UNDERSTAND ALGORITHMS AND DATA STRUCTURES
NOV/DEC 2023
PRACTICAL ASSESSMENT
Time: 2 Hours
INSTRUCTIONS TO CANDIDATES:
i. In this practical assessment, you are required to write a C++ program that implements THREE
data structures (Array, Stack and Linked List) and their operations.
ii. You have Ten minutes to read through the instructions and check availability of resources for
the practical.
iii. The task has specific instructions.
iv. The task carries 50 marks.
v. The assessor will record your performance at critical points using audio-visual means.
Page 1 of 2
©2023 TVET CDACC
Task
An array contains the following items {5, 8, 2, 1, 9, 3} using a C++ program, write a program that
contains the following features:
a) Implement a stack using an array. Include the following operations: (15 Marks)
i. Push - add an element to the top of the stack
ii. Pop - remove the top element from the stack
iii. Peek - return the top element without removing it
iv. Display - print all the elements in the stack
b) Sort the array elements using the bubble sort algorithm. (7 Marks)
c) Perform the binary search on the sorted array elements and return the index of the target
element. (8 Marks)
d) Implement a linked list and perform the following operations: (20 Marks)
i. Insertion - add a node at the beginning, end, or a specific position in the list
ii. Deletion - remove a node from the list
iii. Search - search for a specific element in the list and return its position
iv. Display - print all the elements in the list
Page 2 of 2