Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 48 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

1.

According to Gabriel lame, how many steps does Euclid's algorithm require to solve a problem?

A. Less than five times the number of digits
B. More than five times the number of digits
C. Less than two times the number of digits
D. More than two times the number of digits
Answer» B. More than five times the number of digits
2.

The dictionary ordering of elements is known as?

A. Lexicographical order
B. Colexicographical order
C. Well order
D. Sorting
Answer» B. Colexicographical order
3.

Who demonstrated the difference in numerical stability?

A. Strassen
B. Bailey
C. Lederman
D. Higham
Answer» E.
4.

What is the total running time of Euclid's algorithm?

A. O(N)
B. O(N log M)
C. O(N log N)
D. O(log N +1)
Answer» B. O(N log M)
5.

What is the time complexity of Heap's algorithm?

A. O(n log n)
B. O(n2)
C. O(n*n!)
D. O(n!)
Answer» E.
6.

Counting intersections can be done using the inclusion-exclusion principle only if it is combined with De Morgan's laws of complementing.

A. true
B. false
Answer» B. false
7.

Who discussed techniques for reducing the memory requirements for Strassen's algorithm?

A. Strassen
B. Lederman
C. Bailey
D. Higham
Answer» D. Higham
8.

Compute the product matrix using Strassen's matrix multiplication algorithm.Given a11=1; a12=3;a21=5;a22=7 b11=8;b12=4;b21=6;b22=2

A. c11=20;c12=12;c21=100;c22=15
B. c11=22;c12=8;c21=90;c22=32
C. c11=15;c12=7;c21=80;c22=34
D. c11=26;c12=10;c21=82;c22=34
Answer» E.
9.

Running time of Strassen's algorithm is better than the naïve Theta(n3) method.

A. True
B. False
Answer» B. False
10.

Euclidean algorithm does not require the calculation of prime factors.

A. True
B. False
Answer» B. False
11.

What is the GCD of 20 and 12 using Euclid's algorithm?

A. 8
B. 2
C. 4
D. 6
Answer» D. 6
12.

The number of elements in the power set increases when there are duplicates present in the set.

A. True
B. False
Answer» C.
13.

What is the running time of Strassen's algorithm for matrix multiplication?

A. O(n2.81)
B. O(n3)
C. O(n1.8)
D. O(n2)
Answer» B. O(n3)
14.

____________ is one of the most useful principles of enumeration in combinationatorics and discrete probability.

A. Inclusion-exclusion principle
B. Quick search algorithm
C. Euclid's algorithm
D. Set theory
Answer» B. Quick search algorithm
15.

Strassen's matrix multiplication algorithm follows ___________ technique.

A. Greedy technique
B. Dynamic Programming
C. Divide and Conquer
D. Backtracking
Answer» D. Backtracking
16.

Which of the following statement is incorrect with respect to generalizing the solution using the inclusion-exclusion principle?

A. including cardinalities of sets
B. excluding cardinalities of pairwise intersections
C. excluding cardinalities of triple-wise intersections
D. excluding cardinalities of quadraple-wise intersections
Answer» D. excluding cardinalities of quadraple-wise intersections
17.

What is the recurrence relation used in Strassen's algorithm?

A. 7T(n/2) + Theta(n2)
B. 8T(n/2) + Theta(n2)
C. 7T(n/2) + O(n2)
D. 8T(n/2) + O(n2)
Answer» B. 8T(n/2) + Theta(n2)
18.

Who invented the concept of inclusion-exclusion principle?

A. Abraham de Moivre
B. Daniel Silva
C. J.J. Sylvester
D. Sieve
Answer» B. Daniel Silva
19.

If GCD of two numbers is 1, then the two numbers are said to be ________

A. Co-prime numbers
B. Prime numbers
C. Composite numbers
D. Rational numbers
Answer» B. Prime numbers
20.

What is the running time of naïve matrix multiplication algorithm?

A. O(n2.81)
B. O(n4)
C. O(n)
D. O(n3)
Answer» E.
21.

While generating partitions of integer 3 we consider 2 1 and 1 2 to be different partitions.

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

If 4 is the GCD of 16 and 12, What is the GCD of 12 and 4?

A. 12
B. 6
C. 4
D. 2
Answer» D. 2
23.

The number of scalar additions and subtractions used in Strassen's matrix multiplication algorithm is ________

A. O(n2.81)
B. Theta(n2)
C. Theta(n)
D. O(n3)
Answer» C. Theta(n)
24.

Which one of the following problem types does inclusion-exclusion principle belong to?

A. Numerical problems
B. Graph problems
C. String processing problems
D. Combinatorial problems
Answer» E.
25.

The Euclid's algorithm runs efficiently if the remainder of two numbers is divided by the minimum of two numbers until the remainder is zero.

A. True
B. False
Answer» B. False
26.

Which of the following is not an application of inclusion-exclusion principle?

A. Counting intersections
B. Graph coloring
C. Matching of bipartite graphs
D. Maximum flow problem
Answer» E.
27.

