Read the most frequently asked 90 top Data Structure(DS) multiple choice questions and answers PDF for freshers and experienced

## Data Structure Objective type Questions and Answers List

1. On which prinicple does stack work?

A. FILO

B. FIFO

C. LILO

D. Both a and c above

Ans: A

2. Can linked list be implemented using arrays?

A. Yes

B. No

Ans: A

3. Two dimensional arrays are also called

A. tables arrays

B. matrix arrays

C. both of above

D. none of above

Ans: C

4. AVL trees have a faster ________.

A. Insertion

B. Deletion

C. Updation

D. Retrieval

Ans: D

5. Which of the following statements hold true for binary trees?

A. The left subtree of a node contains only nodes with keys less than the node’s key

B. The right subtree of a node contains only nodes with keys greater than the node’s key.

C. Both a and b above

D. Noth left and right subtree nodes contains only nodes with keys less than the node’s key

Ans: C

6. The time required in best case for search operation in binary tree is

A. O(n)

B. O(log n)

C. O(2n)

D. O(log 2n)

Ans: B

7. Can stack be described as a pointer?

A. Yes

B. No

Ans: A

8. What is the pecularity of red blac trees?

A. In red-black trees, the root do not contain data.

B. In red-black trees, the leaf nodes are not relevant and do not contain data.

C. In red-black trees, the leaf nodes are relevant but do not contain data.

D. Both a and c above

Ans: B

9. Which of the following ways below is a pre order traversal?

A. Root->left sub tree-> right sub tree

B. Root->right sub tree-> left sub tree

C. right sub tree-> left sub tree->Root

D. left sub tree-> right sub tree->Root

Ans: D

10. Which of the following ways below is a In order traversal?

A. Root->left sub tree-> right sub tree

B. Root->right sub tree-> left sub tree

C. right sub tree-> left sub tree->Root

D. left sub tree-> root->right sub tree

Ans: D

11. Which of the following linked list below have last node of the list pointing to the first node?

A. circular doubly linked list

B. circular linked list

C. circular singly linked list

D. doubly linked list

Ans: A

12. Items in a priority queue are entered in a _____________ order

A. random

B. order of priority

C. as and when they come

D. none of the above

Ans: A

13. A tree cannot contain cycles.

A. False

B. True

Ans: B

14. Breadth First search is used in

A. Binary trees

B. Stacks

C. Graphs

D. Both a and c above

Ans: C

15. A _____ tree is a tree where for each parent node, there is only one associated child node

A. balanced binary tree

B. rooted complete binary tree

C. complete binary tree

D. degenerate tree

Ans: D

16. In graphs, A hyperedge is an edge that is allowed to take on any number of ______.

A. Vertices

B. edges

C. both a and b above

D. labels

Ans: B

17. An empty list is the one which has no

A. nodes

B. data

C. both a and b above

D. address

Ans: C

18. Key value pair is usually seen in

A. Hash tables

B. Heaps

C. Both a and b

D. Skip list

Ans: A

19. In a heap, element with the greatest key is always in the _______ node.

A. leaf

B. root

C. first node of left sub tree

D. first node of right sub tree

Ans: B

20. In _________ tree, the heights of the two child subtrees of any node differ by at most one

A. Binary tree

B. Red black tree

C. Splay tree

D. AVL tree

Ans: D

21. Which data structure allows deleting data elements from front and inserting at rear?

a. Stacks

b. Queues

c. Deques

d. Binary search tree

ans:b

22. Identify the data structure which allows deletions at both ends of the list but insertion at only one end.

a. Input-restricted deque

b. Output-restricted deque

c. Priority queues

d. None of above

ans:a

23. Which of the following data structure is non-linear type?

a. Strings

b. Lists

c. Stacks

d. None of above

ans:d

24. Which of the following data structure is linear type?

a. Strings

b. Lists

c. Queues

d. All of above

ans:d

25. To represent hierarchical relationship between elements, which data structure is suitable?

a. Deque

b. Priority

c. Tree

d. All of above

ans: c

26. A binary tree whose every node has either zero or two children is called

a. Complete binary tree

b. Binary search tree

c. Extended binary tree

d. None of above

ans: c

27. The depth of a complete binary tree is given by

a. Dn = n log2n

b. Dn = n log2n+1

c. Dn = log2n

d. Dn = log2n+1

ans: d

28. When representing any algebraic expression E which uses only binary operations in a 2-tree,

a. the variable in E will appear as external nodes and operations in internal nodes

b. the operations in E will appear as external nodes and variables in internal nodes

c. the variables and operations in E will appear only in internal nodes

d. the variables and operations in E will appear only in external nodes

ans: a

29. A binary tree can easily be converted into q 2-tree

a. by replacing each empty sub tree by a new internal node

b. by inserting an internal nodes for non-empty node

c. by inserting an external nodes for non-empty node

