Presentation is loading. Please wait.

Presentation is loading. Please wait.

Solved MCQ of Data Structure

Similar presentations


Presentation on theme: "Solved MCQ of Data Structure"— Presentation transcript:

1 Solved MCQ of Data Structure
Source & Courtesy:

2 1. Which if the following is/are the levels of implementation of data structure
Abstract level Application level Implementation level All of the above 2. A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called …… AVL tree Red-black tree Lemma tree None of the above 3. ……………….. level is where the model becomes compatible executable code 4. Stack is also called as Last in first out First in last out Last in last out First in first out

3 6. …………… is not the component of data structure.
5. Which of the following is true about the characteristics of abstract data types? It exports a type. It exports a set of operations True, False False, True True, True False, False 6. …………… is not the component of data structure. Operations Storage Structures Algorithms None of above 7. Which of the following is not the part of ADT description? Data Both of the above None of the above 8. 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. push, pop pop, push insert, delete delete, insert

4 9. ……………. Is a pile in which items are added at one end and removed from the other.
Stack Queue List None of the above 10. ………… is very useful in situation when data have to stored and then retrieved in reverse order. Link list 11. Which data structure allows deleting data elements from and inserting at rear? Stacks Queues Dequeues Binary search tree 12. Which of the following data structure can't store the non-homogeneous data elements? Arrays Records Pointers

5 13. 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. Queue linked list Stacks linked list Both of them Neither of them 14. Which of the following is non-liner data structure? Stacks List Strings Trees 15. Herder node is used as sentinel in ..... Graphs Binary tree Queues 16. Which data structure is used in breadth first search of a graph to hold nodes? Stack queue Tree Array

6 17. Identify the data structure which allows deletions at both ends of the list but insertion at only one end. Input restricted dequeue Output restricted qequeue Priority queues Stack 18. Which of the following data structure is non-linear type? Strings Lists Stacks Graph 19. Which of the following data structure is linear type? Trees Binary tree 20. To represent hierarchical relationship between elements, Which data structure is suitable? Dequeue Priority Tree

7 Thanks…

8 Solved MCQ of Data Structure
Source & Courtesy:

9 1. A directed graph is ………………
1. A directed graph is ………………. if there is a path from each vertex to every other vertex in the digraph. Weakly connected Strongly Connected Tightly Connected Linearly Connected 2. In the …………….. traversal we process all of a vertex’s descendants before we move to an adjacent vertex. Depth First Breadth First With First Depth Limited 3. State True of False. Network is a graph that has weights or costs associated with it. An undirected graph which contains no cycles is called a forest. A graph is said to be complete if there is no edge between every pair of vertices. True, False, True True, True, False True, True, True False, True, True

10 4. Match the following. Completeness i) How long does it take to find a solution Time Complexity ii) How much memory need to perform the search. Space Complexity iii) Is the strategy guaranteed to find the solution when there in one. a-iii, b-ii, c-i a-i, b-ii, c-iii a-iii, b-i, c-ii a-i, b-iii, c-ii 5. 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 6. In ……………, search start at the beginning of the list and check every element in the list. Linear search Binary search Hash Search Binary Tree search

11 7. State True or False. Binary search is used for searching in a sorted array. The time complexity of binary search is O(logn). True, False False, True False, False True, True 8. Which of the following is not the internal sort? Insertion Sort Bubble Sort Merge Sort Heap Sort 9. State True or False. An undirected graph which contains no cycles is called forest. A graph is said to be complete if there is an edge between every pair of vertices.

12 10. 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. Partite Bipartite Rooted Bisects 11. In a queue, the initial values of front pointer f rare pointer r should be …….. and ……….. respectively. 0 and 1 0 and -1 -1 and 0 1 and 0 12. In a circular queue the value of r will be .. r=r+1 r=(r+1)% [QUEUE_SIZE – 1] r=(r+1)% QUEUE_SIZE r=(r-1)% QUEUE_SIZE

