SlideShare a Scribd company logo
1 of 17
Download to read offline
EXAMINATION AND EVALUATION DIVISION 
DEPARTMENT OF POLYTECHNIC EDUCATION 
(MINISTRY OF HIGHER EDUCATION) 
INFORMATION & COMMUNICATION TECHNOLOGY (ICT) 
DEPARTMENT 
FINAL EXAMINATION 
JUNE 2012 SESSION 
FP305: DATA STRUCTURE 
DATE: 22 NOVEMBER 2012 (THURSDAY) 
DURATION: 2 HOURS (8.30AM – 10.30PM) 
This paper consists of SEVENTEEN (17) pages including the front page. 
Section A: Objective (40 questions – answer ALL) 
Section B: Structure (2 questions – answer ALL). 
CONFIDENTIAL 
DO NOT OPEN THIS QUESTION PAPER UNTIL INSTRUCTED BY THE CHIEF INVIGILATOR 
(The CLO stated is for reference only)
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 2 of 17 
SECTION A 
OBJECTIVE QUESTIONS (50 marks) 
INSTRUCTION: 
This section consists of FORTY (40) objective questions. Answer ALL questions in the answer booklet. 
1. Which of the following is a linear data structure? 
[CLO1] 
A. Tree 
B. Graph 
C. Queue 
D. Binary Tree 
2. 
Algorithm is _____________ 
[CLO1] 
A. 
a smallest named unit of data that has meaning in the real world 
B. 
a clearly specified finite set of instructions a computer follows to solve a problem 
C. 
a computerized collection of interrelated stored data that serves the needs of multiple users within one or more organizations 
D. 
used to make decision based on condition 
3. 
Which of the following statements that the best describe User-define Data Type? 
i. A type which is defined by a programmer 
ii. A type which is defined in the language itself 
iii. Can contain more than one data type 
iv. Can contain only one data type 
[CLO1] 
A. 
i, ii 
B. 
i, iii 
C. 
i, iii, iv 
D. 
i, ii, iii, iv
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 3 of 17 
4. 
Linked list is an ordered collection of data in which each element contains the _____________ of the next elements. 
[CLO1] 
A. data 
B. node 
C. address 
D. list 
5. 
What is the meaning of a variable START=NULL in linked list? 
[CLO1] 
A. 
full 
B. 
empty 
C. 
underflow 
D. 
overflow 
6. What are the main operations of a list? 
[CLO1] 
A. Insert an item, copy and item, delete an item 
B. Create a list, insert an item, delete an item 
C. Create a list, move an item, delete an item 
D. Create a list, insert an item, delete an item, copy and item 
7. 
Choose the BEST answer to describe the statement below. 
a data structure used for collecting a sequence of objects, which allows efficient addition, removal and retrieval of elements from any position in the sequence 
[CLO 1] 
A. Linked List 
B. List 
C. Queue 
D. Stack 
8. 
The difference between a linear array and a record is ____________ 
[CLO 2] 
A. 
in a record, there may not be a natural ordering in opposed to linear array. 
B. 
an array is suitable for homogeneous data but the data items in a record may have different data type 
C. 
a record form a hierarchical structure but a linear array does not 
D. 
all of the above
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 4 of 17 
9. What is the relational expression to move B to the last node in the list? 
[CLO 2] 
A. list = link -> link -> B 
B. B = B -> link -> link 
C. list = B -> link -> link 
D. B -> link -> link =B 
10. What is the right statement to delete node ‘23’? 
[CLO 3] 
A. pList->next = pCur->next; 
delete pCur; 
B. pPre->next = pCur->next; 
clear pCur; 
C. pList = pCur; 
delete pCur; 
D. pPre = pCur; 
clear pCur; 
pList 
11 23 23 27 
pPre pCur 
list 
18 32 23 
32 
16 43 
32 
87 
32 
25 
32 
44 
32 
A B
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 5 of 17 
11. Which statement would assign value 3 to the first node in the item part of linked list? 
[CLO 3] 
A. head=3; 
B. head.item=3; 
C. *head.item=3; 
D. head->item=3; 
12. Which of the following principle is used in stack? 
[CLO 1] 
A. Bottom UP 
B. Traversal concept 
C. FIFO (First In First Out) concept 
D. LIFO (Last In First Out) concept 
13. 
Which of the following is NOT a basic operation for stack? 
[CLO 1] 
A. 
Push 
B. 
Pop 
C. 
Stack Down 
D. 
Stack Top 
14. 
Which of the following situation is BEST suit in queue implementation? 
[CLO 2] 
A. 
Simulation on express ticket bus counter 
B. 
Five cars entering ended road 
C. 
Storing list of financing applicants 
D. 
Car waiting at a toll plaza 
struct Node 
{ int item; 
Node* link; 
}; 
typedef Node* NodePtr; 
NodePtr head; 
head = new Node;
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 6 of 17 
15. "Entries in a stack are ordered". 
What is the meaning of this statement? 
[CLO2] 
A. A collection of Stacks can be sorted 
B. Stack entries may be compared with the '<' operation 
C. The entries must be stored in a linked list 
D. There is a first entry, a second entry, and so on 
16. 
What is the operation from (a) to (b) in Figure 1? 
A. 
Figure 1: Stack 
[CLO3] 
Empty stack 
B. Stack top 
C. Push stack 
D. Pop Stack 
17. The difference between queues and stacks is _____________ 
[CLO 1] 
A. queues require dynamic memory but stacks do not. 
B. stacks require dynamic memory but queues do not. 
C. queues use two ends of the structure, stacks use only one. 
D. stacks use two ends of the structure, queues use only one.
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 7 of 17 
18. Which of the following are TRUE about queue? 
i. Queue is a data structure which follow first-in first-out (FIFO) concept. 
ii. Primary queue operations are enqueue and dequeue 
iii. Queue allows node to be added or removed from the front (head). 
iv. The similarity between queue and stack is on process for adding and removing data. 
[CLO 1] 
A. i and ii. 
B. ii and iii 
C. i, ii and iv. 
D. ii, iii and iv. 
19. 
Two variables used in the queue are __________________. 
[CLO 1] 
A. 
B. 
C. 
D. 
top and down 
rear and front 
left and right 
rear and top 
20. 
Which data structure type allows deleting data elements from front and inserting at rear? 
[CLO 1] 
A. 
Stacks 
B. 
Queues 
C. 
Dequeue 
D. 
Binary search tree 
21. Which node will be deleted in the linked list using queue? 
[CLO 2] 
A. At the head 
B. At the tail 
C. After all other entries are greater than the new entry. 
D. After all other entries are smaller than the new entry.
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 8 of 17 
22. 
Based on Figure 2, which is the correct diagram after the operations are executed? 
Figure 2: Queue 
[CLO 2] 
A. 
B. 
C. 
D. 
queue 
F 
D 
F 
D 
D 
F
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 9 of 17 
23. 
If letter ‘D’, ‘C’, ‘B’, ‘A’ are sequentially inserted into a queue, and then deleted one by one, in which sequence will the letter be deleted from the queue? 
[CLO 3] 
A. 
‘A’, ‘B’, ‘C’, ‘D’ 
B. 
‘A’, ‘B’, ‘D’, ‘C’ 
C. 
‘D’, ‘C’, ‘A’, ‘B’ 
D. 
D’, ‘C’, ‘B’, ‘A’ 
24. 
Show the content of a queue after the following operations are executed. 
[CLO 3] 
A. 
A and F 
B. 
A and X 
C. 
F and X 
D. 
A, F and X 
Questions 25 to 28 are based on Figure 3. 
Figure 7 Figure 3: Binary Search Tree 
25. The depth of binary search tree is ________ 
[CLO1] 
A. 4 
B. 3 
C. 2 
D. 1 
Initialize (Q) 
Add (A, Q) 
Add (F, Q) 
Add (X, Q) 
Remove (Q) 
9 
/  
2 15 
/  /  
1 3 10 43 
/ /  
8 40 55
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 10 of 17 
26. 
How many levels does the binary search tree have ? 
[CLO 1] 
A. 
0 
B. 
1 
C. 
2 
D. 
3 
27 Binary tree is _____________ 
[CLO2] 
A. full but not complete. 
B. complete but not full. 
C. both full and complete 
D. neither complete nor full 
28. What is the order of nodes using in-order traversal? 
[CLO2] 
A. 1 2 3 8 10 40 55 43 15 9 
B. 1 2 3 9 8 10 15 40 43 55 
C. 9 2 1 3 15 10 8 43 40 55 
D. 1 3 2 8 10 40 55 43 15 9 
29 
Which of the following applications is NOT related to binary tree? 
[CLO 1] 
A. 
Arithmetic Tree 
B. 
Binary Search Tree 
C. 
Traversal Binary Tree 
D. 
D-tree 
30. Nodes in the tree without children is known as ______________. 
[CLO1] 
A. parent 
B. leave 
C. root 
D. child
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 11 of 17 
Questions 31 and 32 are based on Figure 4 
Figure 4: Binary Search Tree 
31. 
What is the output for preorder traversal? 
[CLO 3] 
A. 
23, 18, 12, 20, 44, 35, 52 
B. 
12, 20, 18, 35, 52, 44, 23 
C. 
12, 18, 20, 23, 35, 44, 52 
D. 
23, 12, 18, 20, 35, 44, 52 
32. 
What is the output for postorder traversal? 
[CLO 3] 
A. 
23, 18, 12, 20, 44, 35, 52 
B. 
12, 20, 18, 35, 52, 44, 23 
C. 
12, 18, 20, 23, 35, 44, 52 
D. 
23, 12, 18, 20, 35, 44, 52 
33. 
Find the smallest element and exchange it with the first element. Then find the second smallest element and exchange it with the second element, and so on until the array is sorted. 
The statement above refers to __________________. 
[CLO 1] 
A. 
Quick Sort 
B 
Bubble Sort 
C. 
Insertion Sort 
D. 
Selection Sort 
34. ___________ considers the maximum amount of work an algorithm 
will require on a problem of a given size. 
[CLO1] 
A. Worst case analysis 
B. Last case analysis 
C. Average case analysis 
D. Best case analysis
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 12 of 17 
35. 
Which of the following statements is NOT the condition that must be followed by Binary Search? 
[CLO 1] 
A. 
The list must be a sorted list 
B. 
The list must be implemented using Linked List 
C. 
The list should not be implemented using Linked List 
D. 
Data in the list can be accessed directly 
36. 
Which of the following is FALSE about searching? 
i. Linear search can be done for sorted data only 
ii. Binary search can be done for sorted data only 
iii. Both linear and binary search can be done for sorted data only 
iv. Binary search can be done for unsorted data 
[CLO 1] 
A. 
i, ii, iii 
B. 
i, ii, iv 
C. 
i, iii, iv 
D. 
ii, iii, iv 
37. Rearrange the data given in ascending order by using selection sort. 
40, 5, 7, 41, 19 
i. 5, 7, 19, 41, 40 
ii. 5, 7, 19, 40, 41 
iii. 5, 40, 7, 41, 19 
iv. 5, 7, 40, 41, 19 
[CLO2] 
A. 
i, ii, iii, iv 
B. 
iii, iv, i, ii 
C. 
iii, i, iv, ii 
D. 
iv, iii, ii, i 
38. 
Based on Figure 5, what is the sorting type? 
Figure 5 : Sorting 
[CLO2] 
A. 
Quick C. Bubble 
B. 
Merge D. Selection
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 13 of 17 
39. Refer to Figure 6. Use insertion sort and count the steps to complete the sort [CLO3] 
5 10 8 100 15 2 
Figure 6 : List of Numbers 
A. 3 
B. 4 
C. 5 
D. 6 
40. 
Based on the Figure 7 , select the technique used to sort numbers in ascending order. 
11 
88 
38 
12 2 
15 2 
88 
38 
12 11 
15 2 11 
38 12 
88 
15 2 11 12 
38 
88 15 2 11 12 15 
88 38 2 11 12 15 38 88 
Figure 7 : Sorting 
Indicates the smallest number to be interchanged 
Sorted section 
[CLO 3] 
A. 
Selection Sort 
B. 
Insertion Sort. 
C. 
Bubble Sort 
D. 
Quick Sort
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 14 of 17 
SECTION B 
STRUCTURED QUESTIONS (50 marks) 
INSTRUCTION: 
This section consists of TWO (2) structured questions. Answer ALL questions. 
QUESTION 1 
(a) Write TWO (2) methods of expressing algorithm that you know. [CLO1] 
(2 marks) 
(b) 
Describe FOUR (4) differences between list and linked list. 
[CLO1] 
(8 marks) 
(c) 
Explain the concept of underflow in stack with suitable diagram. 
[CLO2] 
(3 marks) 
(d) 
Assume there are two empty stacks of char A and B with the size of A and B are 3. Sketch a diagram of each stack after the following operations are executed. 
pushStack(A,"Ahmad") 
pushStack(B,"Nathan") 
pushStack(B,"Chong") 
pushStack(A,"Muthu") 
popStack(A,x) 
popStack(B,x) 
pushStack(B,"Thong") 
popStack(B,x) 
[CLO3] (4 marks)
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 15 of 17 
(e) 
Figure 8 : Linked List 
Based on Figure 8, answer the following questions. 
i. 
Sketch a new linked list when item "N" is added between second and third nodes. 
[CLO2] (2 marks) 
ii. 
Based on your answer in ( i ), sketch a new linked list when item "G" is added at the end of the linked list. 
[CLO2] (2 marks) 
iii. 
Write a pseudocode to delete the node that contain value “T”. 
[CLO3] (4 marks) 
D 
A 
T 
A 
Head
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 16 of 17 
QUESTION 2 
(a) Based on Figure 9, complete a code segment to enqueue item in a circular array 
[CLO3] 
Figure 9 : Circular Array 
(8 marks) 
(b) 
Figure 10: Binary Search Tree 
void createQueue(qQueue *q) 
{ 
int i,data; 
if (full(q) == 1) 
cout<<”Queue is full”; 
else 
{ 
cout<< "nKeyin No "; 
cin>> data; 
//complete these code segment 
………………………………………………………. 
………………………………………………………. 
} 
} 
30 
9 
29 
17 
25 
50 
58 
46
CONFIDENTIAL FP305 DATA STRUCTURE 
Page 17 of 17 
Based on Figure 10, answer the following questions: 
i. sketch binary search tree after deleting item with value 30 (2 marks) 
ii. based on your answer in (i), sketch binary search tree after insert 
item with value 27. (2 marks) 
iii. based on your answer in b(ii), write the node sequence of the following 
traversals: 
Pre-order (2 marks) 
Post-order (2 marks) 
[CLO 2] 
(c) Write THREE (3) advantages of sorted list. 
[CLO 1] 
(3 marks) 
(d) Apply a selection sort for the following array: 
90 60 45 30 10 85 
i. Show the result after each swap takes place in ascending order. [CLO 3] (5 marks) 
ii. How many comparisons have been performed? 
[CLO 1] 
(1 mark)

