Monday, June 1, 2020

Data structures and algorithms MCQ with answers 03

Data structures and algorithms multiple choice questions with answers, important interview questions in data structures, data structures questions for entrance exams


Data Structures and Algorithms Multiple Choice Questions

SET 03


1. Which data structure represents a waiting line and limits insertions to be made at the back of the data structure and limits removals to be made from the front?

(a) Stack.

(b) Queue.

(c) Binary tree.

(d) Linked list.

 

2. What is the in-order traversal of the following binary tree?


(a) Q M H F G P S R W U

(b) G F H P M R U W S Q

(c) F G H M P Q R S U W

(d) None of the above

 

3. n3/2 is

(a) O(n2)

(b) O(nlog n)

(c) Θ(n2)

(d) Ω(n)

 

4. Assume A is an array-based tree with 70 nodes. What is the index of the first leaf node?

(a) 70

(b) 35

(c) 17

(d) None of the above

 

5. Given a collection of algorithms that runs on O(1), O(n log n), O(n), O(n2), O(log n), O(n!), order the algorithms from fastest to slowest.

(a) O(1), O(n log n), O(n), O(n2), O(log n), O(n!)

(b) O(1), O(log n), O(n), O(n log n), O(n2), O(n!)

(c) O(1), O(log n), O(n log n), O(n), O(n2), O(n!)

(d) None of the above

 

6. Finding the max element in an unordered stack would require

(a) O(1) operations

(b) O(log n) operations

(c) O(n) operations.

(d) None of the above

 

7. What is the complexity of determining all duplicates in a sorted singly linked list?

(a) O(n)

(b) O(n2)

(c) O(n!)

(d) O(n log n)

 

8. What is the complexity of algorithm that is determining all possible paths between n cities?

(a) O(n)

(b) O(n2)

(c) O(n!)

(d) O(n log n)

 

9. What is the output of the following code if the values of a and b are 3 and 9 respectively?

public int foo(int a, int b)

{

if (a%b == 0)

return b;

else

return foo(b, a%b);

}

(a) 1

(b) 3

(c) 6

(d) 9

 

10. Which is the best data structure to implement the following?

“A list must be maintained so that any element can be accessed randomly”

(a) Queue

(b) Array

(c) Stack

(d) All of the above

 

Answer:

1 – (b), 2 – (c), 3 – (a) & (d), 4 – (b), 5 – (b), 6 – (c), 7 – (d), 8 – (c), 9 – (b), 10 – (b)


*************************

Interview questions and answers in data structure and algorithms

DSA quiz questions with answers explained

Solved true or false questions in DSA

Practice questions in data structures

Entrance exam questions with answers in Data structures for Tamilnadu engineering entrance

Entrance exam questions with answers in Data structures for IIT-JEE entrance exam

Entrance exam questions with answers in Data structures for JNTU engineering entrance


No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery