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.

Questions and Answers

Answer : D


Polish Notation

Q 2 - Postfix expression is just a reverse of prefix expression.

A - True

B - False

Answer : B


Expression notations are not reverse (or so) of each other, rather operators used in the expression have different arrangements.

Q 3 - The following formula will produce

Fn = Fn-1 + Fn-2

A - Armstrong Number

B - Fibonacci Series

C - Euler Number

D - Prime Number

Answer : B


Fibonacci Series generates subsequent number by adding two previous numbers.

Q 4 - If the array is already sorted, which of these algorithms will exhibit the best performance

A - Merge Sort

B - Insertion Sort

C - Quick Sort

D - Heap Sort

Answer : B


Insertion sort, as it should then work in linear way.

Answer : D


Recursion is just an other way to write the same program code. But calling a function again and again makes it expensive in terms of memory, CPU cycles and delivers less performance.

Q 6 - Match the following −

(1) Bubble Sort(A) Ο(n)
(2) Shell Sort(B) Ο(n2)
(3) Selection Sort(C) Ο(n log n)

A - 1 → A,  2 → B,  3 → C

B - 1 → B,  2 → C,  3 → A

C - 1 → A,  2 → C,  3 → B

D - 1 → B,  2 → A,  3 → C

Answer : B


Q 7 - Index of arrays in C programming langauge starts from

A - 0

B - 1

C - either 0 or 1

D - undefined

Answer : A


Arrays, in C, starts from 0 which is mapped to its base address.

Q 8 - Tower of hanoi is a classic example of

A - divide and conquer

B - recursive approach

C - B but not A

D - Both A & B

Answer : D


The recursive approach of tower of hanoi uses divide and conquer method.

Q 9 - If locality is a concern, you can use _______ to traverse the graph.

A - Breadth First Search

B - Depth First Search

C - Either BFS or DFS

D - None of the above!

Answer : B


DFS is a better choice when locality-wise items are concerned.

Answer : B


Efficiency of algorithm is measured by assuming that all other factors e.g. processor speed, are constant and have no effect on implementation.