• Tutorials
  • Courses
  • Tracks

Top 50 Algorithms MCQs with Answers

Last Updated :
Discuss
Comments

Question 1

What is the time complexity of Floyd–Warshall algorithm to calculate all pair shortest path in a graph with n vertices?

  • O(n2log(n))

  • Theta(n2log(n))

  • Theta(n4)

  • Theta(n3)

Question 2

A problem in NP is NP-complete if  

  • It can be reduced to the 3-SAT problem in polynomial time

  • The 3-SAT problem can be reduced to it in polynomial time

  • It can be reduced to any other problem in NP in polynomial time

  • Some problem in NP can be reduced to it in polynomial time

Question 3

 External entities in DFD are shown by:-

  • Ellipse

  • Rectangle

  • Circle

  • Hexagon

Question 4

If we use Radix Sort to sort n integers in the range (nk/2,nk], for some k>0 which is independent of n, the time taken would be?

  • Θ(n)

  • Θ(kn)

  • Θ(nlogn)

  • Θ(n2)

Question 5

Which of the following is not true about comparison-based sorting algorithms?

  • The minimum possible time complexity of a comparison-based sorting algorithm is O(n(log(n)) for a random input array

  • Any comparison based sorting algorithm can be made stable by using position as a criteria when two elements are compared

  • Counting Sort is not a comparison based sorting algorithm

  • Heap Sort is not a comparison based sorting algorithm.

Question 6

Which of the following is not O(n2)?

  • (15) * n2

  • n1.98

  • n3/(sqrt(n))

  • (20) * n2

Question 7

The following statement is valid. log(n!) = [Tex]\theta [/Tex](n log n).

  • True

  • False

Question 8

Which of the following algorithms sort n integers, having the range 0 to (n2 - 1), in ascending order in O(n) time ?

  • Selection sort
  • Bubble sort
  • Radix sort
  • Insertion sort

Question 9

Which of the following algorithm design technique is used in merge sort?

  • Greedy method

  • Backtracking

  • Dynamic programming

  • Divide and Conquer

Question 10

Quick sort is run on 2 inputs shown below to sort in ascending order

A. 1, 2, 3……n
B. n, n – 1, n – 2 …… 1

Let C1 and C2 be the number of comparisons made for A and B respectively. Then

  • C1 > C2

  • C1 = C2

  • C1 < C2 
     

  • Cannot say anything for arbitrary n

There are 50 questions to complete.

Take a part in the ongoing discussion