- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- Data Structures
- DSA - Data Structure Basics
- DSA - Data Structures and Types
- DSA - Array Data Structure
- Linked Lists
- DSA - Linked List Data Structure
- DSA - Doubly Linked List Data Structure
- DSA - Circular Linked List Data Structure
- Stack & Queue
- DSA - Stack Data Structure
- DSA - Expression Parsing
- DSA - Queue Data Structure
- Searching Algorithms
- DSA - Searching Algorithms
- DSA - Linear Search Algorithm
- DSA - Binary Search Algorithm
- DSA - Interpolation Search
- DSA - Jump Search Algorithm
- DSA - Exponential Search
- DSA - Fibonacci Search
- DSA - Sublist Search
- DSA - Hash Table
- Sorting Algorithms
- DSA - Sorting Algorithms
- DSA - Bubble Sort Algorithm
- DSA - Insertion Sort Algorithm
- DSA - Selection Sort Algorithm
- DSA - Merge Sort Algorithm
- DSA - Shell Sort Algorithm
- DSA - Heap Sort
- DSA - Bucket Sort Algorithm
- DSA - Counting Sort Algorithm
- DSA - Radix Sort Algorithm
- DSA - Quick Sort Algorithm
- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal
- DSA - Spanning Tree
- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Red Black Trees
- DSA - B Trees
- DSA - B+ Trees
- DSA - Splay Trees
- DSA - Tries
- DSA - Heap Data Structure
- Recursion
- DSA - Recursion Algorithms
- DSA - Tower of Hanoi Using Recursion
- DSA - Fibonacci Series Using Recursion
- Divide and Conquer
- DSA - Divide and Conquer
- DSA - Max-Min Problem
- DSA - Strassen's Matrix Multiplication
- DSA - Karatsuba Algorithm
- Greedy Algorithms
- DSA - Greedy Algorithms
- DSA - Travelling Salesman Problem (Greedy Approach)
- DSA - Prim's Minimal Spanning Tree
- DSA - Kruskal's Minimal Spanning Tree
- DSA - Dijkstra's Shortest Path Algorithm
- DSA - Map Colouring Algorithm
- DSA - Fractional Knapsack Problem
- DSA - Job Sequencing with Deadline
- DSA - Optimal Merge Pattern Algorithm
- Dynamic Programming
- DSA - Dynamic Programming
- DSA - Matrix Chain Multiplication
- DSA - Floyd Warshall Algorithm
- DSA - 0-1 Knapsack Problem
- DSA - Longest Common Subsequence Algorithm
- DSA - Travelling Salesman Problem (Dynamic Approach)
- Approximation Algorithms
- DSA - Approximation Algorithms
- DSA - Vertex Cover Algorithm
- DSA - Set Cover Problem
- DSA - Travelling Salesman Problem (Approximation Approach)
- Randomized Algorithms
- DSA - Randomized Algorithms
- DSA - Randomized Quick Sort Algorithm
- DSA - Karger’s Minimum Cut Algorithm
- DSA - Fisher-Yates Shuffle Algorithm
- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion
Data Structures Algorithms Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Data Structures Algorithms. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - In a min-heap:
A - parent nodes have values greater than or equal to their childs
B - parent nodes have values less than or equal to their childs
Answer : A
Explanation
In a min heap, parents always have lesser or equal values than that of their childs.
Q 2 - Maximum number of nodes in a binary tree with height k, where root is height 0, is
Answer : B
Explanation
If the root node is at height 0, then a binary tree can have at max 2k+1 − 1 nodes.
For example: a binary tree of height 1, can have maximum 21+1 − 1 = 3 nodes.
r --------- 0 / \ L R --------- 1
Q 3 - Minimum number of moves required to solve a Tower of Hanoi puzzle is
Answer : C
Explanation
Minimum number of moves required to solve a Tower of Hanoi puzzle is 2n - 1. Where n is the number of disks. If the number of disks is 3, then minimum number of moves required are 23 - 1 = 7
Q 4 - Binary search tree has best case run-time complexity of Ο(log n). What could the worst case?
Answer : A
Explanation
In case where binary search tree is left or right intended, the worst case can be Ο(n)
Q 5 - Which method can find if two vertices x & y have path between them?
Answer : C
Explanation
By using both BFS and DFS, a path between two vertices of a connected graph can be determined.
Q 6 - What will be the running-time of Dijkstra's single source shortest path algorithm, if the graph G(V,E) is stored in form of adjacency list and binary heap is used −
Answer : C
Explanation
The runing time will be Ο(|E|+|V| log |V|) when we use adjacency list and binary heap.
Q 7 - The Θ notation in asymptotic evaluation represents −
Answer : A
Explanation
Θ represents average case. Ο represents worst case and Ω represents base case.
Q 8 - In a min heap
A - minimum values are stored.
B - child nodes have less value than parent nodes.
Answer : C
Explanation
In a min heap, parent nodes store lesser values than child nodes. The minimum value of the entire heap is stored at root.
Answer : B
Explanation
AVL rotations have complexity of Ο(log n)
Q 10 - Apriori analysis of an algorithm assumes that −
A - the algorithm has been tested before in real environment.
B - all other factors like CPU speed are constant and have no effect on implementation.
Answer : B
Explanation
Efficiency of algorithm is measured by assuming that all other factors e.g. processor speed, are constant and have no effect on implementation.