GATE Computer Science Engineering(CSE) 2027 Test: Algorithms Free Online


MCQ Practice Test & Solutions: Test: Algorithms (10 Questions)

You can prepare effectively for Computer Science Engineering (CSE) GATE Computer Science Engineering(CSE) 2027 Mock Test Series with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: Algorithms". These 10 questions have been designed by the experts with the latest curriculum of Computer Science Engineering (CSE) 2026, to help you master the concept.

Test Highlights:

  • - Format: Multiple Choice Questions (MCQ)
  • - Duration: 30 minutes
  • - Number of Questions: 10

Sign up on EduRev for free to attempt this test and track your preparation progress.

Test: Algorithms - Question 1

Which of the following standard algorithms is not Dynamic Programming based.

Detailed Solution: Question 1

Prim’s Minimum Spanning Tree is a Greedy Algorithm. All other are dynamic programming based.

Test: Algorithms - Question 2

Which of the following is not O(n^2)?

Detailed Solution: Question 2

The order of growth of option c is n2.5 which is higher than n2.

Test: Algorithms - Question 3

Consider the following C program

int main() 

   int x, y, m, n; 

   scanf ("%d %d", &x, &y); 

   /* x > 0 and y > 0 */

   m = x; n = y; 

   while (m != n) 

   { 

      if(m>n) 

         m = m - n; 

      else

         n = n - m; 

   } 

   printf("%d", n); 

}

What does the program compute?

Detailed Solution: Question 3

This is an implementation of Euclid’s algorithm to find GCD

Test: Algorithms - Question 4

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

Detailed Solution: Question 4

Floyd–Warshall algorithm uses three nested loops to calculate all pair shortest path. So, time complexity is θ(n^3).

Test: Algorithms - Question 5

Consider two strings A = “qpqrr” and B = “pqprqrp”. Let x be the length of the longest common subsequence (not necessarily contiguous) between A and B and let y be the number of such longest common subsequences between A and B. Then x + 10y = ___.

Detailed Solution: Question 5

//The LCS is of length 4. There are 3 LCS of length 4 “qprr”, “pqrr” and qpqr

A subsequence is a sequence that can be derived from another sequence by selecting zero or more elements from it, without changing the order of the remaining elements.
Subsequence need not be contiguous.
Since the length of given strings A = “qpqrr” and B = “pqprqrp” are very small, we don’t need to build a 5×7 matrix and solve it using dynamic programming.
Rather we can solve it manually just by brute force.
We will first check whether there exist a subsequence  of length 5 since min_length(A,B) = 5.

Since there is no subsequence , we will now check for length 4. “qprr”, “pqrr” and “qpqr” are common in both strings.

X = 4 and Y = 3

X + 10Y = 34

Test: Algorithms - Question 6

Let SHAM3 be the problem of finding a Hamiltonian cycle in a graph G = (V,E) with V divisible by 3 and DHAM3 be the problem of determining if a Hamiltonian cycle exists in such graphs. Which one of the following is true?

Detailed Solution: Question 6

The problem of finding whether there exist a Hamiltonian Cycle or not is NP Hard and NP Complete Both.

Finding a Hamiltonian cycle in a graph G = (V,E) with V divisible by 3 is also NP Hard.

Test: Algorithms - Question 7

Consider the following two problems of graph.
1. Given a graph, find if the graph has a cycle that visits every vertex exactly once except the first visited vertex which must be visited again to complete the cycle.
2. Given a graph, find if the graph has a cycle that visits every edge exactly once.
Which of the following is true about above two problems.

Detailed Solution: Question 7

Problem 1 is Hamiltonian Cycle problem which is a famous NP Complete problem.

Problem 2 is Euler Circuit problem which is solvable in Polynomial time.

Test: Algorithms - Question 8

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?

Detailed Solution: Question 8

Radix sort time complexity = O(wn)
for n keys of word size= w
=>w = log(nk)
O(wn)=O(klogn.n)
=> kO(nlogn)

Test: Algorithms - Question 9

Which of the following is not a backtracking algorithm?

Detailed Solution: Question 9

Knight tour problem, N Queen problem and M coloring problem involve backtracking. Tower of hanoi uses simple recursion.

Test: Algorithms - Question 10

A system wherein items are added from one and removed from the other end.

Detailed Solution: Question 10

 In a queue, the items are inserted from the rear end and deleted from the front end.

56 docs|215 tests
Information about Test: Algorithms Page
In this test you can find the Exam questions for Test: Algorithms solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Algorithms, EduRev gives you an ample number of Online tests for practice
Download as PDF