Read the most frequently asked 100 top Data Structures multiple choice questions and answers PDF for freshers and experienced

## Data Structures Objective type Questions and Answers List

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

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

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

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

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

6. Two dimensional arrays are also called

A. tables arrays

B. matrix arrays

C. both of above

D. none of above

Ans: C

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

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

A. Arrays

B. Records

C. Pointers

D. None

Ans: A

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

A. Arrays

B. Records

C. Pointers

D. None

Ans: B

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

11. The difference between linear array and a record is

A. An array is suitable for homogeneous data but hte data items in a record may have different data type

B. In a record, there may not be a natural ordering in opposed to linear array.

C. A record form a hierarchical structure but a lienear array does not

D. All of above

Ans: D

12. Which of the following statement is false?

A. Arrays are dense lists and static data structure

B. data elements in linked list need not be stored in adjecent space in memory

C. pointers store the next data element of a list

D. linked lists are collection of the nodes that contain information part and next pointer

Ans: C

13. Binary search algorithm can not be applied to

A. sorted linked list

B. sorted binary trees

C. sorted linear array

D. pointer array

Ans: A

14. When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

A. underflow

B. overflow

C. housefull

D. saturated

Ans: B

15. The situation when in a linked list START=NULL is

A. underflow

B. overflow

C. housefull

D. saturated

Ans: A

16. Which of the following is two way list?

A. grounded header list

B. circular header list

C. linked list with header and trailer nodes

D. none of above

Ans: D

17. Which of the following name does not relate to stacks?

A. FIFO lists

B. LIFO list

C. Piles

D. Push-down lists

Ans: A

18. The term “push” and “pop” is related to the

A. array

B. lists

C. stacks

D. all of above

Ans: C

19. A data structure where elements can be added or removed at either end but not in the middle

A. Linked lists

B. Stacks

C. Queues

D. Deque

Ans: D

20. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return

A. FAEKCDBHG

B. FAEKCDHGB

C. EAFKHDCBG

D. FEAKDCHBG

Ans: B

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

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

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

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

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

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

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

48. The complexity of linear search algorithm is

A. O(n)

B. O(log n)

C. O(n2)

D. O(n log n)

Ans: A

49. The complexity of Binary search algorithm is

A. O(n)

B. O(log )

C. O(n2)

D. O(n log n)

Ans: B

50. The complexity of Bubble sort algorithm is

A. O(n)

B. O(log n)

C. O(n2)

D. O(n log n)

Ans: C

51. The complexity of merge sort algorithm is

A. O(n)

B. O(log n)

C. O(n2)

D. O(n log n)

Ans: D

52. 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: C

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

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

A. Trees

B. Graphs

C. Arrays

D. None of above

Ans: C

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

A. Sorting

B. Merging

C. Inserting

D. Traversal

Ans: D

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

A. Traversal

B. Search

C. Sort

D. None of above

Ans: B

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

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

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

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

61. Value of the first linked list index is _______

A. One

B. Zero

C. -1

D. None of these

Ans: B

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

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

64. _______ 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

65. ______ 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

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

A. front

B. back

C. middle

D. Both 1 and 2

Ans: B

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

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

A. Node

B. linked list

C. array

D. constructor

Ans: C

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

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

71. _____________ Memory is Volatile

1. main

2. Random Access

3. Both 1 and 2

4. Virtual

Ans: 3

72. An _________ data type is a keyword of a programming language that specifies the amount ofmemory needed to store data and the kind of data that will be stored in that memory location

1. abstract

2. int

3. vector

4. None of these

Ans: 1

73. Which of the following abstract data types are NOT used by Integer Abstract Data type group?

1. Short

2. Int

3. float

4. long

Ans: 3

74. The hashString() member function is called by other member functions of the Hashtable class whenever a function needs to convert a ________________

1. a hash number key to a key

2. key to a hash number key

3. a key to an Index

4. None of these

Ans: 2

75. An application iterates the hashtable by calling the ______ and ______ member functions

1. hasNext() and hasDelete()

2. hasNext() and getNextKey()

3. Both 1 and 2

4. None of these

Ans: 2

76. The javA.util package contains two classes that are designed to work with hashtables. They are _______ and _________..

1. Hashtable , HashMap class

2. Hashtable,List

3. Vector,List

4. Vector,Hashtable

Ans: 1

77. Data members of the Hashtable class stored in the private access specifier

1. private access specifier

2. Public access specifier

3. common access specifier

4. None of these

Ans: 1

78. _____ is the common programming technique used for hashing in all hashing functions

1. Cloning

2. Bit Shifting

3. Hashmapping

4. Listing

Ans: 2

79. If the depth of a tree is 3 levels, then what is the Size of the Tree?

1. 4

2. 2

3. 8

4. 6

Ans: 3

80. deleteNode() function requires the _____ of the data element of the node that is being removed

1. reference

2. value

3. declaration

4. variable

Ans: 2

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

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

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

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

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

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

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

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

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

90 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