CMP2006 Mock Lab Test 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Lab

Test #1 (0%)

Name: ID:
Module: Data Structures (CMP2006) Date: Today
Occurrence: BSc Duration: 1 hr. 30 mins.

Figure 1 - Classes for Implementation


1. Login using the assigned username “test____” and password “123456”.

2. Create a folder on the G:\ drive using your name JohnPublic and append your student Id number to the
name of the folder. e.g. G:\JohnPublic_1234567.

3. Using the Microsoft Visual C++ IDE or Eclipse Java IDE provided, create a new project called LabTest1,
in the folder you created in Task 2.

4. Implement the classes shown in Figure 1.

5. For each file you create, place your name, id number, and date at the top of each source file as
comments. [4 marks]

6. The following LinearList class methods must be implemented as described:

i. insert adds a new node at the front of the linear list. [7 marks]

ii. retrieve returns the data stored in the node at the front of the linear list. [7 marks]

iii. remove deletes the node at the front of the linear list. [7 marks]

iv. display displays the data information for all nodes in the linear list. [7 marks]

v. destroy deletes all nodes from the linear list. [7 marks]


1

7. Add a driver file / class with a main method to the project, in main write code to do the following:

i. create a new Linear list object with an appropriate name. [2 marks]

ii. display contents of the linear list. [1 mark]

iii. insert at least five (5) items into the linear list. [6 marks]

iv. display contents of the linear list. [1 mark]

v. retrieve and display one (1) item from the linear list. [3 marks]

vi. display contents of the linear list. [1 mark]

vii. remove and display one (1) item from the linear list. [3 marks]

viii. display contents of the linear list. [1 mark]

ix. destroy deletes all nodes from the linear list. [2 marks]

x. display contents of the linear list. [1 mark]


NB: To pass this test your program must compile and run correctly.

Total Marks - 60

You might also like