0% found this document useful (0 votes)
209 views

CS301 QUIZ #1 2022 File by VU

The document discusses various concepts related to data structures like trees, linked lists, stacks, and queues. Some key points: 1. There are 4 cases of rotation in AVL trees to maintain balance during insertion or deletion. 2. During insertion in a binary search tree, if a node is inserted on the outer side of an existing node, rotations may be needed to convert it to an AVL tree. 3. Stack operations like push add elements to the top of the stack, while operations like pop remove and return the top element.

Uploaded by

Muhammad ahzam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
209 views

CS301 QUIZ #1 2022 File by VU

The document discusses various concepts related to data structures like trees, linked lists, stacks, and queues. Some key points: 1. There are 4 cases of rotation in AVL trees to maintain balance during insertion or deletion. 2. During insertion in a binary search tree, if a node is inserted on the outer side of an existing node, rotations may be needed to convert it to an AVL tree. 3. Stack operations like push add elements to the top of the stack, while operations like pop remove and return the top element.

Uploaded by

Muhammad ahzam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

In AVL tree during insertion, a single rotation can fix the balance in cases
_________ and 4.
2. 1
3. If a node is inserted in outer side of a node in binary search tree then to make it
AVL tree,
4. We may have to apply single rotation
5. A zigzag rotation is performed. In Left-Left case of rotation in AVL tree.
6. False
7. The principal benefit of a linked list over a conventional array is that the order
of the linked items may be_______ from the order that the data items are stored
in memory.
8. Same
9. Stack.push(15) will push 15 on _________.
10.Top of the stack
11.Suppose we have the following values to be inserted in constructing AVL tree,
12.10,13,15,5,7,8
13.Tell when first rotation will take place,
14.After inserting the node 15
15.All the objects created using ___________ operator have to be explicitly
destroyed using the delete operator.
16.New
17.During the execution of a process, operating system constructs four things for
that process. Which of the following is not part of that process?
18.Linked list
19.There are _________cases of Rotation in AVL tree.
20.4
21.Which of the following line of code is incorrect?
22.Float *I = float new (not confirmed)
23.In simple or singly linked list there is/are ________ pointer/s in each node.
24.One
25.Suppose there are three nodes tree with three numbers 14, 4, 15. Following is
not a permutation, or combination for output them.
26.(4, 4, 15)
27.The type of expression in which operator succeeds its operands
is___________expression.
28.Postfix
29.The _________ of a node in a binary tree is defined as the height of its left
subtree minus height of its right subtree.
30.Balance
31.If both left and right nodes of a node are NULL then this type of node is called
a ______ node.
32.Non leaf (not confirmed)
33.The function calls are made with the help of__________.
34.Stack
35.Which data structure is needed to convert infix expression to postfix
expression?
36.Stack
37.In case of insertion of right inner node in BST,
38.Left rotation then right to make AVL
39.A BST generated from the data in ascending order is ____________.
40.Linear
41.Which operation of queue data structure is used to get front element from the
queue and then remove it from the queue?
42.Remove ()
43.In _________ various cells of memory are not located continuously.
44.Linked list
45.The _______ method of list will position the currentNode and lastCurrentNode
at the start of the list.
46.Start
47.Which operation of queue data structure is used to insert an element into the
Queue?
48.Enqueuer ()
49.From Operating System point of view, the recursive function calls are made
with the help of __________.
50.Queue
51.We can make a lexicographic order of characters based on their
_____________.
52.ASCII values
53.What are the basic things associated with data structures?
54.All of the above
55.Consider the following push operations of a Stack:
56.Stack.push(4);
57.Stack.push(6);
58.Stack.push(5);
59.Stack.push(8);
60.If a user calls a pop() operation, then which value will be returned?
61.8 (stack is last in fist out)
62.~BinarySearchTree( ) is a _______________.
63.Destructor
64.Array cells are _________ in computer memory.
65.Contiguous
66.Leaf node of binary search tree contains ________
67.One Null Pointer
68.dequeue() operation of queue data structure is used to____________
69.remove an element from the front and return it
70.The depth of a binary tree is
71.Maximum level of a leaf
72.Which of the following operation returns but do not removes top value of the
stack?
73.Top
74.Which of the following data structure is linear type?
75.All of above
76.In doubly linked list a node consists of three parts:
77.2 pointers and 1 object
78.Last node in circular linked list contains
79.No null pointer
80.A_________ model attempts to model a real-world phenomenon
81.Simulation
82.Factorial is an example of __________function.
83.Recursive
84.The balance of a node in a binary tree is defined as the height of its _______
sub tree minus height of its right sub tree.
85.Left
86.In case of insertion of left outer node in BST,
87.We first apply left rotation and then rotation to make it an AVL Tree.
88.int htdiff = height(root->getLeft()) height(root->getRight()); The above line of
code is taken from AVL insert method. Complete it by selecting an appropriate
symbol.
89.Minus (-)
90.Each operator in a postfix expression refers to the previous _______ operand(s).
91.Two
92.For making Binary Search Tree for Strings we need, ________ data type.
93.Int
94.A _________model attempts to model a real-world phenomenon
95.Simulation
96.The lifetime of a transient object cannot exceed that of the application.
97.True
98.Which one of the following calling method does not change the original value
of the argument in the calling function?
99.Call by passing the value of the argument
100. In level-order traversal for Binary Search Tree, we visit the nodes at each
level before proceeding to the next level, in a _________ order.
101. Left-to-right
102. In doubly linked list a node consists of three parts:
103. 1 pointer and 2 objects
104. Binary Search Tree voilates the condition of AVL tree when any node has
balance equal to
105. 1 or -1
106. To search an element in ALV tree, it takes maximum 1.88 Log 2n time
107. True
108. HOW many cases of rotation are there in AVL tree?
109. 4
110. __________ tree has been named after two persons Adelson-Velskii and
Landis.
111. AVL
112. Which of the following is a nonlinear data structure?
113. Tree
114. AVL tree is nonlinear data structure.
115. True
116. _________ is when function is calling to itself.
117. Recursion
118. Which of the following function don't belongs to the stack class?
119. Crash ()
120. Which one is the cored function call for the following function of calculating
cube?
121. int cube(int& num)
122. cube (num)
123. Binary search algorithm cannot be applied to ____
124. None of the given
125. copy() method of list data structure __________
126. Set one list to be a copy of another
127. While implementing non-recursive traversal for Binary Search Tree, we
need to implement
128. Stack
129. Following is true in case of using Recursive method calls
130. The code becomes very short
131. ________is a self-balancing tree.
132. Binary Search Tree
133. While implementing stack with an array and to achieve LIFO behavior, we
used push and pop elements at
134. The start of the array
135. Generalized code written for a class is called
136. Structure
137. Army cells are ___________ in computer memory
138. Contiguous
139. In singly linked list a node comprises of __________ field/s.
140. Two
141. Which of the following statement is false?
142. Pointers store the next data element of a list
143. Leaf node of binary search tree contains ________
144. One null Pointer
145. What will be the result of evaluating following expression? 5+3*2/(6-3)
146. 7
147. Want and de-allocatmg memory for linked lest nodes does take hrne than
pre-allocated array
148. MORE
149. Suppose you are writing a class for Node class and forgot to write the
constructor of the class, then
150. Compiler will automatically generate a default constructor
151. Factorial is an example of __________function.
152. Recursive
153. A binary tree is said to be a _____ binary tree if every non-leaf node in a
binary tree has non-empty left and right subtrees.
154. Strictly
155. Memory address is stored in
156. Pointer
157. In level-order traversal for Binary Search Tree, __________ data structure is
used.
158. Queue
159. Which of the following is the correct option for priority Queue?
160. The type of queues that is FIFO i.e. the person who comes first should leave
first.
161. AVL tree is linear data structure.
162. False
163. AVL tree is a binary search tree
164. True
165. The post order traversal of a binary tree is DEBFCA. Find out the pre order
traversal

