## MCQ On Complexity Algorithms - Data Structure

21. if for an algorithm time complexity is given by O(n2) then complexity will:

A. constant

B. quardratic

C. exponential

D. none of the mentioned

View Answer

Ans : B

Explanation: The growth rate of that function will be quadratic therefore complexity will be quardratic..

22. If for an algorithm time complexity is given by O((3/2)^n) then complexity will:

A. constant

B. quardratic

C. exponential

D. none of the mentioned

View Answer

Ans : C

Explanation: The growth rate of that function will be exponential therefore complexity will be exponential.

23. the time complexity of binary search is given by:

A. constant

B. quardratic

C. exponential

D. none of the mentioned

View Answer

Ans : D

Explanation: It is O(log2n), therefore complexity will be logarithmic.

24. The time complexity of linear search is given by:

A. O(log2n)

B. O(1)

C. exponential

D. none of the mentioned

View Answer

Ans : D

Explanation: It is O(n), therefore complexity will be linear.

25. Which algorithm is better for sorting between bubble sort and quicksort?

A. bubble sort

B. quick sort

C. both are equally good

D. none of the mentioned

View Answer

Ans : B

Explanation: Running time of quicksort is logarithmic whereas for bubble sort it is quardratic

26. State true or false

Time complexity of binary search algorithm is constant

A. True

B. False

View Answer

Ans : B

Explanation: It is O(log2n), therefore complexity will be logarithmic.

27. Two main measures for the efficiency of an algorithm are

A. Time and space

B. Processor and memory

C. Complexity and capacity

D. Data and space

View Answer

28. Which is the best data structure for round robin algorithm for CPU scheduling?

A. Stack implemented using queues

B. Doubly linked list

C. Circular queue

D. Queue implemented using stacks

View Answer

29. Which algorithm is having highest space complexity?

A. Bubble sort

B. Insertion Sort

C. Quick Sort

D. Merge Sort

View Answer

30. If the array is already sorted, then the running time for merge sort is: ?

A. O(1)

B. O(n*log n)

C. O(n)

D. O(n^2)

View Answer

**Also Check : **

Discussion