More Related Content

What's hot

Soalan ujian bulanan sains Tahun 5
Soalan ujian bulanan sains Tahun 5Soalan ujian bulanan sains Tahun 5
Soalan ujian bulanan sains Tahun 5
mhdaminomar
 
ULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONAL
ULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONALULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONAL
ULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONAL
Fatimah Abdul Khalid
 
Year 5 mathematics exercises
Year 5 mathematics exercisesYear 5 mathematics exercises
Year 5 mathematics exercises
leepooiyan
 
Soalan pjk-tahun-1
Soalan pjk-tahun-1Soalan pjk-tahun-1
Soalan pjk-tahun-1
Wandi Husein
 
Penggunaan Kalkulator Dlm P & P
Penggunaan Kalkulator Dlm P & PPenggunaan Kalkulator Dlm P & P
Penggunaan Kalkulator Dlm P & P
morabisma
 
FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2
FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2
FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2
marshiza
 
Soalan Pertengahan Tahun Matematik Tingkatan 4
Soalan Pertengahan Tahun Matematik Tingkatan 4Soalan Pertengahan Tahun Matematik Tingkatan 4
Soalan Pertengahan Tahun Matematik Tingkatan 4
Mujaheedah Solehah
 
Peperiksaan Akhir Sains Tahun 3 Kertas 1
Peperiksaan Akhir Sains Tahun 3 Kertas 1Peperiksaan Akhir Sains Tahun 3 Kertas 1
Peperiksaan Akhir Sains Tahun 3 Kertas 1
Mohd Yahya
 
