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

Q 1 - For a binary search algorithm to work, it is necessary that the array (list) must be

A - sorted

B - unsorted

C - in a heap

D - popped out of stack

Answer : A

Explanation

As binary search divides the list and selects a the sub-list to extend search based on comparison of values, it becomes necessary that the array (list) must be in sorted form.

Q 2 - Queue data structure works on

A - LIFO

B - FIFO

C - FILO

D - none of the above

Answer : B

Explanation

In queue, data item inserted first, will be available first and data item inserted last will be available in the last. FIFO stands for First In First Out and is a correct answer.

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

Explanation

Fibonacci Series generates subsequent number by adding two previous numbers.

Q 4 - Visiting root node after visiting left and right sub-trees is called

A - In-order Traversal

B - Pre-order Traversal

C - Post-order Traveral

Answer : C

Explanation

In Post-order traversal method, the root node is visited last, hence the name.

Q 5 - Which of the following has search effeciency of Ο(1) −

A - Tree

B - Heap

C - Hash Table

D - Linked-List

Answer : C

Explanation

A simple hash table has the Ω(1) efficiency.

Q 6 - Time required to merge two sorted lists of size m and n, is

A - Ο(m | n)

B - Ο(m + n)

C - Ο(m log n)

D - Ο(n log m)

Answer : B

Explanation

The time required to merge two sorted list is Ο(m + n).

Q 7 - Linked list search complexity is

A - Ο(1)

B - Ο(n)

C - Ο(log n)

D - Ο(log log n)

Answer : B

Explanation

Linked lists has search complexity of Ο(n).

Q 8 - If there's no base criteria in a recursive program, the program will

A - not be executed.

B - execute until all conditions match.

C - execute infinitely.

D - obtain progressive approach.

Answer : C

Explanation

Without a base criteria and progressive approach, a recursion is just an infinite iteration.

Answer : A

Explanation

Shell sort uses insertion sort when interval value is 1.

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.

data_structures_algorithms_questions_answers.htm
Advertisements