McqMate
Chapters
201. |
In the following scenarios, when will you use selection sort? |
A. | The input is already sorted |
B. | A large file has to be sorted |
C. | Large values need to be sorted with small keys |
D. | Small values need to be sorted with large keys |
Answer» C. Large values need to be sorted with small keys |
202. |
What is the worst case complexity of selection sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
203. |
What is the advantage of selection sort over other sorting techniques? |
A. | It requires no additional storage space |
B. | It is scalable |
C. | It works best for inputs which are already sorted |
D. | It is faster than any other sorting technique |
Answer» A. It requires no additional storage space |
204. |
What is the average case complexity of selection sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
205. |
What is the disadvantage of selection sort? |
A. | It requires auxiliary memory |
B. | It is not scalable |
C. | It can be used for small keys8 |
D. | It takes linear time to sort the elements |
Answer» B. It is not scalable |
206. |
The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and selection sort respectively are, |
A. | 5 and 4 |
B. | 4 and 5 |
C. | 2 and 4 |
D. | 2 and 5 |
Answer» A. 5 and 4 |
207. |
The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a flag variable)The number of iterations in selection sort and bubble sort respectively are, |
A. | 5 and 4 |
B. | 1 and 4 |
C. | 0 and 4 |
D. | 4 and 1 |
Answer» D. 4 and 1 |
208. |
What is the best case complexity of selection sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
209. |
Shell sort is also known as |
A. | diminishing decrement sort |
B. | diminishing increment sort |
C. | partition exchange sort |
D. | diminishing insertion sort |
Answer» B. diminishing increment sort |
210. |
Statement 1: Shell sort is a stable sorting algorithm. Statement 2: Shell sort is an in-place sorting algorithm. |
A. | Both statements are true |
B. | Statement 2 is true but statement 1 is false |
C. | Statement 2 is false but statement 1 is true |
D. | none |
Answer» B. Statement 2 is true but statement 1 is false |
211. |
Shell sort is applied on the elements 27 59 49 37 15 90 81 39 and the chosen decreasing sequence of increments is (5,3,1). The result after the first iteration will be |
A. | 27 59 49 37 15 90 81 39 |
B. | 27 59 37 49 15 90 81 39 |
C. | 27 59 39 37 15 90 81 49 |
D. | 15 59 49 37 27 90 81 39 |
Answer» C. 27 59 39 37 15 90 81 49 |
212. |
Shell sort is an improvement on |
A. | insertion sort |
B. | selection sort |
C. | binary tree sort |
D. | quick sort |
Answer» A. insertion sort |
213. |
An array that is first 7-sorted, then 5-sorted becomes |
A. | 7-ordered |
B. | 5-ordered |
C. | both 2-ordered and 5-ordered |
D. | both 7-ordered and 5-ordered |
Answer» D. both 7-ordered and 5-ordered |
214. |
If Hibbard increments (h1= 1, h2= 3, h3= 7, …, hk = 2k–1) are used in a Shell sortimplementation, then the best case time complexity will be |
A. | O(nlogn) |
B. | O(n) |
C. | O(n2) |
D. | O(logn) |
Answer» A. O(nlogn) |
215. |
Records R1, R2, R3,.. RN with keys K1, K2, K3,.. KN are said to be h-ordered, if |
A. | Ki <= Ki+h for 1<= i*h <= N |
B. | Kh <= Ki+h for 1<= i <= N |
C. | Ki <= Kh for 1<= i <= h |
D. | Ki <= Ki+h for 1<= i <= N-h |
Answer» D. Ki <= Ki+h for 1<= i <= N-h |
216. |
Which of the following is true? |
A. | Shell sort’s passes completely sort the elements before going on to the next-smallest gap while Comb sort’s passes do not completely sort the elements |
B. | Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap like in Comb sort |
C. | Comb sort’s passes completely sort the elements before going on to the next-smallest gap like in Shell sort |
D. | Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap while Comb sort’s passes completely sort the elements |
Answer» A. Shell sort’s passes completely sort the elements before going on to the next-smallest gap while Comb sort’s passes do not completely sort the elements |
217. |
Which of the following is the distribution sort? |
A. | Heap sort |
B. | Smooth sort |
C. | Quick sort |
D. | LSD radix sort |
Answer» D. LSD radix sort |
218. |
What is the worst case time complexity of LSD radix sort? |
A. | O(nlogn) |
B. | O(wn) |
C. | O(n) |
D. | O(n + w) |
Answer» B. O(wn) |
219. |
LSD radix sort requires passes to sort N elements. |
A. | (w/logR) |
B. | N(w/logR) |
C. | (w/log(RN)) |
D. | (wN/log(N)) |
Answer» A. (w/logR) |
220. |
Which of the following is false? |
A. | LSD radix sort is an integer sorting algorithm |
B. | LSD radix sort is a comparison sorting algorithm |
C. | LSD radix sort is a distribution sort |
D. | LSD radix sort uses bucket sort |
Answer» B. LSD radix sort is a comparison sorting algorithm |
221. |
Which of the following sorting algorithm is stable? |
A. | Heap sort |
B. | Selection sort |
C. | In-place MSD radix sort |
D. | LSD radix sort |
Answer» D. LSD radix sort |
222. |
Which of the following should be used to sort a huge database on a fixed-length key field? |
A. | Insertion sort |
B. | Merge sort |
C. | LSD radix sort |
D. | Quick sort |
Answer» C. LSD radix sort |
223. |
Which of the following is a combination of LSD and MSD radix sorts? |
A. | Forward radix sort |
B. | 3-way radix quick sort |
C. | Trie base radix sort |
D. | Flash sort |
Answer» A. Forward radix sort |
224. |
Which of the following is true for the LSD radix sort? |
A. | works best for variable length strings |
B. | accesses memory randomly |
C. | inner loop has less instructions |
D. | sorts the keys in left-to-right order |
Answer» B. accesses memory randomly |
225. |
Which scheme uses a randomization approach? |
A. | hashing by division |
B. | hashing by multiplication |
C. | universal hashing |
D. | open addressing |
Answer» C. universal hashing |
226. |
Which hash function satisfies the condition of simple uniform hashing? |
A. | h(k) = lowerbound(km) |
B. | h(k)= upperbound(mk) |
C. | h(k)= lowerbound(k) |
D. | h(k)= upperbound(k) |
Answer» A. h(k) = lowerbound(km) |
227. |
What is the hash function used in the division method? |
A. | h(k) = k/m |
B. | h(k) = k mod m |
C. | h(k) = m/k |
D. | h(k) = m mod k |
Answer» B. h(k) = k mod m |
228. |
What can be the value of m in the division method? |
A. | Any prime number |
B. | Any even number |
C. | 2p – 1 |
D. | 2p |
Answer» A. Any prime number |
229. |
Which scheme provides good performance? |
A. | open addressing |
B. | universal hashing |
C. | hashing by division |
D. | hashing by multiplication |
Answer» B. universal hashing |
230. |
Using division method, in a given hash table of size 157, the key of value 172 be placed at position |
A. | 19 |
B. | 72 |
C. | 15 |
D. | 17 |
Answer» C. 15 |
231. |
How many steps are involved in creating a hash function using a multiplication method? |
A. | 1 |
B. | 4 |
C. | 3 |
D. | 2 |
Answer» D. 2 |
232. |
What is the hash function used in multiplication method? |
A. | h(k) = floor( m(kA mod 1)) |
B. | h(k) = ceil( m(kA mod 1)) |
C. | h(k) = floor(kA mod m) |
D. | h(k) = ceil( kA mod m) |
Answer» A. h(k) = floor( m(kA mod 1)) |
233. |
What is the advantage of the multiplication method? |
A. | only 2 steps are involved |
B. | using constant |
C. | value of m not critical |
D. | simple multiplication |
Answer» C. value of m not critical |
234. |
What is the table size when the value of p is 7 in multiplication method of creating hash functions? |
A. | 14 |
B. | 128 |
C. | 49 |
D. | 127 |
Answer» B. 128 |
235. |
What is the average retrieval time when n keys hash to the same slot? |
A. | Theta(n) |
B. | Theta(n2) |
C. | Theta(nlog n) |
D. | Big-Oh(n2) |
Answer» A. Theta(n) |
236. |
Which if the following is/are the levels of implementation of data structure |
A. | abstract level |
B. | application level |
C. | implementation level |
D. | all of the above |
Answer» D. all of the above |
237. |
A binary search tree whose left subtree and right subtree differ in hight by at most 1 unit is called …… |
A. | avl tree |
B. | red-black tree |
C. | lemma tree |
D. | none of the above |
Answer» A. avl tree |
238. |
Stack is also called as |
A. | last in first out |
B. | first in last out |
C. | last in last out |
D. | first in first out |
Answer» A. last in first out |
239. |
…………… is not the component of data structure. |
A. | operations |
B. | storage structures |
C. | algorithms |
D. | none of above |
Answer» D. none of above |
240. |
Which of the following is not the part of ADT description? |
A. | data |
B. | operations |
C. | both of the above |
D. | none of the above |
Answer» D. none of the above |
241. |
……………. Is a pile in which items are added at one end and removed from the other. |
A. | stack |
B. | queue |
C. | list |
D. | none of the above |
Answer» B. queue |
242. |
………… is very useful in situation when data have to stored and then retrieved in reverse order. |
A. | stack |
B. | queue |
C. | list |
D. | link list |
Answer» A. stack |
243. |
Which data structure allows deleting data elements from and inserting at rear? |
A. | stacks |
B. | queues |
C. | dequeues |
D. | binary search tree |
Answer» B. queues |
244. |
Which of the following data structure can’t store the non-homogeneous data elements? |
A. | arrays |
B. | records |
C. | pointers |
D. | stacks |
Answer» A. arrays |
245. |
A ……. is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out. |
A. | queue linked list |
B. | stacks linked list |
C. | both of them |
D. | neither of them |
Answer» A. queue linked list |
246. |
Which of the following is non-liner data structure? |
A. | stacks |
B. | list |
C. | strings |
D. | trees |
Answer» D. trees |
247. |
Herder node is used as sentinel in ….. |
A. | graphs |
B. | stacks |
C. | binary tree |
D. | queues |
Answer» C. binary tree |
248. |
Which data structure is used in breadth first search of a graph to hold nodes? |
A. | stack |
B. | queue |
C. | tree |
D. | array |
Answer» B. queue |
249. |
Identify the data structure which allows deletions at both ends of the list but insertion at only one end. |
A. | input restricted dequeue |
B. | output restricted qequeue |
C. | priority queues |
D. | stack |
Answer» A. input restricted dequeue |
250. |
Which of the following data structure is non linear type? |
A. | strings |
B. | lists |
C. | stacks |
D. | graph |
Answer» D. graph |
251. |
Which of the following data structure is linear type? |
A. | graph |
B. | trees |
C. | binary tree |
D. | stack |
Answer» D. stack |
252. |
To represent hierarchical relationship between elements, Which data structure is suitable? |
A. | dequeue |
B. | priority |
C. | tree |
D. | graph |
Answer» C. tree |
253. |
A directed graph is ………………. if there is a path from each vertex to every other vertex in the digraph. |
A. | weakly connected |
B. | strongly connected |
C. | tightly connected |
D. | linearly connected |
Answer» B. strongly connected |
254. |
In the …………….. traversal we process all of a vertex’s descendants before we move to an adjacent vertex. |
A. | depth first |
B. | breadth first |
C. | with first |
D. | depth limited |
Answer» A. depth first |
255. |
The number of comparisons done by sequential search is ……………… |
A. | (n/2)+1 |
B. | (n+1)/2 |
C. | (n-1)/2 |
D. | (n+2)/2 |
Answer» B. (n+1)/2 |
256. |
In ……………, search start at the beginning of the list and check every element in the list. |
A. | linear search |
B. | binary search |
C. | hash search |
D. | binary tree search |
Answer» A. linear search |
257. |
Which of the following is not the internal sort? |
A. | insertion sort |
B. | bubble sort |
C. | merge sort |
D. | heap sort |
Answer» C. merge sort |
258. |
A graph is said to be ……………… if the vertices can be split into two sets V1 and V2 such there are no edges between two vertices of V1 or two vertices of V2. |
A. | partite |
B. | bipartite |
C. | rooted |
D. | bisects |
Answer» B. bipartite |
259. |
In a queue, the initial values of front pointer f rare pointer r should be …….. and ……….. respectively. |
A. | 0 and 1 |
B. | 0 and -1 |
C. | -1 and 0 |
D. | 1 and 0 |
Answer» B. 0 and -1 |
260. |
In a circular queue the value of r will be .. |
A. | r=r+1 |
B. | r=(r+1)% [queue_size – 1] |
C. | r=(r+1)% queue_size |
D. | r=(r-1)% queue_size |
Answer» C. r=(r+1)% queue_size |
261. |
The advantage of …………….. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. |
A. | lists |
B. | linked lists |
C. | trees |
D. | queues |
Answer» B. linked lists |
262. |
What will be the value of top, if there is a size of stack STACK_SIZE is 5 |
A. | 5 |
B. | 6 |
C. | 4 |
D. | none |
Answer» C. 4 |
263. |
………… is not the operation that can be performed on queue. |
A. | insertion |
B. | deletion |
C. | retrieval |
D. | traversal |
Answer» D. traversal |
264. |
There is an extra element at the head of the list called a ………. |
A. | antinel |
B. | sentinel |
C. | list header |
D. | list head |
Answer» B. sentinel |
265. |
A graph is a collection of nodes, called ………. And line segments called arcs or ……….. that connect pair of nodes. |
A. | vertices, edges |
B. | edges, vertices |
C. | vertices, paths |
D. | graph node, edges |
Answer» A. vertices, edges |
266. |
A ……….. is a graph that has weights of costs associated with its edges. |
A. | network |
B. | weighted graph |
C. | both a and b |
D. | none a and b |
Answer» C. both a and b |
267. |
In general, the binary search method needs no more than ……………. comparisons. |
A. | [log2n]-1 |
B. | [logn]+1 |
C. | [log2n] |
D. | [log2n]+1 |
Answer» D. [log2n]+1 |
268. |
Which of the following is not the type of queue? |
A. | ordinary queue |
B. | single ended queue |
C. | circular queue |
D. | priority queue |
Answer» B. single ended queue |
269. |
The property of binary tree is |
A. | the first subset is called left subtree |
B. | the second subtree is called right subtree |
C. | the root cannot contain null |
D. | the right subtree can be empty |
Answer» D. the right subtree can be empty |
270. |
Any node is the path from the root to the node is called |
A. | successor node |
B. | ancestor node |
C. | internal node |
D. | none of the above |
Answer» B. ancestor node |
271. |
Which is/are the application(s) of stack |
A. | function calls |
B. | large number arithmetic |
C. | evaluation of arithmetic expressions |
D. | all of the above |
Answer» D. all of the above |
272. |
A …………… is an acyclic digraph, which has only one node with indegree 0, and other nodes have in-degree 1. |
A. | directed tree |
B. | undirected tree |
C. | dis-joint tree |
D. | direction oriented tree |
Answer» A. directed tree |
273. |
…………………. Is a directed tree in which outdegree of each node is less than or equal to two. |
A. | unary tree |
B. | binary tree |
C. | trinary tree |
D. | both b and c |
Answer» B. binary tree |
274. |
Which of the following data structure is non-linear type? |
A. | strings |
B. | lists |
C. | stacks |
D. | tree |
Answer» D. tree |
275. |
Which of the following data structure is linear type? |
A. | array |
B. | tree |
C. | graphs |
D. | hierarchy |
Answer» A. array |
276. |
The logical or mathematical model of a particular organization of data is called a ……… |
A. | data structure |
B. | data arrangement |
C. | data configuration |
D. | data formation |
Answer» A. data structure |
277. |
The simplest type of data structure is ……………… |
A. | multidimensional array |
B. | linear array |
C. | two dimensional array |
D. | three dimensional array |
Answer» B. linear array |
278. |
Linear arrays are also called ………………. |
A. | straight line array |
B. | one-dimensional array |
C. | vertical array |
D. | horizontal array |
Answer» B. one-dimensional array |
279. |
Arrays are best data structures ………… |
A. | for relatively permanent collections of data |
B. | for the size of the structure and the data in the structure are constantly changing |
C. | for both of above situation |
D. | for none of the above |
Answer» A. for relatively permanent collections of data |
280. |
Which of the following data structures are indexed structures? |
A. | linear arrays |
B. | linked lists |
C. | graphs |
D. | trees |
Answer» A. linear arrays |
281. |
Each node in a linked list has two pairs of ………….. and ………………. |
A. | link field and information field |
B. | link field and avail field |
C. | avail field and information field |
D. | address field and link field |
Answer» A. link field and information field |
282. |
A …………………… does not keep track of address of every element in the list. |
A. | stack |
B. | string |
C. | linear array |
D. | queue |
Answer» C. linear array |
283. |
When does top value of the stack changes? |
A. | before deletion |
B. | while checking underflow |
C. | at the time of deletion |
D. | after deletion |
Answer» D. after deletion |
284. |
Arrays are best data structures ………… |
A. | for relatively permanent collections of data. |
B. | for the size of the structure and the data in the structure are constantly changing |
C. | for both of above situation |
D. | for none of the above |
Answer» A. for relatively permanent collections of data. |
285. |
Arrays are best data structures |
A. | for relatively permanent collections of data |
B. | for the size of the structure and the data in the structure are constantly changing |
C. | for both of above situation |
D. | for none of above situation |
Answer» A. for relatively permanent collections of data |
286. |
The disadvantage in using a circular linked list is ……………………. |
A. | it is possible to get into infinite loop. |
B. | last node points to first node. |
C. | time consuming |
D. | requires more memory space |
Answer» A. it is possible to get into infinite loop. |
287. |
A linear list in which each node has pointers to point to the predecessor and successors nodes is called as .. |
A. | singly linked list |
B. | circular linked list |
C. | doubly linked list |
D. | linear linked list |
Answer» C. doubly linked list |
288. |
A ……………….. is a linear list in which insertions and deletions are made to from either end of the structure. |
A. | circular queue |
B. | random of queue |
C. | priority |
D. | dequeue |
Answer» D. dequeue |
289. |
In a priority queue, insertion and deletion takes place at ……………… |
A. | front, rear end |
B. | only at rear end |
C. | only at front end |
D. | any position |
Answer» D. any position |
290. |
The time complexity of quick sort is ………….. |
A. | o(n) |
B. | o(n2) |
C. | o(n log n) |
D. | o(log n) |
Answer» C. o(n log n) |
291. |
Which of the following is an application of stack? |
A. | finding factorial |
B. | tower of hanoi |
C. | infix to postfix conversion |
D. | all of the above |
Answer» B. tower of hanoi |
292. |
The data structure which is one ended is ……………… |
A. | queue |
B. | stack |
C. | tree |
D. | graph |
Answer» B. stack |
293. |
A list which displays the relationship of adjacency between elements is said to be |
A. | linear |
B. | non linear |
C. | linked list |
D. | trees |
Answer» A. linear |
294. |
……………….. level is where the model becomes compatible executable code |
A. | abstract level |
B. | application level |
C. | implementation level |
D. | all of the above |
Answer» C. implementation level |
295. |
Which of the following data structure is not linear data structure? |
A. | arrays |
B. | linked lists |
C. | both of the above |
D. | none of the above |
Answer» D. none of the above |
296. |
Inserting an item into the stack when stack is not full is called …………. Operation and deletion of item form the stack, when stack is not empty is called ………..operation. |
A. | push, pop |
B. | pop, push |
C. | insert, delete |
D. | delete, insert |
Answer» A. push, pop |
297. |
Each array declaration need not give, implicitly or explicitly, the information about |
A. | the name of array |
B. | the data type of array |
C. | the first data from the set to be stored |
D. | the index set of the array |
Answer» C. the first data from the set to be stored |
298. |
The elements of an array are stored successively in memory cells because |
A. | by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated |
B. | the architecture of computer memory does not allow arrays to store other than serially |
C. | both of above |
D. | none of above |
Answer» A. by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated |
299. |
Linked lists are best suited |
A. | for relatively permanent collections of data |
B. | for the size of the structure and the data in the structure are constantly changing |
C. | for both of above situation |
D. | for none of above situation |
Answer» B. for the size of the structure and the data in the structure are constantly changing |
300. |
Finding the location of the element with a given value is: |
A. | traversal |
B. | search |
C. | sort |
D. | none of above |
Answer» B. search |
Done Reading?