Soalan pertengahan tahun 3
Soalan pertengahan tahun 3Soalan pertengahan tahun 3
Soalan pertengahan tahun 3
syanasuhaimi
 
81210105 abm-peralihan-kertas-2-akhir-tahun
81210105 abm-peralihan-kertas-2-akhir-tahun81210105 abm-peralihan-kertas-2-akhir-tahun
81210105 abm-peralihan-kertas-2-akhir-tahun
Umi Salwa Kamal Arifin
 

What's hot (20)

100 soalan Matematik Ting1
100 soalan Matematik Ting1100 soalan Matematik Ting1
100 soalan Matematik Ting1
 
Soalan rbt tahun 4
Soalan rbt tahun 4Soalan rbt tahun 4
Soalan rbt tahun 4
 
Soalan ujian bulanan sains Tahun 5
Soalan ujian bulanan sains Tahun 5Soalan ujian bulanan sains Tahun 5
Soalan ujian bulanan sains Tahun 5
 
Keselamatan Komputer
Keselamatan KomputerKeselamatan Komputer
Keselamatan Komputer
 
ULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONAL
ULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONALULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONAL
ULANGKAJI MATEMATIK SEM 3 KOLJ VOKASIONAL
 
Year 5 mathematics exercises
Year 5 mathematics exercisesYear 5 mathematics exercises
Year 5 mathematics exercises
 
