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 - 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 - 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 - Travelling salesman problem is an example of

A - Dynamic Algorithm

B - Greedy Algorithm

C - Recursive Approach

D - Divide & Conquer

Answer : B

Explanation

Travelling salesman is an example of greedy algorithm. Greedy algorithms tries to find localized optimum solution which may eventually land in globally optimized solutions.

Q 4 - What could be the worst case height of an AVL tree?

A - 0.97 log n

B - 2.13 log n

C - 1.44 log n

D - n2 log n

Answer : C

Explanation

Worst case height of an AVL tree is 1.44 log n

Answer : A

Explanation

In one iteration of Bubble sort, the maximum of the set in hand is moved at the end of the unsorted list. Hence one less comparison.

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 - Index of arrays in C programming langauge starts from

A - 0

B - 1

C - either 0 or 1

D - undefined

Answer : A

Explanation

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

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 - The following sorting algorithms maintain two sub-lists, one sorted and one to be sorted −

A - Selection Sort

B - Insertion Sort

C - Merge Sort

D - both A &am; B

Answer : D

Explanation

Both selection sort and insertion sort maintains two sublists and then checks unsorted list for next sorted element.

Answer : B

Explanation

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

data_structures_algorithms_questions_answers.htm
Advertisements