Multiple Choice Questions (MCQs) related to** Data Structures Algorithms**. You will have to read all the given answers. A comprehensive database of more than** data structure quizzes online,** test your knowledge with data structure quiz questions. Here you will get **DS (Data Structure) Quiz **as Multiple Choice Questions And Answers for you next job or exam.

### Q1.Two main measures for the efficiency of an algorithm are

A. Processor and memory

B. Complexity and capacity

C. Time and space

D. Data and space

Option C – Time and space

### Q2.The Average case occur in linear search algorithm

A. When Item is somewhere in the middle of the array

B. When Item is not in the array at all

C. When Item is the last element in the array

D. When Item is the last element in the array or is not there at all

Option A – When Item is somewhere in the middle of the array

### Q3.In a Stack the command to access nth element from the top of the stacks will be

A. S[Top-n]

B. S [Top+n]

C. S [top-n-1]

D. None of the above

Option A – S[Top-n]

### Q4.The result of evaluating prefix expression */b+-dacd, where a = 3, b = 6, c = 1, d = 5 is

A. 0

B. 5

C. 10

D.15

Option C – 10

### Q5.If the out degree of every node is exactly equal to M or 0 and the number of nodes at level K is Mk-1 [consider root at level 1], then tree is called as (i) Full m-ary try (ii) Complete m-ary tree (iii)Positional m-ary tree

A. Only (i)

B. Only (ii)

C. Both (i) and (ii)

D. Both (ii) and (III)

Option C – Both (i) and (ii)

### Q6.If all c(i, j )’s and r(i, j)’s are calculated, then OBST algorithm in worst case takes one of the following time.

A. O(n log n)

B. O(n^3)

C. O(n^2)

D. O(log n)

Option B – O(n^3)

### Q7.Recursive algorithms are based on

A. Divideand conquer approach

B. Top-down approach

C. Bottom-up approach

D. Hierarchical approach

Option C – Bottom-up approach

### Q8.The time complexity of the normal quick sort, randomized quick sort algorithms in the worst case is

A. O(n^2), O(n log n)

B.O(n^2), O(n^2)

C.O(n log n), O(n^2)

D. O(n log n), O(n log n)

Option B – O(n^2), O(n^2)

### Q9.Worst case efficiency of binary search is

A. log2 n + 1

B. n

C. 2n

D. log n.

Option A – log2 n + 1

### Q10.For defining the best time complexity, let f (n) = log n and g (n) = √n, *_*

*_*

A. f (n) Ω(g(n)), but g(n) Ω (f(n))

B. f (n) Ω(g(n)), but g(n) Ω (f(n))

C. f (n) Ω(g(n)), and g(n) Ω (f(n))

D. f (n) Ω(g(n)), and g(n) Ω (f(n))

Option A – f (n) Ω(g(n)), but g(n) Ω (f(n))

### Q11.Let f, t: N→R 0, and t (n) O (f (n)) iff t(n)≤ c.f (n) where cis positive real constant andn≥ no, then no is **_**

**_**A. Upper bound

B.Lower bound

C. Duality value

D. Threshold value

Option B – Lower bound

### Q12.The Knapsack problem where the objective function is to minimize the profit is **__**

A.Greedy

B. Dynamic 0 / 1

C. Back tracking

D. Branch & Bound 0/1

Option D – Branch & Bound 0/1

### Q13.The Hamiltonian cycles problem uses the following line of code to generate a next vertex, provided x[ ] is a global array and kth vertex is under consideration:

A. x[k] (x[k] + 1) mod n

B. x[k] (x[k]) mod (n)

C. x[k] (x[k] + 1) mod (n+1)

D. x[k] x[k+1] mod n

Option C – x[k] (x[k] + 1) mod (n+1)

### Q14.For 0/1 KNAPSACK problem, the algorithm takes *__* amount of time for memory table, and ______time to determine the optimal load, for N objects and W as the capacity of KNAPSACK.

*__*

A. O(N+W), O(NW)

B. O(NW),O(N+W)

C. O(N),O(NW)

D. O(NW),O(N)

Option B – O(NW),O(N+W)

### Q15.What is the type of the algorithm used in solving the 8 Queens problem?

A. Backtracking

B. Dynamic

C. Branch and Bound

D. D and C

Option A – Backtracking

### Q16.Read the following statements carefully and pick the correct option: I. The worst time complexity of the Floyd’s algorithm is O(n3). II. The worst time complexity of the Warshall’s algorithm is O(n3).

A. (I) is false but (II) is true

B. (I) is true but (II) is false

C. Both (I) and (II) are true

D. (I) is true and (II) is not true always

Option C – Both (I) and (II) are true

### Q17.For the bubble sort algorithm, what is the time complexity of the best/worst case? (assume that the computation stops as soon as no more swaps in one pass)

A. best case: O(n) worst case: O(n**n) best case: *

B. O(n) worst case: O(n*log(n))

C. best case: O(n**log(n)) worst case: O(n*log(n))

D. best case: O(n**log(n)) worst case: O(n**n)

Option A – best case: O(n) worst case: O(n*n) best case:

### Q18.If f,t: N→ R+, then t (n) Ω (f (n)), iff f(n) O (t (n)) is known as

A. Limit rule

B. Rule of inference

C. Duality rule

D. Rule of consequences

Option B – Rule of inference

### Q19.Find the odd one out from the following categories of algorithms.

A. TVSP

B. N-Queens

C. 15-Puzzle

D. Bin-Packing.

Option D – Bin-Packing

### Q20.The mathematical definition for Omega can be defined as, provided f,g:NR+ and c is a positive constant and n > n0,

A. f(n) ≥ c. g(n) n

B. f(n) = c. g(n) n

C. f(n) ≥ c + g(n) n

D. f(n) = c + g(n) n

Option A – f(n) ≥ c. g(n) n

### Q21.The notation is

A. Symmetric

B. Reflexive

C. Transitive

D. (a), (b) and (c) above.

Option D – (a), (b) and (c) above.

### Q22.A problem L is NP-complete iff L is NP-hard and

A. L ≈ NP

B. L α NP

C. L ε NP

D. L = NP

Option c – L ε NP

### Q23.How many nodes are there in a full state space tree with n = 6?

A.65

B. 64

C. 63

D. 32

Option c – 63

### Q24.In Knapsack problem, the best strategy to get the optimal solution, where Pi, Wi is the Profit, Weight associated with each of the Xith object respectively is to

A. Arrange the values Pi/Wi in ascending order

B. Arrange the values Pi/Xi in ascending order

C. Arrange the values Pi/Wi in descending order

D. Arrange the values Pi/Xi in descending order

Option D – Arrange the values Pi/Xi in descending order

### Q25.Which of the following are essential statement types for describing algorithms?

A. Sequence

B. Selection

C. Repetition

D. All the above

Option D – All the above