Data Structure MCQ
Data Structure MCQ
Data Structure MCQ
__________________________________________________________________________________
Question Bank for Online Examination
Subject: Data Structures and Algorithms
Compiled By: Rahul Y. Pawar
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
ANSWER: C
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
ANSWER: B
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
ANSWER: C
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
ANSWER: C
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
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
ANSWER: A
What should be added in place of *ADD A STATEMENT HERE*, so that the function
correctly reverses a linked list.
A. *head_ref = prev;
B. *head_ref = current;
C. *head_ref = next;
D. *head_ref = NULL;
ANSWER: A
In the worst case, the number of comparisons needed to search a singly linked list of length n
for a given element is
A. log 2 n
B. n/2
C. log 2 n – 1
D. n
ANSWER: D
Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head
node is not given, can we delete the node X from given linked list?
A. Possible if X is not last node
B. Possible if size of linked list is even
C. Possible if size of linked list is odd
D. Possible if X is not first node
ANSWER: A
You are given pointers to first and last nodes of a singly linked list, which of the following
operations are dependent on the length of the linked list?
A. Delete the first element
B. Insert a new element as a first element
C. Delete the last element of the list
D. Add a new element at the end of the list
ANSWER: C
In the worst case, the number of comparisons needed to search a singly linked list of length n
for a given element is
A. log2 n
B. n/2
C. log2 n – 1
D. n
ANSWER: D
What is the time complexity to count the number of elements in the linked list?
A. O(1)
B. O(n)
C. O(logn)
D. O(n2)
ANSWER: B
Which of these is not an application of linked list?
A. To implement file systems
B. For separate chaining in hash-tables
C. To implement non-binary trees
D. Random Access of elements
ANSWER: D
How do you calculate the pointer difference in a memory efficient double linked list?
A. head xor tail
B. pointer to previous node xor pointer to next node
C. pointer to previous node – pointer to next node
D. pointer to next node – pointer to previous node
ANSWER: B
What is the worst case time complexity of inserting a node in a doubly linked list?
A. O(nlogn)
B. O(logn)
C. O(n)
D. O(1)
ANSWER: C
Which of the following real world scenarios would you associate with a stack data structure?
A. piling up of chairs one above the other
B. people standing in a line to be serviced at a counter
C. offer services based on the priority of the customer
D. all of the mentioned
ANSWER: A
What is the time complexity of pop() operation when the stack is implemented using an
array?
A. O(1)
B. O(n)
C. O(logn)
D. O(nlogn)
ANSWER: A
Array implementation of Stack is not dynamic, which of the following statements supports
this argument?
A. space allocation for array is fixed and cannot be changed during run-time
B. user unable to give the input for stack operations
C. a runtime exception halts execution
D. all of the mentioned
ANSWER: A
Which of the following data structures can be used for parentheses matching?
A. n-ary tree
B. queue
C. priority queue
D. stack
ANSWER: D
If the values of a variable in one module is indirectly changed by another module, this
situation is called
A. internal change
B. inter-module change
C. side effect
D. side-module update
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
Which of the following searching techniques do not require the data to be in sorted form
A - Binary Search
B - Interpolation Search
C - Linear Search
D - All of the above
Which of the below given sorting techniques has highest best-case runtime complexity −
A - quick sort
B - selection sort
C - insertion sort
D - bubble sort
The following sorting algorithms maintain two sub-lists, one sorted and one to be sorted −
A - Selection Sort
B - Insertion Sort
C - Merge Sort
D - both A &am; B
Interpolation search is an improved variant of binary search. It is necessary for this search
algorithm to work that −
A - data collection should be in sorted form and equally distributeD.
B - data collection should be in sorted form and but not equally distributeD.
C - data collection should be equally distributed but not sorteD.
D - None of the above.
Which data structure allows deleting data elements from front and inserting at rear?
A. Stacks
B. Queues
C. Deques
D. Binary search tree
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
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
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
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
The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
A. ABFCDE
B. ADBFEC
C. ABDECF
D. ABDCEF
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
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
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
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
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
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