FINAL EXAM FOR MATHEMATICS YEAR 1
FINAL EXAM FOR MATHEMATICS YEAR 1FINAL EXAM FOR MATHEMATICS YEAR 1
FINAL EXAM FOR MATHEMATICS YEAR 1
 
Latihan Pengukuhan Sains Ting 2
Latihan Pengukuhan Sains Ting 2Latihan Pengukuhan Sains Ting 2
Latihan Pengukuhan Sains Ting 2
 
Soalan pjk-tahun-1
Soalan pjk-tahun-1Soalan pjk-tahun-1
Soalan pjk-tahun-1
 
Ujian mac sains tahun 1
Ujian mac sains tahun 1Ujian mac sains tahun 1
Ujian mac sains tahun 1
 
Penggunaan Kalkulator Dlm P & P
Penggunaan Kalkulator Dlm P & PPenggunaan Kalkulator Dlm P & P
Penggunaan Kalkulator Dlm P & P
 
FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2
FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2
FINAL EXAM FOR MATHEMATICS YEAR 1 PAPER 2
 
Soalan Pertengahan Tahun Matematik Tingkatan 4
Soalan Pertengahan Tahun Matematik Tingkatan 4Soalan Pertengahan Tahun Matematik Tingkatan 4
Soalan Pertengahan Tahun Matematik Tingkatan 4
 
Projek Microsoft Excel : Membina Lembaran Kerja
Projek Microsoft Excel : Membina Lembaran KerjaProjek Microsoft Excel : Membina Lembaran Kerja
Projek Microsoft Excel : Membina Lembaran Kerja
 
Peperiksaan Akhir Sains Tahun 3 Kertas 1
Peperiksaan Akhir Sains Tahun 3 Kertas 1Peperiksaan Akhir Sains Tahun 3 Kertas 1
Peperiksaan Akhir Sains Tahun 3 Kertas 1
 
Dunia Sains dan Teknologi Tahun 3 Ujian 1 Kertas 1 2016
Dunia Sains dan Teknologi Tahun 3 Ujian 1 Kertas 1 2016Dunia Sains dan Teknologi Tahun 3 Ujian 1 Kertas 1 2016
Dunia Sains dan Teknologi Tahun 3 Ujian 1 Kertas 1 2016
 
Peperiksaan Pertengahan Tahun Sejarah Tahun 5
Peperiksaan Pertengahan Tahun Sejarah Tahun 5Peperiksaan Pertengahan Tahun Sejarah Tahun 5
Peperiksaan Pertengahan Tahun Sejarah Tahun 5
 
Soalan pertengahan tahun 3
Soalan pertengahan tahun 3Soalan pertengahan tahun 3
Soalan pertengahan tahun 3
 
81210105 abm-peralihan-kertas-2-akhir-tahun
81210105 abm-peralihan-kertas-2-akhir-tahun81210105 abm-peralihan-kertas-2-akhir-tahun
81210105 abm-peralihan-kertas-2-akhir-tahun
 
