Data Structures Algorithms Online Quiz


Advertisements


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 - A procedure that calls itself is called

A - illegal call

B - reverse polish

C - recursive

D - none of the above

Answer : C

Explanation

In recursion, a procedure calls itself, either directly or by calling a procedure which in turn calls it.

Q 2 - Which one of the below mentioned is linear data structure −

A - Queue

B - Stack

C - Arrays

D - All of the above

Answer : D

Explanation

All mentioned data structures are linear in nature.

Q 3 - Which of the following asymptotic notation is the worst among all?

A - Ο(n+9378)

B - Ο(n3)

C - nΟ(1)

D - 2Ο(n)

Answer : B

Explanation

Ο(n+9378) is n dependent

Ο(n3) is cubic

nΟ(1) is polynomial

2Ο(n) is exponential

Q 4 - Binary search tree has best case run-time complexity of Ο(log n). What could the worst case?

A - Ο(n)

B - Ο(n2)

C - Ο(n3)

D - None of the above

Answer : A

Explanation

In case where binary search tree is left or right intended, the worst case can be Ο(n)

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.

Answer : D

Explanation

Binary heap heapify operation has time-complexity of Ο(n), while other operations have time-complexity of Ο(1) only.

Answer : A

Explanation

After applying node.next -> node.next.next; we will not have node.next stored anywhere if not explicitly mentioned.

Q 8 - Program with highest run-time complexity is

A - Tower of Hanoi

B - Fibonacci Series

C - Prime Number Series

D - None of the above

Answer : A

Explanation

Tower of hanoi has the highest run time complexity

Q 9 - A pivot element to partition unsorted list is used in

A - Merge Sort

B - Quick Sort

C - Insertion Sort

D - Selection Sort

Answer : B

Explanation

The quick sort partitions an array using pivot element and then calls itself recursively twice to sort the resulting two subarray.

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