13 13. Which of the following statement is true?
Using singly linked lists and circular list, it is not possible to traverse the list backwards. To find the predecessor, it is required to traverse the list from the first node in case of singly linked list. i-only ii-only Both i and ii None of both 14. The advantage of ……………... is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. Lists Linked Lists Trees Queues 15. What will be the value of top, if there is a size of stack STACK_SIZE is 5 5 6 4 None 16. ………… is not the operation that can be performed on queue. Insertion Deletion Retrieval Traversal

14 17. There is an extra element at the head of the list called a ……….
Antinel Sentinel List header List head 18. A graph is a collection of nodes, called ………. And line segments called arcs or ………... that connect pair of nodes. vertices, edges edges, vertices vertices, paths graph node, edges 19. A ……….. is a graph that has weights of costs associated with its edges. Network Weighted graph Both A and B None A and B 20. In general, the binary search method needs no more than ……………. comparisons. [log2n]-1 [logn]+1 [log2n] [log2n]+1

15 Thanks…

16 Solved MCQ of Data Structure
Source & Courtesy:

17 1. Which of the following is not the type of queue?
Ordinary queue Single ended queue Circular queue Priority queue 2. The property of binary tree is The first subset is called left subtree The second subtree is called right subtree The root cannot contain NULL The right subtree can be empty 3. State true or false. The degree of root node is always zero. Nodes that are not root and not leaf are called as internal nodes. True, True True, False False, True False, False 4. Any node is the path from the root to the node is called Successor node Ancestor node Internal node None of the above

18 5. State true of false. A node is a parent if it has successor nodes. A node is child node if out degree is one. True, True True, False False, True False, False 6. ………………. is not an operation performed on linear list a) Insertion b) Deletion c) Retrieval d) Traversal only a,b and c only a and b All of the above None of the above 7. Which is/are the application(s) of stack Function calls Large number Arithmetic Evaluation of arithmetic expressions 8. A …………… is an acyclic digraph, which has only one node with indegree 0, and other nodes have in-degree 1. Directed tree Undirected tree Dis-joint tree Direction oriented tree

19 9. …………………. Is a directed tree in which outdegree of each node is less than or equal to two.
Unary tree Binary tree Trinary tree Both B and C 10. State true or false. An empty tree is also a binary tree. In strictly binary tree, the out-degree of every node is either o or 2. True, False False, True True, True False, False 11. Which of the following data structures are indexed structures? Linear arrays Linked lists Queue Stack 12. Which of the following data structure store the homogeneous data elements? Arrays Records Pointers List

20 13. When new data are to be inserted into a data structure, but there is not available space; this situation is usually called .... Underflow overflow houseful saturated 14. A data structure where elements can be added or removed at either end but not in the middle is called ... linked lists stacks queues dequeue 15. Operations on a data structure may be ..... creation destruction selection all of the above 16. The way in which the data item or items are logically related defines ..... storage structure data structure data relationship data operation

21 17. Which of the following are the operations applicable an primitive data structures?
create destroy update all of the above 18. The use of pointers to refer elements of a data structure in which elements are logically adjacent is .... pointers linked allocation stack queue 19. Arrays are best data structures for relatively permanent collections of data for the size of the structure and the data in the structure are constantly changing for both of above situation for none of above situation 20. Which of the following statement is false? Arrays are dense lists and static data structure. Data elements in linked list need not be stored in adjacent space in memory Pointers store the next data element of a list. Linked lists are collection of the nodes that contain information part and next pointer.

22 Thanks…

23 Data Structures & Algorithms - Multiple Choice Questions
Source & Courtesy:

24 1. which data structure allows deleting data elements from front and inserting at rear?
stacks queues deques binary search tree 2. identify the data structure which allows deletions at both ends of the list but insertion at only one end. input-restricted deque output-restricted deque priority queues none of above 3. which of the following data structure is non-linear type? strings lists