2.1 Kriptografi- ASK Form 3
2.1 Kriptografi- ASK Form 32.1 Kriptografi- ASK Form 3
2.1 Kriptografi- ASK Form 3
 

Viewers also liked

FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMINGFINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
Amira Dolce Farhana
 
FINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEM
FINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEMFINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEM
FINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEM
Amira Dolce Farhana
 
Final exam review answer(networking)
Final exam review answer(networking)Final exam review answer(networking)
Final exam review answer(networking)
welcometofacebook
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2
Amit Kapoor
 
Tutorial 6 dis_2011
Tutorial 6 dis_2011Tutorial 6 dis_2011
Tutorial 6 dis_2011
noraidawati
 
Chapter 4 dis 2011
Chapter 4 dis 2011Chapter 4 dis 2011
Chapter 4 dis 2011
noraidawati
 
Tutorial 4 dis_2011
Tutorial 4 dis_2011Tutorial 4 dis_2011
Tutorial 4 dis_2011
noraidawati
 
Data structure-questions
Data structure-questionsData structure-questions
Data structure-questions
Shekhar Chander
 

Viewers also liked (20)

FP305 data structure PAPER FINAL SEM 3
FP305 data structure PAPER FINAL SEM 3FP305 data structure PAPER FINAL SEM 3
FP305 data structure PAPER FINAL SEM 3
 
FP305 data structure
FP305     data structure FP305     data structure
FP305 data structure
 
FP 301 OOP FINAL PAPER JUNE 2013
FP 301 OOP FINAL PAPER JUNE 2013FP 301 OOP FINAL PAPER JUNE 2013
FP 301 OOP FINAL PAPER JUNE 2013
 
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMINGFINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
 
FINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEM
FINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEMFINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEM
FINAL PAPER FP501 OPEN SOURCE OPERATING SYSTEM
 
FP 303 COMPUTER NETWORK FINAL PAPER JUNE 2012
FP 303 COMPUTER NETWORK FINAL PAPER JUNE 2012FP 303 COMPUTER NETWORK FINAL PAPER JUNE 2012
FP 303 COMPUTER NETWORK FINAL PAPER JUNE 2012
 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)
 
FP 303 COMPUTER NETWORK PAPER FINAL Q
FP 303 COMPUTER NETWORK PAPER FINAL QFP 303 COMPUTER NETWORK PAPER FINAL Q
FP 303 COMPUTER NETWORK PAPER FINAL Q
 
FP 303 COMPUTER NETWORK PAPER FINAL
FP 303 COMPUTER NETWORK PAPER FINALFP 303 COMPUTER NETWORK PAPER FINAL
FP 303 COMPUTER NETWORK PAPER FINAL
 
Final exam review answer(networking)
Final exam review answer(networking)Final exam review answer(networking)
Final exam review answer(networking)
 
Final paper FN511 Switching & Routing
Final paper FN511 Switching & RoutingFinal paper FN511 Switching & Routing
Final paper FN511 Switching & Routing
 
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
OBJECT ORIENTED ROGRAMMING With Question And Answer  FullOBJECT ORIENTED ROGRAMMING With Question And Answer  Full
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
 
OSOS SEM 4 Chapter 2 part 1
OSOS SEM 4 Chapter 2 part 1OSOS SEM 4 Chapter 2 part 1
OSOS SEM 4 Chapter 2 part 1
 
Final paper FN512 server management
Final paper FN512 server managementFinal paper FN512 server management
Final paper FN512 server management
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2
 
Tutorial 6 dis_2011
Tutorial 6 dis_2011Tutorial 6 dis_2011
Tutorial 6 dis_2011
 
Chapter 4 dis 2011
Chapter 4 dis 2011Chapter 4 dis 2011
Chapter 4 dis 2011
 
Module - 2 Discrete Mathematics and Graph Theory
Module - 2 Discrete Mathematics and Graph TheoryModule - 2 Discrete Mathematics and Graph Theory
Module - 2 Discrete Mathematics and Graph Theory
 
Tutorial 4 dis_2011
Tutorial 4 dis_2011Tutorial 4 dis_2011
Tutorial 4 dis_2011
 
Data structure-questions
Data structure-questionsData structure-questions
Data structure-questions
 

Similar to FP305 data structure june 2012

FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
Syahriha Ruslan
 
300+ top data structures and algorithms mc qs pdf 2020
300+ top data structures and algorithms mc qs pdf 2020300+ top data structures and algorithms mc qs pdf 2020
300+ top data structures and algorithms mc qs pdf 2020
tadeseguchi
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
IT Eagers
 
Mcs 10 104 compiler design dec 2014
Mcs 10 104 compiler design dec 2014Mcs 10 104 compiler design dec 2014
Mcs 10 104 compiler design dec 2014
Sreeju Sree
 
Ugcnet4 u
Ugcnet4 uUgcnet4 u
Ugcnet4 u
sadhi
 

Similar to FP305 data structure june 2012 (20)

Fp304 DATABASE SYSTEM JUNE 2012
Fp304   DATABASE SYSTEM JUNE 2012Fp304   DATABASE SYSTEM JUNE 2012
Fp304 DATABASE SYSTEM JUNE 2012
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
 