d. by replacing each empty sub tree by a new external node

ans: d

30. When converting binary tree into extended binary tree, all the original nodes in binary tree are

a. internal nodes on extended tree

b. external nodes on extended tree

c. vanished on extended tree

d. None of above

ans: a

31. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal

a. ABFCDE

b. ADBFEC

c. ABDECF

d. ABDCEF

ans: c

32. Which of the following sorting algorithm is of divide-and-conquer type?

a. Bubble sort

b. Insertion sort

c. Quick sort

d. All of above

ans:c

33. An algorithm that calls itself directly or indirectly is known as

a. Sub algorithm

b. Recursion

c. Polish notation

d. Traversal algorithm

ans:b

34. 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

a. Leaf

b. branch

c. path

d. thread

ans:d

35. The in order traversal of tree will yield a sorted listing of elements of tree in

a. Binary trees

b. Binary search trees

c. Heaps

d. None of above

ans:b

36. In a Heap tree

a. Values in a node is greater than every value in left sub tree and smaller than right sub tree

b. Values in a node is greater than every value in children of it

c. Both of above conditions applies

d. None of above conditions applies

ans:b

37. In a graph if e=[u, v], Then u and v are called

a. endpoints of e

b. adjacent nodes

c. neighbors

d. all of above

ans:d

38. A connected graph T without any cycles is called

a. a tree graph

b. free tree

c. a tree

d. All of above

ans:d

39. In a graph if e=(u, v) means

a. u is adjacent to v but v is not adjacent to u

b. e begins at u and ends at v

c. u is processor and v is successor

d. both b and c

ans:d

40. If every node u in G is adjacent to every other node v in G, A graph is said to be

a. isolated

b. complete

c. finite

d. strongly connected

ans:b

41. In linked lists there are noNULL links in:

a. Sin gle linked list

b. Lin ear dou bly linked list

c. cir cu lar linked list

d. None of the above

ANS:C

42. In a Stack the com mand to access nth ele ment from the top of the stack s will be

a. S[Top-n]

b. S [Top+n]

c. S [top-n-1]

d. None of the above

ANS:A

43. If yyy, xxx and zzz are the ele ments of a lex i cally ordered binary tree, then in pre order tra ver sal which node will be tra verse first

a. xxx

b. yyy

c. zzz

d. can not be determined

ANS:A

44. In a bal ance binary tree the height of two sub trees of every node can not dif fer by more than

a. 2

b. 1

c. 0

d. 3

ANS:B

45. The result of eval u at ing pre fix expres sion */b+-dacd, where a = 3, b = 6, c = 1, d = 5 is

a. 0

b. 5

c. 10

d. 15

ANS:C

46. In an array rep re sen ta tion of binary tree the right child of root will be at loca tion of

a. 2

b. 5

c. 3

d. 0

ANS:C

47. The total num ber of com par isons in a bub ble sort is

a. O(n log n)

b. O(2n)

c. O(n2)

d. None of the above

ANS:A

48. The dummy header in linked list contain

a. First record of the actual data

b. Last record of the actual data

c. Pointer to the last record of the actual data

d. None of the above

ANS:A

49. Write the out put of the fol low ing pro gram: int a[] = {1,2,3}*P;

a. 3

b. Junk value

c. Run time error

d. Address of the third element

ANS:B

50 If the out degree of every node is exactly equal to M or 0 and the num ber of nodes at level K is Mk-1 [con sider root at level 1], then tree is called as

(i) Full m-ary try

(ii) Com plete m-ary tree

(iii)Positional m-ary tree

a. Only (i)

b. Only (ii)

c. Both (i) and (ii)

d. Both (ii) and (III)

ANS:C

51. Two main measures for the efficiency of an algorithm are

a. Processor and memory

b. Complexity and capacity

c. Time and space

d. Data and space

Ans: c

52. The time factor when determining the efficiency of algorithm is measured by

a. Counting microseconds

b. Counting the number of key operations

c. Counting the number of statements

d. Counting the kilobytes of algorithm

Ans:b

53. The space factor when determining the efficiency of algorithm is measured by

a. Counting the maximum memory needed by the algorithm

b. Counting the minimum memory needed by the algorithm

c. Counting the average memory needed by the algorithm

d. Counting the maximum disk space needed by the algorithm

Ans:a

54. Which of the following case does not exist in complexity theory

a. Best case

b. Worst case

c. Average case

d. Null case

Ans:d

55. The Worst case occur in linear search algorithm when

a. Item is somewhere in the middle of the array

b. Item is not in the array at all

c. Item is the last element in the array

d. Item is the last element in the array or is not there at all

Ans:d

56. The Average case occur in linear search algorithm

a. When Item is somewhere in the middle of the array

b. When Item is not in the array at all

c. When Item is the last element in the array

