Data Structures - MCQs from AMIE exams (Summer 2019)

Choose the correct answers for the following (2 marks each)

1. Which of the following sorting technique leads to minimum number of swapping?
(a) Quick Sort
(b) Selection Sort
(c) Heap Sort
(d) Insertion Sort

2. Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?
(a) O(l)
(b) O (log n)
(c) O (n)
(d) O (n log n)

3. In a max heap, both the insertion and deletion operations can be performed in time:
(a) O (log n)
(b) O (n log n)
(c) O(n)
(d) O (n²)

4. A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is :
(a) log2(2)
(b) n - 1
(c) n
(d) 2n

5. The time complexity for evaluating a postfix expression is:
(a) O(n)
(b) O (n log n)
(c) O(log n)
(d) O (n²)

6. The following sequence of operations is performed on stack: PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH(20), POP. 
The sequence of values popped out is:
(a) 20,10,20,10,20
(b) 20,20,10,10,20
(c) 10,20,20,10,20
(d) 20,20,10,20,10

7. The worst case running times of Insertion sort, merge sort and Quick sort, respectively, are :
(a) Θ(n log n), Θ(n log n) and Θ(n2)
(b) Θ(n2), Θ(n2) and Θ(n log n)

(c) Θ(n2), Θ(n log n) and Θ(n log n)

(d) Θ(n2), Θ(n log n) and Θ(n2)


8. Which one of the following array satisfied the max-heap property?
(a) 25,12,16,13,10,8,14
(b) 25,14,13,16,10,8,12
(c) 25,14,16,13,10,8,12
(d) 25,14,12,13,10,8,16

9. Let G be any connected, weighted, undirected graph.
I. G has a unique minimum spanning tree, if no two edges of G have the same weight.
II. G has a unique minimum spanning tree, if for every cut G, there is a unique minimum weight edge crossing the cut.
Which of the above two statements is/arc TRUE ?
(a) Neither I nor II
(b) I only
(c) II only
(d) Both I and II

10. Which of the following is essential for converting an infix expression to the postfix form efficiently?
(a) Operator Stack
(b) Operand Stack
(c) Operator and Operand Stack
(d) Parse Tree

Answer

1. (b) In selection sort we repeatedly choose the smallest element, and put in the right place, hence total number of swaps are n-1 in worst case. Hence, section sort has the minimum number of swaps among the all sorting algorithms.

2. (c) Height of BST could have order n, that is, O(n). Where n represents a number of elements in BST.

3. (a) A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to the values in the children of that node. 

4. (b) In a binary tree
Internal node,  N = (N + 1) leaf
Hence, N leaf = (N - 1) internal node

5. (a) The time complexity of the evaluation algorithm is O(n) where n is a number of characters in the input expression.

6. (b) 

7. (d) 

8. (c)  A tree is max-heap if data at every node in the tree is greater than or equal to its children’s data. In array representation of heap tree,  a node at index i has its left child at index 2i + 1 and right child at index 2i + 2.

9. (d) 

10. (a) Operator stack is used for converting infix to postfix expression such that operators like as +, *, (,), / are pushed in stack whereas operand stack is used for converting Postfix to Prefix evaluation such that operands are 7, 2, 1, 2 etc.

---
  • The study material for AMIE/B Tech/Junior Engineer exams is available at https://amiestudycircle.com
  • If you like the post please share your thoughts in the comment section 


Popular posts from this blog

Meaning of AeSI withdrawing case from Delhi High Court and its implications for IEI