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 - Which one of the below is not divide and conquer approach?

A - Insertion Sort

B - Merge Sort

C - Shell Sort

D - Heap Sort

Answer : B

Explanation

Among the options, only Merge sort divides the list in sub-list, sorts and then merges them together

Q 2 - What data structure is used for depth first traversal of a graph?

A - queue

B - stack

C - list

D - none of the above

Answer : B

Explanation

Stack is used for depth first traversal whereas queue is used for breadth first traversal

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 - The minimum number of edges required to create a cyclid graph of n vertices is

A - n

B - n - 1

C - n + 1

D - 2n

Answer : A

Explanation

To make a graph cyclic, the number of edges should be at least equal to vertices in the graph.

Q 5 - Apriory algorithm analysis does not include −

A - Time Complexity

B - Space Complexity

C - Program Complexity

D - None of the above!

Answer : C

Explanation

Algorithms are independent of programming languages, hence, program complexity is not a part of algorithm analysis.

Q 6 - Quick sort running time depends on the selection of

A - size of array

B - pivot element

C - sequence of values

D - none of the above!

Answer : B

Explanation

If the pivot element is balanced, quick sort running time will be less.

Answer : B

Explanation

Recursion uses stack but the main reason is, every recursive call needs to be stored separately in the memory.

Answer : A

Explanation

BST does not care about complete binary tree properties.

Q 10 - In conversion from prefix to postfix using stack data-structure, if operators and operands are pushed and popped exactly once, then the run-time complexity is −

A - Ο(1)

B - Ο(n)

C - Ο(log n)

D - Ο(n2)

Answer : B

Explanation

Infix to postfix conversion using stack will have run time complexity of Ο(n).

data_structures_algorithms_questions_answers.htm
Advertisements