25 4. which of the following data structure is linear type?
strings lists queues all of above 5. to represent hierarchical relationship between elements, which data structure is suitable? deque priority tree 6. a binary tree whose every node has either zero or two children is called complete binary tree binary search tree extended binary tree none of above

26 7. the depth of a complete binary tree is given by
dn = n log2n dn = n log2n+1 dn = log2n dn = log2n+1 8. when representing any algebraic expression e which uses only binary operations in a 2-tree, the variable in e will appear as external nodes and operations in internal nodes the operations in e will appear as external nodes and variables in internal nodes the variables and operations in e will appear only in internal nodes the variables and operations in e will appear only in external nodes 9. a binary tree can easily be converted into q 2-tree by replacing each empty sub tree by a new internal node by inserting an internal node for non-empty node by inserting an external node for non-empty node by replacing each empty sub tree by a new external node

27 13. an algorithm that calls itself directly or indirectly is known as
10. when converting binary tree into extended binary tree, all the original nodes in binary tree are internal nodes on extended tree external nodes on extended tree vanished on extended tree none of above 11. the post order traversal of a binary tree is debfca. find out the pre order traversal abfcde adbfec abdecf abdcef 12. which of the following sorting algorithm is of divide-and-conquer type? bubble sort insertion sort quick sort all of above 13. an algorithm that calls itself directly or indirectly is known as sub algorithm recursion polish notation traversal algorithm

28 17. in a graph if e=[u, v], then u and v are called
14. in a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree for efficiency. these special pointers are called leaf branch path thread 15. the in order traversal of tree will yield a sorted listing of elements of tree in binary trees binary search trees heaps none of above 16. in a heap tree values in a node is greater than every value in left sub tree and smaller than right sub tree values in a node is greater than every value in children of it both of above conditions applies none of above conditions applies 17. in a graph if e=[u, v], then u and v are called endpoints of e adjacent nodes neighbours all of above

29 18. a connected graph t without any cycles is called
a tree graph free tree a tree all of above 19. in a graph if e=(u, v) means u is adjacent to v but v is not adjacent to u e begins at u and ends at v u is processor and v is successor both b and c 20. if every node u in g is adjacent to every other node v in g, a graph is said to be isolated complete finite strongly connected

30 Thanks…

31 Data Structures & Algorithms - Multiple Choice Questions
Source & Courtesy:

