Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

What approach is being followed in Floyd Warshall Algorithm?

A. greedy technique
B. dynamic programming
C. linear programming
D. backtracking
Answer» C. linear programming
2.

Floyd Warshall’s Algorithm can be applied on

A. undirected and unweighted graphs
B. undirected graphs
C. directed graphs
D. acyclic graphs
Answer» D. acyclic graphs
3.

Floyd Warshall’s Algorithm is used for solving

A. all pair shortest path problems
B. single source shortest path problems
C. network flow problems
D. sorting problems
Answer» B. single source shortest path problems
4.

A graph is said to have a negative weight cycle when?

A. the graph has 1 negative weighted edge
B. the graph has a cycle
C. the total weight of the graph is negative
D. the graph has 1 or more negative weighted edges
Answer» D. the graph has 1 or more negative weighted edges
5.

What is the running time of the Floyd Warshall Algorithm?

A. big-oh(v)
B. theta(v2)
C. big-oh(ve)
D. theta(v3)
Answer» E.
6.

Bellmann Ford Algorithm is an example for

A. dynamic programming
B. greedy algorithms
C. linear programming
D. branch and bound
Answer» B. greedy algorithms
7.

Bellmann Ford algorithm was first proposed by

A. richard bellmann
B. alfonso shimbe
C. lester ford jr
D. edward f. moore
Answer» C. lester ford jr
8.

Bellmann Ford Algorithm can be applied for

A. undirected and weighted graphs
B. undirected and unweighted graphs
C. directed and weighted graphs
D. all directed graphs
Answer» D. all directed graphs
9.

What is the basic principle behind Bellmann Ford Algorithm?

A. interpolation
B. extrapolation
C. regression
D. relaxation
Answer» E.
10.

Dijikstra’s Algorithm is more efficient than Bellmann Ford Algorithm.

A. true
B. false
Answer» B. false
11.

How many times the for loop in the Bellmann Ford Algorithm gets executed?

A. v times
B. v-1
C. e
D. e-1
Answer» C. e
12.

What is the running time of Bellmann Ford Algorithm?

A. o(v)
B. o(v2)
C. o(elogv)
D. o(ve)
Answer» E.
13.

How many solution/solutions are available for a graph having negative weight cycle?

A. one solution
B. two solutions
C. no solution
D. infinite solutions
Answer» D. infinite solutions
14.

Bellmann Ford algorithm is used to indicate whether the graph has negative weight cycles or not.

A. true
B. false
Answer» B. false
15.

Bellmann ford algorithm provides solution for                          problems.

A. all pair shortest path
B. sorting
C. network flow
D. single source shortest path
Answer» E.
16.

How many priority queue operations are involved in Dijkstra’s Algorithm?

A. 1
B. 3
C. 2
D. 4
Answer» C. 2
17.

Dijkstra’s Algorithm is the prime example for

A. greedy algorithm
B. branch and bound
C. back tracking
D. dynamic programming
Answer» B. branch and bound
18.

Dijkstra’s Algorithm run on a weighted, directed graph G={V,E} with non-negative weight function w and source s, terminates with d[u]=delta(s,u) for all vertices u in V.

A. true
B. false
Answer» B. false
19.

The running time of Bellmann Ford algorithm is lower than that of Dijkstra’s Algorithm.

A. true
B. false
Answer» C.
20.

What is running time of Dijkstra’s algorithm using Binary min- heap method?

A. o(v)
B. o(vlogv)
C. o(e)
D. o(elogv)
Answer» E.
21.

The maximum number of times the decrease key operation performed in Dijkstra’s algorithm will be equal to

A. total number of vertices
B. total number of edges
C. number of vertices – 1
D. number of edges – 1
Answer» C. number of vertices – 1
22.

How many times the insert and extract min operations are invoked per vertex?

A. 1
B. 2
C. 3
Answer» B. 2
23.

Which of the following is the most commonly used data structure for implementing Dijkstra’s Algorithm?

A. max priority queue
B. stack
C. circular queue
D. min priority queue
Answer» E.
24.

Which of the following is false about Prim’s algorithm?

A. it is a greedy algorithm
B. it constructs mst by selecting edges in increasing order of their weights
C. it never accepts cycles in the mst
D. it can be implemented using the fibonacci heap
Answer» C. it never accepts cycles in the mst
25.

Prim’s algorithm can be efficiently implemented using            for graphs with greater density.

A. d-ary heap
B. linear search
C. fibonacci heap
D. binary search
Answer» B. linear search
26.

The travelling salesman problem can be solved using

A. a spanning tree
B. a minimum spanning tree
C. bellman – ford algorithm
D. dfs traversal
Answer» C. bellman – ford algorithm
27.