300+ top data structures and algorithms mc qs pdf 2020
300+ top data structures and algorithms mc qs pdf 2020300+ top data structures and algorithms mc qs pdf 2020
300+ top data structures and algorithms mc qs pdf 2020
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
NET_Solved ans
NET_Solved ansNET_Solved ans
NET_Solved ans
 
Data structure part 2
Data structure part  2Data structure part  2
Data structure part 2
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
Data structure
Data structureData structure
Data structure
 
Mcs 10 104 compiler design dec 2014
Mcs 10 104 compiler design dec 2014Mcs 10 104 compiler design dec 2014
Mcs 10 104 compiler design dec 2014
 
FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER
 
Johor trial-09-c
Johor trial-09-cJohor trial-09-c
Johor trial-09-c
 
Technical aptitude test 2 CSE
Technical aptitude test 2 CSETechnical aptitude test 2 CSE
Technical aptitude test 2 CSE
 
Data structure part 1
Data structure part  1Data structure part  1
Data structure part 1
 
C mcq practice test 4
C mcq practice test 4C mcq practice test 4
C mcq practice test 4
 
Computer science ms
Computer science msComputer science ms
Computer science ms
 
Ugcnet4 u
Ugcnet4 uUgcnet4 u
Ugcnet4 u
 
[Question Paper] Advanced SQL (Revised Course) [January / 2017]
[Question Paper] Advanced SQL (Revised Course) [January / 2017][Question Paper] Advanced SQL (Revised Course) [January / 2017]
[Question Paper] Advanced SQL (Revised Course) [January / 2017]
 
Doc 20180130-wa0005
Doc 20180130-wa0005Doc 20180130-wa0005
Doc 20180130-wa0005
 
Doc 20180130-wa0004-1
Doc 20180130-wa0004-1Doc 20180130-wa0004-1
Doc 20180130-wa0004-1
 
Doc 20180130-wa0004
Doc 20180130-wa0004Doc 20180130-wa0004
Doc 20180130-wa0004
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