32 the memory address of the first element of an array is called
floor address foundation address first address base address the memory address of fifth element of an array can be calculated by the formula loc(array[5]=base(array)+w(5-lower bound), where w is the number of words per memory cell for the array loc(array[5])=base(array[5])+(5-lower bound), where w is the number of words per memory cell for the array loc(array[5])=base(array[4])+(5-upper bound), where w is the number of words per memory cell for the array none of above which of the following data structures are indexed structures? linear arrays linked lists both of above none of above

33 which of the following is not the required condition for binary search algorithm?
the list must be sorted there should be the direct access to the middle element in any sublist there must be mechanism to delete and/or insert elements in list none of above which of the following is not a limitation of binary search algorithm? must use a sorted array requirement of sorted array is expensive when a lot of insertion and deletions are needed there must be a mechanism to access middle element directly binary search algorithm is not efficient when the data elements are more than 1000. two dimensional arrays are also called tables arrays matrix arrays both of above none of above

34 a variable p is called pointer if
p contains the address of an element in data. p points to the address of first element in data p can store only memory addresses p contains the data and the address of data which of the following data structure can't store the non-homogeneous data elements? arrays records pointers none which of the following data structure store the homogeneous data elements? arrays records pointers none

35 10. each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called elementary items atoms scalars all of above 11. the difference between linear array and a record is an array is suitable for homogeneous data but the data items in a record may have different data type in a record, there may not be a natural ordering in opposed to linear array. a record form a hierarchical structure but a linear array does not all of above 12. which of the following statement is false? arrays are dense lists and static data structure data elements in linked list need not be stored in adjacent space in memory pointers store the next data element of a list linked lists are collection of the nodes that contain information part and next pointer

36 13. binary search algorithm cannot be applied to
sorted linked list sorted binary trees sorted linear array pointer array 14. when new data are to be inserted into a data structure, but there is no available space; this situation is usually called underflow overflow housefull saturated 15. the situation when in a linked list start=null is underflow overflow housefull saturated

37 16. which of the following is two-way list?
grounded header list circular header list linked list with header and trailer nodes none of above 17. which of the following name does not relate to stacks? fifo lists lifo list piles push-down lists 18. the term "push" and "pop" is related to the array lists stacks all of above

38 19. a data structure where elements can be added or removed at either end but not in the middle
linked lists stacks queues deque 20. when inorder traversing a tree resulted e a c k f h d b g; the preorder traversal would return faekcdbhg faekcdhgb eafkhdcbg feakdchbg

39 Thanks…

40 Data Structures & Algorithms - Multiple Choice Questions
Source & Courtesy:

41 Two main measures for the efficiency of an algorithm are
Processor and memory Complexity and capacity Time and space Data and space The time factor when determining the efficiency of algorithm is measured by Counting microseconds Counting the number of key operations Counting the number of statements Counting the kilobytes of algorithm The space factor when determining the efficiency of algorithm is measured by Counting the maximum memory needed by the algorithm Counting the minimum memory needed by the algorithm Counting the average memory needed by the algorithm Counting the maximum disk space needed by the algorithm

42 Which of the following case does not exist in complexity theory
Best case Worst case Average case Null case The Worst case occur in linear search algorithm when Item is somewhere in the middle of the array Item is not in the array at all Item is the last element in the array Item is the last element in the array or is not there at all The Average case occur in linear search algorithm When Item is somewhere in the middle of the array When Item is not in the array at all When Item is the last element in the array When Item is the last element in the array or is not there at all

43 The complexity of the average case of an algorithm is
Much more complicated to analyze than that of worst case Much simpler to analyze than that of worst case Sometimes more complicated and some other times simpler than that of worst case None or above The complexity of linear search algorithm is O(n) O(log n) O(n2) O(n log n) The complexity of Binary search algorithm is O(n) O(log ) O(n2) O(n log n)

44 10. The complexity of Bubble sort algorithm is
O(n) O(log n) O(n2) O(n log n) 11. The complexity of merge sort algorithm is O(n) O(log n) O(n2) O(n log n) 12. The indirect change of the values of a variable in one module by another module is called internal change inter-module change side effect side-module update

45 13. Which of the following data structure is not linear data structure?
Arrays Linked lists Both of above None of above 14. Which of the following data structure is linear data structure? Trees Graphs Arrays None of above 15. The operation of processing each element in the list is known as Sorting Merging Inserting Traversal

46 16. Finding the location of the element with a given value is:
Traversal Search Sort None of above 17. Arrays are best data structures for relatively permanent collections of data for the size of the structure and the data in the structure are constantly changing for both of above situation for none of above situation 18. Linked lists are best suited for relatively permanent collections of data for the size of the structure and the data in the structure are constantly changing for both of above situation for none of above situation

47 19. Each array declaration need not give, implicitly or explicitly, the information about
the name of array the data type of array the first data from the set to be stored the index set of the array 20. The elements of an array are stored successively in memory cells because by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated the architecture of computer memory does not allow arrays to store other than serially both of above none of above

48 Which one of the following permutations can be obtained the output using stack assuming that the input is the sequence 1,2,3,4,5 in that order? [A] 3,4,5,1,2 [B] 3,4,5,2,1 [C] 1,5,2,3,4 [D] 5,4,3,1,2 Answer: B. 3,4,5,2,1 The initial configuration of the queue is a,b,c,d (a is the front end). To get the configuration d,c,b,a one needs a minimum of ? [A] 2 deletions and 3 additions [B] 3 additions and 2 deletions [C] 3 deletions and 3 additions [D] 3 deletions and 4 additions Answer: C. 3 deletions and 3 additions Linked list are not suitable data structure of which one of the following problems? [A] Insertion sort [B] Binary search [C] Radix sort [D] Polynomial manipulation Answer: B. Binary search

49 The number of possible ordered trees with three nodes A, B, C is
The number of possible ordered trees with three nodes A, B, C is? [A] 16 [B] 12 [C] 6 [D] 10 Answer: B. 12 Which of the following algorithm design technique is used in the quick sort algorithm? [A] Dynamic programming [B] Backtracking [C] Divide and conquer [D] Greedy method Answer: C. Divide and conquer The number of swapping needed to sort numbers 8,22,7,9,31,19,5,13 in ascending order using bubble sort is? [A] 11 [C] 13 [D] 14 Answer: D. 14

50 7.Which of the following statement is true?
[A] Optimal binary search tree construction can be performed efficiently using dynamic programming. [B] Breath first search cannot be used to find converted components of a graph. [C] Given the prefix and post fix walks over a binary tree. The binary tree cannot be uniquely constructed [D] Depth first search can be used to find connected components of a graph. Answer: A. Optimal binary search tree construction can be performed efficiently using dynamic programming. Given two sorted lists of size m and n respectively. The number of comparisons needed in the worst case by the merge sort algorithm will be? [A] mn [B] max(m,n) [C] min(m,n) [D] m+n-1 Answer: D. m+n-1 Merge sort uses? [A] Divide and conquer strategy [B] Backtracking approach [C] Heuristic search [D] Greedy approach Answer: A. Divide and conquer strategy

51 The following sequence of operation is performed on stack: push(1),push(2),pop,push(1),push(2),pop,pop,pop,push(2),pop. The sequence of popped out values are? [A] 2,2,1,1,2 [B] 2,2,1,2,2 [C] 2,1,2,2,1 [D] 2,1,2,2,2 Answer: A. 2,2,1,1,2 Which of the following algorithm design technique is used in the quick sort algorithm? [A] Dynamic programming [B] Backtracking [C] Divide and conquer [D] Greedy method Answer: C. Divide and conquer Which of the following is useful in traversing a given graph by breadth first search? [A] Stack [B] Set [C] List [D] Queue Answer: D. Queue

52 Which of the following is useful in implementing quick sort?
[A] Stack [B] Set [C] List [D] Queue Answer: A. Stack An IP address is a numeric quantity that identifies – [A] a network adapter to other devices on the network [B] the manufacturer of a computer [C] the physical location of a computer [D] none of the above Answer: A. a network adapter to other devices on the network You can make telephone calls over the Internet using a technology called [A] Intertel [B] Telenet [C] VoIP [D] VoRP Answer: C. VoIP 16. What is the result of the following operation Top (Push (S, X)) [A] X [B] null [C] s [D] none of these Answer: A. X

53 Queue can be used to implement?
[A] quick sort [B] merge sort [C] heap sort [D] insertion sort Answer: A. quick sort The number of binary trees with 3 nodes which when traversed in post order gives the sequence A,B,C is ? [A] 3 [B] 9 [C] 7 [D] 5 Answer: D. 5 Sparse matrices have? [A] no zero [B] many zero [C] higher dimension [D] none Answer: B. many zero The postfix expression for * + a b - c d is? [A] ab + cd - * [B] ab cd + - * [C] ab + cd * - [ D] ab + - cd * Answer: A. ab + cd - *

54 21. A vertex of degree one is called [A] padent
[B] isolated vertex [C] null vertex [D] colored vertex Answer: A. padent

55 Thanks…


Download ppt "Solved MCQ of Data Structure"

Similar presentations


Ads by Google