d. When Item is the last element in the array or is not there at all

Ans:a

57. The complexity of the average case of an algorithm is

a. Much more complicated to analyze than that of worst case

b. Much more simpler to analyze than that of worst case

c. Sometimes more complicated and some other times simpler than that of worst case

d. None or above

Ans:a

58. The complexity of linear search algorithm is

a. O(n)

b. O(log n)

c. O(n2)

d. O(n log n)

Ans:a

59. The complexity of Binary search algorithm is

a. O(n)

b. O(log )

c. O(n2)

d. O(n log n)

Ans:a

60. The complexity of Bubble sort algorithm is

a. O(n)

b. O(log n)

c. O(n2)

d. O(n log n)

Ans:b

61. The complexity of merge sort algorithm is

a. O(n)

b. O(log n)

c. O(n2)

d. O(n log n)

Ans:c

62. The indirect change of the values of a variable in one module by another module is called

a. internal change

b. inter-module change

c. side effect

d. side-module update

Ans:d

63. Which of the following data structure is not linear data structure?

a. Arrays

b. Linked lists

c. Both of above

d. None of above

Ans:d

64. Which of the following data structure is linear data structure?

a. Trees

b. Graphs

c. Arrays

d. None of above

Ans:c

65. The operation of processing each element in the list is known as

a. Sorting

b. Merging

c. Inserting

d. Traversal

Ans:d

66. Finding the location of the element with a given value is:

a. Traversal

b. Search

c. Sort

d. None of above

Ans:b

67. 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

Ans:a

68. 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

Ans:b

69. 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

Ans:c

70. 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

Ans: a

71. Value of the first linked list index is _______

A. One

B. Zero

C. -1

D. None of these

Ans: B

72. A linked list index is ____ that represents the position of a node in a linked list.

A. An Integer

B. a variable

C. a character

D. a Boolean

Ans: A

73. Why is the constructor of the QueueLinkedList class empty?

A. because initialization of data members of the LinkedList class is performed by the constructor of the LinkedList class.

B. because initialization of data members of the LinkedList class is performed by the destructor of the LinkedList class.

C. because initialization of data members of the QueueLinkedList class is performed by the constructor of the LinkedList class.

D. because initialization of data members of the QueueLinkedList class is performed by the destructor of the LinkedList class

Ans: A

74. _______ form of access is used to add and remove nodes from a queue

A. LIFO,Last In First Out

B. FIFO , First In First Out

C. Both 1 and 2

D. None of these

Ans: B

75. ______ form of access is used to add and remove nodes from a stack

A. LIFO

B. FIFO

C. Both 1 and 2

D. None of these

Ans: A

76. New nodes are added to the _____ of the queue.

A. front

B. back

C. middle

D. Both 1 and 2

Ans: B

77. 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

Ans: A

78. In an array queue, data is stored in an _____ element.

A. Node

B. linked list

C. array

D. constructor

Ans: C

79. The pop() member function determines if the stack is empty by calling the _____ member function

A. removeback()

B. isEmpty()

C. removedfront()

D. hasNext()

Ans: B

80. What happens when you push a new node onto a stack?

A. the new node is placed at the front of the linked list.

B. the new node is placed at the back of the linked list.

C. the new node is placed at the middle of the linked list.

D. No Changes happens

Ans: A

81. The memory address of the first element of an array is called

A. floor address

B. foundation address

C. first address

D. base address

Ans: D

82. The memory address of fifth element of an array can be calculated by the formula

A. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array

B. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the array

C. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the array

D. None of above

Ans: A

83. Which of the following data structures are indexed structures?

A. linear arrays

B. linked lists

C. both of above

D. none of above

Ans: A

84. Which of the following is not the required condition for binary search algorithm?

A. The list must be sorted

B. there should be the direct access to the middle element in any sublist

C. There must be mechanism to delete and/or insert elements in list

D. none of above

Ans: C

85. Which of the following is not a limitation of binary search algorithm?

A. must use a sorted array

B. requirement of sorted array is expensive when a lot of insertion and deletions are needed

C. there must be a mechanism to access middle element directly

D. binary search algorithm is not efficient when the data elements are more than 1000.

Ans: D

86. Two dimensional arrays are also called

A. tables arrays

B. matrix arrays

C. both of above

D. none of above

Ans: C

87. A variable P is called pointer if

A. P contains the address of an element in DATA.

B. P points to the address of first element in DATA

C. P can store only memory addresses

D. P contain the DATA and the address of DATA

Ans: A

88. Which of the following data structure can’t store the non-homogeneous data elements?

A. Arrays

B. Records

C. Pointers

D. None

Ans: A

89. Which of the following data structure store the homogeneous data elements?

A. Arrays

B. Records

C. Pointers

D. None

Ans: B

90. Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called

A. elementary items

B. atoms

C. scalars

D. all of above

Ans: D