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

Explanation

Polish Notation

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

A - queue

B - stack

C - list

D - none of the above

Answer : A

Explanation

Queue is used for breadth first traversal whereas stack is used for depth first traversal.

Q 3 - Minimum number of queues required for priority queue implementation?

A - 5

B - 4

C - 3

D - 2

Answer : D

Explanation

Minimum number of queues required for priority queue implementation is two. One for storing actual data and one for storing priorities.

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

Explanation

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

Answer : C

Explanation

As trees do not have loops, they are easier to traverse.

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 −

A - Ο(|V|2)

B - Ο(|V| log |V|)

C - Ο(|E|+|V| log |V|)

D - None of these

Answer : C

Explanation

The runing time will be Ο(|E|+|V| log |V|) when we use adjacency list and binary heap.

Q 7 - A queue data-structure can be used for −

A - expression parsing

B - recursion

C - resource allocation

D - all of the above

Answer : C

Explanation

Queues can be used for limited resource allocation. For other operations, stacks are used.

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 - Re-balancing of AVL tree costs

A - Ο(1)

B - Ο(log n)

C - Ο(n)

D - Ο(n2)

Answer : B

Explanation

AVL rotations have complexity of Ο(log n)

Answer : B

Explanation

In this analysis, actual statistics like running time and space required, are collected.

data_structures_algorithms_questions_answers.htm
Advertisements