Euclid's algorithm is used for finding ___________

A. GCD of two numbers
B. GCD of more than three numbers
C. LCM of two numbers
D. LCM of more than two numbers
Answer» B. GCD of more than three numbers
28.

Strassen's algorithm is a/an_____________ algorithm.

A. Non- recursive
B. Recursive
C. Approximation
D. Accurate
Answer» C. Approximation
29.

Which of the following is true according to Ramanujan's congruence?

A. No. of partitions are divisible by 5 for a number 3 more than a multiple of 5
B. No. of partitions are divisible by 5 for a number 4 more than a multiple of 5
C. No. of partitions are divisible by 5 for a number 2 more than a multiple of 5
D. No. of partitions are divisible by 5 for a number 1 more than a multiple of 5
Answer» C. No. of partitions are divisible by 5 for a number 2 more than a multiple of 5
30.

Strassen's algorithm is quite numerically stable as the naïve method.

A. True
B. False
Answer» C.
31.

Heap's algorithm requires an auxiliary array to create permutations.

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

What will be the output of the code that generates permutations and also has the ability to handle duplicates, for the input str[]='AA'?

A. AA
B. AA,AA
C. A,A
D. A
Answer» B. AA,AA
33.

Which of the following is a correct representation of inclusion-exclusion principle?

A. |A U B|=|A|+|B|-|A,B|
B. |A,B|=|A|+|B|-|A U B|
C. |A U B|=|A|+|B|+|A,B|
D. |A,B|=|A|+|B|+|A U B|
Answer» B. |A,B|=|A|+|B|-|A U B|
34.

Who invented Euclid's algorithm?

A. Sieve
B. Euclid
C. Euclid-Sieve
D. Gabriel lame
Answer» C. Euclid-Sieve
35.

____________ is an arithmetic function that calculates the total number of positive integers less than or equal to some number n, that are relatively prime to n.

A. Euler's phi function
B. Euler's omega function
C. Cauchy's totient function
D. Legrange's function
Answer» B. Euler's omega function
36.

Strassen's Matrix Algorithm was proposed by _____________

A. Volker Strassen
B. Andrew Strassen
C. Victor Jan
D. Virginia Williams
Answer» B. Andrew Strassen
37.

How many iterating statements are involved in the naïve method of matrix multiplication?

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

Which of the following is the correct mathematical application of Euclid's algorithm?

A. Determination of prime numbers
B. Lagrange's four square theorem
C. Cauchy-Euler theorem
D. Residue theorem
Answer» C. Cauchy-Euler theorem
39.

What is the total running time of the binary GCD algorithm?

A. O(N)
B. O(N2)
C. O(log N)
D. O(N log N)
Answer» C. O(log N)
40.

Which of the following is not an application of Euclid's algorithm?

A. Simplification of fractions
B. Performing divisions in modular arithmetic
C. Solving quadratic equations
D. Solving diophantine equations
Answer» D. Solving diophantine equations
41.

What is the formula for Euclidean algorithm?

A. GCD (m,n) = GCD (n, m mod n)
B. LCM(m,n)=LCM(n, m mod n)
C. GCD(m,n,o,p) = GCD (m, m mod n, o, p mod o)
D. LCM (m,n,o,p) = LCM (m, m mod n, o, p mod o)
Answer» B. LCM(m,n)=LCM(n, m mod n)
42.

How many permutations will be formed from the array arr={1,2,3}?

A. 2
B. 4
C. 6
D. 8
Answer» D. 8
43.

Number of elements in the power set of set S={1,2,2} will be?

A. 2
B. 4
C. 6
D. 8
Answer» D. 8
44.

According to inclusion-exclusion principle, a n-tuple wise intersection is included if n is even.

A. True
B. False
Answer» C.
45.

Using the inclusion-exclusion principle, find the number of integers from a set of 1-100 that are not divisible by 2, 3 and 5.

A. 22
B. 25
C. 26
D. 33
Answer» D. 33
46.

What will be the lexicographical order of permutations formed from the array arr={1,2,3}?

A. {{2,1,3},{3,2,1},{3,1,2},{2,3,1},{1,2,3},{1,3,2}}
B. {{1,2,3},{1,3,2},{2,3,1},{2,1,3},{3,2,1},{3,1,2}}
C. {{1,2,3},{1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}}
D. {{2,1,3},{3,1,2},{3,2,1},{2,3,1},{1,2,3},{1,3,2}}
Answer» D. {{2,1,3},{3,1,2},{3,2,1},{2,3,1},{1,2,3},{1,3,2}}
47.

What is the formula to calculate the element present in second row, first column of the product matrix?

A. M1+M7
B. M1+M3
C. M2+M4 - M5 + M7
D. M2+M4
Answer» E.
48.

Let A={1,2,3} B={2,3,4} C={1,3,5} D={2,3}. Find the cardinality of sum of all the sets.

A. 6
B. 5
C. 4
D. 7
Answer» C. 4