1. A
2. Ʌ
i. B C
ii. Ʌ ̸
3. D E F
166. ABDCEF
167. In a tree, we link the nodes in such a way that it ___________ a linear
structure.
168. Does not remain
169. add(12) method of linked list class will:
170. Add 12 as value in linked list
171. Which of the following is the correct conversion of infix to postfix
expression?
172. Z+B-(D-H)/K
173. ZB+DH-K/-
174. In singly linked list “next” field of node contains:
175. Address of next node
176. Which of the following line of code is incorrect?
177. The lifetime of a transient object can exceed that of the application which is
accessing it.
178. A list is the collection of items of the _________
179. same type
180. back() method of List class is used to:
181. Moves the “current” pointer to backward one element.
182. Suppose you are writing a class for Node class and forgot to write the
constructor of the class, then
183. _________ is the maximum height of the AVL tree.
184. 1.44log2n
185. length() method of List class is used to:
186. Return the length of the list
187. There are four cases of rotation in an __________ tree.
188. AVL
189. Allocating and de-allocating memory for linked list nodes does take
_________ time than pre-allocated array.
190. More
191. ________ is utilized at the time of memory allocation in dynamic manner.
192. Heap
193. In which case of insertion we require double rotation to make the AVL tree
balance.
194. None
195. The back() method decreases the value of variable current by __________.
196. One
197. In array list the worst case of removing an element is
198. To remove the item from start
199. Left, right, info, and parent are the operations of _________ data structure.
200. Tree
201. Which of the following is TRUE for search operations in a binary tree as
compared to linked list or an array?
202. It increase the number of comparison
203. Which of the following is a correct statement?
204. An AVL tree is identical to BST except the height of left and right subtree
can differ by at least 1
205. length() method of List class is used to:
206. Return the length of the list
207. Whenever we call a function, the compiler makes a stack, the top element of
the stack is _______ of the function.
208. Return Address
209. Whenever we call a function, the compiler makes a _________ that it uses to
fulfill this function call.
210. Stack
211. _______ is the major factor to see the efficiency of a program.
212. Time
213. __________ rule applies for evaluating operators of same precedence in an
expression
214. None
215. The postfix form of the expression A + B * C and (A + B) * C will be
_______.
216. Same
217. If we use array to implement list, then there is an issue that it gives difficulty
when:
218. We will access value randomly
219. During in-order traversal using recursive calls, if we found a node is NULL.
It means this node will satisfy following condition.
220. It will not have left child
221. Which one the following is more closer to AVL tree, (chose the best option)
222. Binary Search Tree
223. start() method of List class is used to:
224. Move the current pointer to first element
225. Consider the following infix expression.
226. 7/8 + 9
227. If one converts the above expression into postfix, what would be the
resultant expression?
228. 78/9+
229. In internal memory organization of a process, there is some area of memory
for static data that holds ____________ variables.
230. Both Static and Global
231. In Left-Right case of rotation in ________ tree. A double rotation is
performed.
232. AVL
233. If numbers 5, 222, 4, 48 are inserted in a queue, which one will be removed
first?
234. 5
235. Which one is not the property of binary tree?
236. Sibling node should be same parent (Not Sure)
237. Each node in singly linked list contains_______
238. One Pointers
239. What's wrong with following loop? while( (i < 10) && (i > 24)) { }
240. The Condition is always false

You might also like