0 ratings0% found this document useful (0 votes) 21 views4 pagesIct 212 - Algorithms and Data Structures
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
= SSS Se ee oo a oe oe oe oe |
we
BSc COMPUTER ENGINEERING AND TELECOM ENGINERING (LEVEL 200)
END OF SEMESTER EXAMINATIONS, MAY 2016
ICT212: ALGORITHMS AND DATA STRUCTURES
INSTRUCTIONS
Answer all questions in the answer booklet provi
TIME ALLOWED: 2 Hours, 30 Minutes
QUESTIONS
SECTION A:Each question attracts equal marks. [40 MARKS]
} Which of these statements defines Data Structures?
& Addresses of variables in memory , Subset of all variables
©. The memory representation of data 4d, The type of the variables
2. The Separation of data structures and their operations from theimplementation of the data
Structures in memory and functions is called_
a. Data Abstraction
¢. Data Extraction d, Data insertion
3. An example of a dynamic data structure is a:
Array 2. Record 3.List 4.Index
2 1or3 b.2ard4
€ Only 2 4. Only 4
4 Which Data Structure is used to manage Printer Buffer?
2 Stack b. Queue
= Linked List 4. Tree
Wick One of the following is a hierarchical data structure?
Linked list 2. Stack 3. Tree 4. None
alors b.20r4
Only 2 4. Only 4
© Gemplenity in terms of machine cycles of a data structure is measured in terms of
= Time Complexity , Spase Complexity
© Micsx Complexity 4, A and B
7 WEE OF the following occupies more memory with same number of elements?
2 Amy b. Single Linked list
© Deably Linked List d. Queue
Se Example of linear Data structures ?
2)Stack 3) Linked List
b.2and 3
4. Alla, Structure 8 te
c. ADT d. Class
10. The data structures you will use if you want to go to first record from the last andvice
versa
a. Tree ae b. Linked list
«. Stack d. Doubly linked circular list
11, Suppose you opened a notepad, a music player, an excel sheet,and also you are doing your data
structure programming simultaneously. Your OS implements which data structure for it.
a. Stack b. Queue
©. Tree d. Linked list
12. Which of the following abstract data typescan’t be used to represent a many to many
relationship?
free 2)Stack 3)Graph
a.2and3 b. Land3
©. Land2 d. None
13. Which of the following are examples of Linear Data Structures?
1. Polynomial 2. Graph 3. Trees
a. and 2 b.2and3
ce. Land 3 4. None
14, List out the areas in which data structures are applied extensively?
1)Numerical Analysis 2)Graphies 3)Artificial Intelligence
a. Land 2 b. Land3
©. 2and3 1,2 and 3
15, Polynomials in memory may not be maintained through
I)Linked list with header node 2)One dimensional array 3)Stack
a 2and3 b. Land3
©. 1 and2 4. None
16. What is the most suitable data structure to represent a dietionary of words?
a. Binary Search Tree b. Heap
«c, Sorted doubly linked list d. AVL tree
17. Which sorting method(s) runs fastest for file which is already sorted?
a, selection sort b. insertion sort
c. bubble sort 4. quick sort
18. A table can be organized as a
(i Linked list Gi) Tree (lit) Arrays of records (iv) Graph (v) File
a. (i) and (ii) only b. (, (ii) and (iv) only
«©. (i, (i, (iii) and (¥) only All 0° above.
19. Consider the following polynomial: £(n) 100n +Logion +1000. What would be the Big ~
© value of the above polynomial?
an b.Logn
c.nHogn aon?
20. A Stack is a Data Structure,
a. FILO b. FIFO
©. LILO 4. None of the above
21. In a Stack the elements are entered from the
a. End b. Top
cc. Random 4. Bottom
22. The basic Operations on the Stack are
a. Push & Pop b, Tnsea & Delete
¢. Enter & Remove d, Add & SubtractSEWER GF ES Conditions must be checked before Poping?
2 Stack Overflow », Stack Underflow
= Nocondition to be checked 4. Bota the conditions
25. Recursive function call uses Data Structure,
2 Stacks
& Linked Lists
25. The operation for adding an entry to a stack is traditionally called:
aadd b. append
insert . push
27. The operation for removing an entry from a stack is traditionally called:
i delete b. peek
© pop 4. remove
28. Which of the following stack operations could result in stack underflow?
is empty ». Cortinuously poping
Continuously pushing 4. This can never happen
29. Which of the following applications may use a stack?
2A parentheses balancing program. . Keeping track of local variables at run time.
. Syntax analyzer for a compiler. 4. Allof the above.
30. Consider the following pseudo code:
declare a stack of characters
while (there are more characters in the word to read )
t
read a character
‘push the character on the stack
}
while ( the stack is not empty )
f
write the stack's top character to the screen
pop a character off the stack
i
What is written to the screen for the input "carpets"?
a. sere , carpets
c. stepraed. ccaarrppeettss
31. The time complexity of adding an element to a stack ofn elements is?
a.0(1) 6. 0(0)
<. O(n*n) 4. None
32. The time complexity of deleting an element from a stack of n elements is?
2. Ofn+1) b. O(n)
< O(1) 4. None
33. A stack is said to be Full when it is :
2 Unsorted b, Underflow
& Over flow d. Sorted
34. Consider the following stack of characters, where STACK is allocated N=8 memorycells:
STACK : A.C, D, F, K, For notational convenience, we use "--" to denote an empty cell)
‘Whet is the final STACK after performing the following operations?
POPISTACK,ITEM)
POPISTACK ITEM)
PUSHISTACK,L)
PUSHISTACKP)~vw worupicaity UL une algorithm.
QUESTION 3.[10 marks}
Ges that all animals can perform the following actions: eat, sleep and make different noise.
2) Model the base abstract class avtimal.
©) Model the behavior ofdog and cowas a subclass of animal as well as an abstract method for the
action noise.
QUESTION 4.[15 Marks}
Given that you have a list of numbers.
2) Pevelop an algorithm to check whether there are any duplicated clements in the list oF not
©) Develop an algorithm to find two elements inthe list such that their sum is equal to a given
element K?
©) Determine the time complexity of each of your algorithms?
QUESTION 5.[15 Marks]
8, What is @ graph?
b. Define path of a graph
Use the graph in figure 1 below to answer questions ¢) tog).
Figure 1
What kind of graph is shown in figure 1?
Seaify and state the number of nodes, edges and paths in figure |
Describe briefly, each path you identified,
© Wee down the path or paths you identified in figure 1.
© WSs operations can be performed on the graph in figure 1?