DS MCQ
DS MCQ
#Quiz DS_1
Answers
√1. Merge sort
2. Insertion sort
3. Bubble sort
4. All of the above
#2. In_____ sort largest element gets bouble out and then 2nd largest element gets bouble out
to get ascending ordered sorted list of elements.
Answers
1. Insertion Sort
2. Selection Sort
√3. Bubble Sort
4. None of the above
#3. How Many iterations will it takes to find 38 from an given array using binary search arr =
{10,20,38,57,100}.
Answers
1. 4
2. 2
3. 3
√4. 1
Answers
1. O(n log(n))
2. O(n n!)
√3. O(n^2)
4. Ω(n)
Answers
1. O(n n!)
2. O(n log(n))
3. Ω(n)
√4. O(n^2)
Answers
√1. O( log(n))
2. O(n n!)
3. Ω(n)
4. O(n)
#7. The algorithm which repeatedly breaks down a list into several sublists until each sublist
consists of a single element.
Answers
1. Selection Sort
3. Bubble Sort
4. Heap Sort
Answers
1. uses in-place algorithm at no extra cost of memory
2. maintains two partitions left for sorted and right for unsorted elements
3. both of the above
√4. It uses divide and conquer approach
Answers
1. half-interval search
2. logarithmic search
√3. Both of the Above
4. Fibonacci Search
#10. Big Theta (Θ)
Answers
√1. When an algorithm has a complexity with lower bound = upper bound
2. Describes the lower bound of a asymptotic function
3. Describes the worst-case of an algorithm
4. None of the above
________________________________________________#END#______________________
__________________________
#Quiz DS_2
Answers
1. Singly linked list is a collection of nodes linked together in a sequential way where each node
of singly linked list contains a data field
2. singly list is an address field which contains the reference of the next node.
3. Singly linked list can contain multiple data fields but should contain at least single address
field pointing to its connected next node.
√4. None Of Above
#2. What would be the asymptotic time complexity to add a node at the end of singly linked list,
if the pointer is initially pointing to the head of the list?
Answers
1. O(1)
2. O(n)
√3. θ(n)
4. Θ(1)
Answers
1. Entire list can be traversed from any node.
2. Circular lists are the required data structure when we want a list to be accessed in a circle or
loop.
3. Despite of being singly circular linked list we can easily traverse to its previous node, which is
not possible in singly linked list.
√4. All of Above
#4. What is the worst case time complexity of inserting a node in a doubly linked list?
Answers
1. O(nlogn)
2. O(logn)
√3. O(n)
4. O(1)
Answers
√4. Implementing a doubly linked list is easier than singly linked list
#6. Which of the following operations is performed more efficiently by doubly linked list than by
singly linked list?
Answers
#7. What is the output of the following code for start pointing to first node of the given list? 1->2-
>3->4->5->6
void Linkedlist(struct node* start)
{
if(start == NULL)
return;
printf("%d",start->data);
if(start->next != NULL)
Linkedlist(start->next->next);
printf("%d",start->data);
}
Answers
1. 1 4 6 6 4 1
2. 1 3 5 1 3 5
3. 1 2 3 5
√4. 1 3 5 5 3 1
#8. Which of the following data structure/s requires extra space to store n no. of elements?
Answers
1. Array
2. Structure
√3. LinkedList
4. Union
#9. Which of the following data structure/s is not suitable to implement Binary Search?
Answers
√1. LinkedList
2. Array
3. Tree
4. Both Options A & B
#10. .In a singly circular linked list, insertion of a node at first position requires modification of a?
Answers
1. One pointer
2. Two pointer
√3. Three pointer
4. None
________________________________________________#END#______________________
__________________________
#Quiz DS_3
Answers
1. easy for computation
√2. effective usage of memory
3. all of the mentioned
4. none of the mentioned
#2. _____ operation get the top data element of the stack, without removing it.
Answers
1. pop()
2. push()
3. IsEmpty()
√4. peek()
Answers
1. Dequeue
2. Linear Queue
3. Circular Queue
√4. Both B & C
Answers
1. Array and Binary Tree
2. Linked List and Graph
√3. Array and Linked List
4. Queue and Linked List
#6. In which data structure element is inserted at one end called Rear and deleted at other end
called Front.
Answers
1. Stack
√2. Queue
3. Both
4. Binary Tree
#7. Array implementation of Stack is not dynamic, which of the following statements supports
this argument?
Answers
√1. Space allocation for array is fixed and cannot be changed during run-time
2. User unable to give the input for stack operations
3. A runtime exception halts execution
4. Improper program compilation
Answers
1. A / ((B - C * D) + E ) + F - G / H
2. A + ((B - C * D) / E ) + F - G / H
3. A + ((B - C * E) / D ) + F - G / H
√4. A + ((B - C * D) / E ) + F / G - H
Answers
1. Standard Buffer
2. Cyclic Buffer
√3. Ring Buffer
4. Radius Buffer
Answers
1. O(n)
2. O(n-1)
√3. O(1)
4. O(n-1)/2
________________________________________________#END#______________________
__________________________
#Quiz DS_4
Answers
1. A binary tree is a type of tree in which every node has either no child node or one child node
or two child nodes.
2. A binary tree is an important class of a tree data structure in which a node can have at most
two children.
√3. Both A and B
4. None of above
#2. The post order traversal of binary tree is DEBFCA. Find out the pre order traversal.
Answers
1. ABFCDE
2. ADBFEC
√3. ABDECF
4. ABDCEF
#3. A binary tree whose every node has either zero or two children is called
Answers
√1. Complete binary tree
2. Binary search tree
3. Extended binary tree
4. None of above
Answers
1. In perfect binary tree all the internal nodes have 2 childrens?
2. All the leaf nodes are at same level.
√3. BOTH are TRUE
4. BOTH are FALSE
Answers
1. A graph may contain no edges and many vertices
√2. A graph may contain many edges and no vertices
3. A graph may contain no edges and no vertices
4. A graph may contain no vertices and many edges
Answers
√1. It is Matrix a[v][v] where v is no of vertices. a[i][j] = 1 if i and j are adjacent = 0
otherwise
2. It is Matrix a[v][v] where v is no of edges. a[i][j] = 1 if i and j are not adjacent = 0 otherwise
4. None of ABOVE
#7. find out Binary Search Tree by inserting following numbers from Left to Right? which is
correct?
11,6,8,19,4,10,5,17,43,49,31
Answers
1. image option 1
2. image option 2
√3. image option 3
4. None Of Above
#8. ----------- traversal is used to get a prefix expression from an expression tree.
Answers
1. PostOrder
√2. PreOrder
3. InOroder
4. All of the above
Answers
1. Coloring of maps algorithms
2. Job scheduling
3. Web Page navigation
√4. Redo / Undo actions
Answers
1. Graphs can be Cyclic or Acyclic.
2. Graph is a network model.
3. Graph can be linear
√4. graph can have unidirectional or bi-directional paths between nodes
________________________________________________#END#______________________
__________________________
#Quiz DS_MODULE__END.
Answers
1. Infix
2. prefix
√3. postfix
4. transfix
#3. .___________________ are those structures that have one or more pointers which point to
the same type of structure, as their member.
Answers
√1. Self Referential structures
2. Circulre structures
3. Data structures
4. Pointer structures
#4. what does the following function do for a given linked list with with first node as head?
void function(struct node* head)
{
if(head == NULL)
return;
function(head -> next);
printf("%d", head-> data);
}
Answers
1. prints alternate node of linked list
2. prints alternate nodes in reverse order
3. prints only even places nodes values
√4. prints all nodes of linked list in reverse order
#5. The preorder traversal sequence of a binary search tree is 29, 18, 10, 15, 23, 21, 37, 35, 45.
Which one of the following is the postorder traversal sequence of the same tree?
Answers
1. 10, 18, 15, 21, 23, 35, 45, 37, 29
2. 15, 10, 23, 21, 18, 45, 35, 37, 29
3. 15, 18, 10, 21, 23, 45, 35, 37, 29
√4. 15, 10, 21, 23, 18, 35, 45, 37, 29
Answers
1. queue
√2. stack
3. array
4. linked-list
Answers
1. 4
√2. -4
3. 3
4. -3
Answers
1. release(tmp)
√2. free(tmp);
3. create(tmp)
4. insert(tmp)
#9. How do you count the number of elements in the circular linked list?
Answers
1. int count(struct node *head) { int total = 0; struct node *current = head; do {
current = current->next; total++; } while (current != NULL); return total; }
√2. int count(struct node *head) { int total = 0; struct node *current = head; do {
current = current->next; total++; } while (current != head); return total; }
3. int count(struct node *head) { int total = 0; struct node *current = head; do {
current = current->next; total++; } while (current != head && temp != null); return total;
}
4. int count(struct node *head) { int total = 0; struct node *current = head; do {
current = current->next; total++; } while (current < head); return total; }
#10. Which of the following is/are not the advantages of Linked List over an array?
1-The size of a linked list can be incremented at runtime which is impossible in the case of the
array.
2-The List is not required to be contiguously present in the main memory, if the contiguous
space is not available, the nodes can be stored anywhere in the memory connected through the
links.
3-The number of elements in the linked list are limited to the available memory space while the
number of elements in the array is limited to the size of an array.
Answers
1. 1,2
2. 1
3. 1,2,3
√4. none of above
Answers
√1. 1
2. 2
3. 3
4. 4
#13. A ________ node is a special node that is found at the beginning of the linked list.
Answers
1. main
√2. header
3. start
4. beginer
Answers
1. + pq - *rt
2. - +pqr * t
√3. - +pq * rt
4. - + * pqrt
Answers
1. Find and delete a given element in the list.
√2. Find and return the position of the given element in the list.
3. Find and return the given element in the list.
4. Find and return the given element in the list.
#16. Which of the following statements is not true about Singly circular linked list?
Answers
√1. Time complexity to searching an element is o(1).
2. Every node in circular is successor.
3. Time complexity to inserting new node at the head in list is o(n).
4. Time complexity to deleting the last node is o(n).
Answers
1. ABCD+*/F+DE*
2. AB+CD*F/+D*E
√3. ABCD+*FD+/E*+
4. ABCD+*FD+E*/+
#18. .Which of the following is/are not correct.
Doubly circular linked list contains only one node, if _______________.
i-next part of first node contains address of last node
ii-next part of first node contains address of first node
iii-prev part of last node contains null value
iv-prev part of last node contains address of first node
Answers
1. i,iv
√2. iii
3. i
4. ii
#19. What is the time complexity of searching for an element in a circular linked list?
Answers
√1. O(n)
2. O(1)
3. O(n log n)
4. O(n log (n-1))
#20. In __________________ search start at the beginning of the list and check every element
in the list.
Answers
1. Binary search
√2. Linear search
3. Hash Search
4. Binary Tree search
________________________________________________#END#______________________
__________________________