FP305 data structure june 2012

  • 1. EXAMINATION AND EVALUATION DIVISION DEPARTMENT OF POLYTECHNIC EDUCATION (MINISTRY OF HIGHER EDUCATION) INFORMATION & COMMUNICATION TECHNOLOGY (ICT) DEPARTMENT FINAL EXAMINATION JUNE 2012 SESSION FP305: DATA STRUCTURE DATE: 22 NOVEMBER 2012 (THURSDAY) DURATION: 2 HOURS (8.30AM – 10.30PM) This paper consists of SEVENTEEN (17) pages including the front page. Section A: Objective (40 questions – answer ALL) Section B: Structure (2 questions – answer ALL). CONFIDENTIAL DO NOT OPEN THIS QUESTION PAPER UNTIL INSTRUCTED BY THE CHIEF INVIGILATOR (The CLO stated is for reference only)
  • 2. CONFIDENTIAL FP305 DATA STRUCTURE Page 2 of 17 SECTION A OBJECTIVE QUESTIONS (50 marks) INSTRUCTION: This section consists of FORTY (40) objective questions. Answer ALL questions in the answer booklet. 1. Which of the following is a linear data structure? [CLO1] A. Tree B. Graph C. Queue D. Binary Tree 2. Algorithm is _____________ [CLO1] A. a smallest named unit of data that has meaning in the real world B. a clearly specified finite set of instructions a computer follows to solve a problem C. a computerized collection of interrelated stored data that serves the needs of multiple users within one or more organizations D. used to make decision based on condition 3. Which of the following statements that the best describe User-define Data Type? i. A type which is defined by a programmer ii. A type which is defined in the language itself iii. Can contain more than one data type iv. Can contain only one data type [CLO1] A. i, ii B. i, iii C. i, iii, iv D. i, ii, iii, iv
  • 3. CONFIDENTIAL FP305 DATA STRUCTURE Page 3 of 17 4. Linked list is an ordered collection of data in which each element contains the _____________ of the next elements. [CLO1] A. data B. node C. address D. list 5. What is the meaning of a variable START=NULL in linked list? [CLO1] A. full B. empty C. underflow D. overflow 6. What are the main operations of a list? [CLO1] A. Insert an item, copy and item, delete an item B. Create a list, insert an item, delete an item C. Create a list, move an item, delete an item D. Create a list, insert an item, delete an item, copy and item 7. Choose the BEST answer to describe the statement below. a data structure used for collecting a sequence of objects, which allows efficient addition, removal and retrieval of elements from any position in the sequence [CLO 1] A. Linked List B. List C. Queue D. Stack 8. The difference between a linear array and a record is ____________ [CLO 2] A. in a record, there may not be a natural ordering in opposed to linear array. B. an array is suitable for homogeneous data but the data items in a record may have different data type C. a record form a hierarchical structure but a linear array does not D. all of the above
  • 4. CONFIDENTIAL FP305 DATA STRUCTURE Page 4 of 17 9. What is the relational expression to move B to the last node in the list? [CLO 2] A. list = link -> link -> B B. B = B -> link -> link C. list = B -> link -> link D. B -> link -> link =B 10. What is the right statement to delete node ‘23’? [CLO 3] A. pList->next = pCur->next; delete pCur; B. pPre->next = pCur->next; clear pCur; C. pList = pCur; delete pCur; D. pPre = pCur; clear pCur; pList 11 23 23 27 pPre pCur list 18 32 23 32 16 43 32 87 32 25 32 44 32 A B
  • 5. CONFIDENTIAL FP305 DATA STRUCTURE Page 5 of 17 11. Which statement would assign value 3 to the first node in the item part of linked list? [CLO 3] A. head=3; B. head.item=3; C. *head.item=3; D. head->item=3; 12. Which of the following principle is used in stack? [CLO 1] A. Bottom UP B. Traversal concept C. FIFO (First In First Out) concept D. LIFO (Last In First Out) concept 13. Which of the following is NOT a basic operation for stack? [CLO 1] A. Push B. Pop C. Stack Down D. Stack Top 14. Which of the following situation is BEST suit in queue implementation? [CLO 2] A. Simulation on express ticket bus counter B. Five cars entering ended road C. Storing list of financing applicants D. Car waiting at a toll plaza struct Node { int item; Node* link; }; typedef Node* NodePtr; NodePtr head; head = new Node;
  • 6. CONFIDENTIAL FP305 DATA STRUCTURE Page 6 of 17 15. "Entries in a stack are ordered". What is the meaning of this statement? [CLO2] A. A collection of Stacks can be sorted B. Stack entries may be compared with the '<' operation C. The entries must be stored in a linked list D. There is a first entry, a second entry, and so on 16. What is the operation from (a) to (b) in Figure 1? A. Figure 1: Stack [CLO3] Empty stack B. Stack top C. Push stack D. Pop Stack 17. The difference between queues and stacks is _____________ [CLO 1] A. queues require dynamic memory but stacks do not. B. stacks require dynamic memory but queues do not. C. queues use two ends of the structure, stacks use only one. D. stacks use two ends of the structure, queues use only one.
  • 7. CONFIDENTIAL FP305 DATA STRUCTURE Page 7 of 17 18. Which of the following are TRUE about queue? i. Queue is a data structure which follow first-in first-out (FIFO) concept. ii. Primary queue operations are enqueue and dequeue iii. Queue allows node to be added or removed from the front (head). iv. The similarity between queue and stack is on process for adding and removing data. [CLO 1] A. i and ii. B. ii and iii C. i, ii and iv. D. ii, iii and iv. 19. Two variables used in the queue are __________________. [CLO 1] A. B. C. D. top and down rear and front left and right rear and top 20. Which data structure type allows deleting data elements from front and inserting at rear? [CLO 1] A. Stacks B. Queues C. Dequeue D. Binary search tree 21. Which node will be deleted in the linked list using queue? [CLO 2] A. At the head B. At the tail C. After all other entries are greater than the new entry. D. After all other entries are smaller than the new entry.
  • 8. CONFIDENTIAL FP305 DATA STRUCTURE Page 8 of 17 22. Based on Figure 2, which is the correct diagram after the operations are executed? Figure 2: Queue [CLO 2] A. B. C. D. queue F D F D D F
  • 9. CONFIDENTIAL FP305 DATA STRUCTURE Page 9 of 17 23. If letter ‘D’, ‘C’, ‘B’, ‘A’ are sequentially inserted into a queue, and then deleted one by one, in which sequence will the letter be deleted from the queue? [CLO 3] A. ‘A’, ‘B’, ‘C’, ‘D’ B. ‘A’, ‘B’, ‘D’, ‘C’ C. ‘D’, ‘C’, ‘A’, ‘B’ D. D’, ‘C’, ‘B’, ‘A’ 24. Show the content of a queue after the following operations are executed. [CLO 3] A. A and F B. A and X C. F and X D. A, F and X Questions 25 to 28 are based on Figure 3. Figure 7 Figure 3: Binary Search Tree 25. The depth of binary search tree is ________ [CLO1] A. 4 B. 3 C. 2 D. 1 Initialize (Q) Add (A, Q) Add (F, Q) Add (X, Q) Remove (Q) 9 / 2 15 / / 1 3 10 43 / / 8 40 55
  • 10. CONFIDENTIAL FP305 DATA STRUCTURE Page 10 of 17 26. How many levels does the binary search tree have ? [CLO 1] A. 0 B. 1 C. 2 D. 3 27 Binary tree is _____________ [CLO2] A. full but not complete. B. complete but not full. C. both full and complete D. neither complete nor full 28. What is the order of nodes using in-order traversal? [CLO2] A. 1 2 3 8 10 40 55 43 15 9 B. 1 2 3 9 8 10 15 40 43 55 C. 9 2 1 3 15 10 8 43 40 55 D. 1 3 2 8 10 40 55 43 15 9 29 Which of the following applications is NOT related to binary tree? [CLO 1] A. Arithmetic Tree B. Binary Search Tree C. Traversal Binary Tree D. D-tree 30. Nodes in the tree without children is known as ______________. [CLO1] A. parent B. leave C. root D. child
  • 11. CONFIDENTIAL FP305 DATA STRUCTURE Page 11 of 17 Questions 31 and 32 are based on Figure 4 Figure 4: Binary Search Tree 31. What is the output for preorder traversal? [CLO 3] A. 23, 18, 12, 20, 44, 35, 52 B. 12, 20, 18, 35, 52, 44, 23 C. 12, 18, 20, 23, 35, 44, 52 D. 23, 12, 18, 20, 35, 44, 52 32. What is the output for postorder traversal? [CLO 3] A. 23, 18, 12, 20, 44, 35, 52 B. 12, 20, 18, 35, 52, 44, 23 C. 12, 18, 20, 23, 35, 44, 52 D. 23, 12, 18, 20, 35, 44, 52 33. Find the smallest element and exchange it with the first element. Then find the second smallest element and exchange it with the second element, and so on until the array is sorted. The statement above refers to __________________. [CLO 1] A. Quick Sort B Bubble Sort C. Insertion Sort D. Selection Sort 34. ___________ considers the maximum amount of work an algorithm will require on a problem of a given size. [CLO1] A. Worst case analysis B. Last case analysis C. Average case analysis D. Best case analysis
  • 12. CONFIDENTIAL FP305 DATA STRUCTURE Page 12 of 17 35. Which of the following statements is NOT the condition that must be followed by Binary Search? [CLO 1] A. The list must be a sorted list B. The list must be implemented using Linked List C. The list should not be implemented using Linked List D. Data in the list can be accessed directly 36. Which of the following is FALSE about searching? i. Linear search can be done for sorted data only ii. Binary search can be done for sorted data only iii. Both linear and binary search can be done for sorted data only iv. Binary search can be done for unsorted data [CLO 1] A. i, ii, iii B. i, ii, iv C. i, iii, iv D. ii, iii, iv 37. Rearrange the data given in ascending order by using selection sort. 40, 5, 7, 41, 19 i. 5, 7, 19, 41, 40 ii. 5, 7, 19, 40, 41 iii. 5, 40, 7, 41, 19 iv. 5, 7, 40, 41, 19 [CLO2] A. i, ii, iii, iv B. iii, iv, i, ii C. iii, i, iv, ii D. iv, iii, ii, i 38. Based on Figure 5, what is the sorting type? Figure 5 : Sorting [CLO2] A. Quick C. Bubble B. Merge D. Selection
  • 13. CONFIDENTIAL FP305 DATA STRUCTURE Page 13 of 17 39. Refer to Figure 6. Use insertion sort and count the steps to complete the sort [CLO3] 5 10 8 100 15 2 Figure 6 : List of Numbers A. 3 B. 4 C. 5 D. 6 40. Based on the Figure 7 , select the technique used to sort numbers in ascending order. 11 88 38 12 2 15 2 88 38 12 11 15 2 11 38 12 88 15 2 11 12 38 88 15 2 11 12 15 88 38 2 11 12 15 38 88 Figure 7 : Sorting Indicates the smallest number to be interchanged Sorted section [CLO 3] A. Selection Sort B. Insertion Sort. C. Bubble Sort D. Quick Sort
  • 14. CONFIDENTIAL FP305 DATA STRUCTURE Page 14 of 17 SECTION B STRUCTURED QUESTIONS (50 marks) INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions. QUESTION 1 (a) Write TWO (2) methods of expressing algorithm that you know. [CLO1] (2 marks) (b) Describe FOUR (4) differences between list and linked list. [CLO1] (8 marks) (c) Explain the concept of underflow in stack with suitable diagram. [CLO2] (3 marks) (d) Assume there are two empty stacks of char A and B with the size of A and B are 3. Sketch a diagram of each stack after the following operations are executed. pushStack(A,"Ahmad") pushStack(B,"Nathan") pushStack(B,"Chong") pushStack(A,"Muthu") popStack(A,x) popStack(B,x) pushStack(B,"Thong") popStack(B,x) [CLO3] (4 marks)
  • 15. CONFIDENTIAL FP305 DATA STRUCTURE Page 15 of 17 (e) Figure 8 : Linked List Based on Figure 8, answer the following questions. i. Sketch a new linked list when item "N" is added between second and third nodes. [CLO2] (2 marks) ii. Based on your answer in ( i ), sketch a new linked list when item "G" is added at the end of the linked list. [CLO2] (2 marks) iii. Write a pseudocode to delete the node that contain value “T”. [CLO3] (4 marks) D A T A Head
  • 16. CONFIDENTIAL FP305 DATA STRUCTURE Page 16 of 17 QUESTION 2 (a) Based on Figure 9, complete a code segment to enqueue item in a circular array [CLO3] Figure 9 : Circular Array (8 marks) (b) Figure 10: Binary Search Tree void createQueue(qQueue *q) { int i,data; if (full(q) == 1) cout<<”Queue is full”; else { cout<< "nKeyin No "; cin>> data; //complete these code segment ………………………………………………………. ………………………………………………………. } } 30 9 29 17 25 50 58 46
  • 17. CONFIDENTIAL FP305 DATA STRUCTURE Page 17 of 17 Based on Figure 10, answer the following questions: i. sketch binary search tree after deleting item with value 30 (2 marks) ii. based on your answer in (i), sketch binary search tree after insert item with value 27. (2 marks) iii. based on your answer in b(ii), write the node sequence of the following traversals: Pre-order (2 marks) Post-order (2 marks) [CLO 2] (c) Write THREE (3) advantages of sorted list. [CLO 1] (3 marks) (d) Apply a selection sort for the following array: 90 60 45 30 10 85 i. Show the result after each swap takes place in ascending order. [CLO 3] (5 marks) ii. How many comparisons have been performed? [CLO 1] (1 mark)