Which of the following algorithms is similar to a quickhull algorithm?

A. merge sort
B. shell sort
C. selection sort
D. quick sort
Answer» E.
28.

                       is a method of constructing a smallest polygon out of n given points.

A. closest pair problem
B. quick hull problem
C. path compression
D. union-by-rank
Answer» C. path compression
29.

Which of the following strategies does the following diagram depict?

A. divide and conquer strategy
B. brute force
C. exhaustive search
D. backtracking
Answer» C. exhaustive search
30.

Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.

A. true
B. false
Answer» B. false
31.

Which of the following is similar to Euclidean distance?

A. manhattan distance
B. pythagoras metric
C. chebyshev distance
D. heuristic distance
Answer» C. chebyshev distance
32.

What is the result of the recurrences which fall under the extended second case of Master’s theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc(log n)k?

A. none of the below
B. t(n) = o(nc log n)
C. t(n)= o(nc (log n)k+1
D. t(n) = o(n2)
Answer» D. t(n) = o(n2)
33.

What is the result of the recurrences which fall under third case of Master’s theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc?

A. none of the below
B. t(n) = o(nc log n)
C. t(n) = o(f(n))
D. t(n) = o(n2)
Answer» D. t(n) = o(n2)
34.

We can solve any recurrence by using Master’s theorem.

A. true
B. false
Answer» C.
35.

What is the result of the recurrences which fall under second case of Master’s theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc?

A. none of the below
B. t(n) = o(nc log n)
C. t(n) = o(f(n))
D. t(n) = o(n2)
Answer» C. t(n) = o(f(n))
36.

Recurrence equation formed for the tower of hanoi problem is given by

A. t(n) = 2t(n-1)+n
B. t(n) = 2t(n/2)+c
C. t(n) = 2t(n-1)+c
D. t(n) = 2t(n/2)+n
Answer» D. t(n) = 2t(n/2)+n
37.

What is the objective of tower of hanoi puzzle?

A. to move all disks to some other rod by following rules
B. to divide the disks equally among the three rods by following rules
C. to move all disks to some other rod in random order
D. to divide the disks equally among three rods in random order
Answer» B. to divide the disks equally among the three rods by following rules
38.

Recursive approach to find power of a number is preferred over iterative approach.

A. true
B. false
Answer» C.
39.

What is the least time in which we can raise a number x to power y?

A. o(x)
B. o(y)
C. o(log x)
D. o(log y)
Answer» E.
40.

Recursive program to raise an integer x to power y uses which of the following algorithm?

A. dynamic programming
B. backtracking
C. divide and conquer
D. greedy algorithm
Answer» D. greedy algorithm
41.

Can binary search be applied on a sorted linked list in O(Logn) time?

A. no
B. yes
Answer» B. yes
42.

What is the advantage of iterative code for finding power of number over recursive code?

A. iterative code requires less time
B. iterative code requires less space
C. iterative code is more compiler friendly
D. it has no advantage
Answer» C. iterative code is more compiler friendly
43.

What is the time complexity of the above recursive implementation of binary search?

A. o(n)
B. o(2n)
C. o(logn)
D. o(n!)
Answer» D. o(n!)
44.

Consider the array {1,1,1,1,1}. Select the wrong option?

A. iterative linear search can be used to search for the elements in the given array
B. recursive linear search can be used to search for the elements in the given array
C. recursive binary search can be used to search for the elements in the given array
D. no method is defined to search for an element in the given array
Answer» E.
45.

Which of the following techniques can be used to search an element in an unsorted array?

A. iterative linear search
B. recursive binary search
C. iterative binary search
D. normal binary search
Answer» B. recursive binary search
46.

What is the number of swaps required to sort the array arr={5,3,2,4,1} using recursive selection sort?

A. 0
B. 1
C. 2
D. 3
Answer» D. 3
47.

Which of the following methods can be used to find the largest and smallest number in a linked list?

A. recursion
B. iteration
C. both recursion and iteration
D. impossible to find the largest and smallest numbers
Answer» D. impossible to find the largest and smallest numbers
48.

Which of the following methods can be used to find the largest and smallest element in an array?

A. recursion
B. iteration
C. both recursion and iteration
D. no method is suitable
Answer» D. no method is suitable
49.

What is the average case time complexity of recursive selection sort?

A. o(n)
B. o(n log n)
C. o(n2)
D. o(log n)
Answer» D. o(log n)
50.

What is the bidirectional variant of selection sort?

A. cocktail sort
B. bogo sort
C. gnome sort
D. bubble sort
Answer» B. bogo sort