GCD and LCM using Recursion Multiple Choice Questions and Answers (MCQs) – 1

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “GCD and LCM using Recursion – 1”.

1. Which of the following is not another name for GCD(Greatest Common Divisor)?
a) LCM
b) GCM
c) GCF
d) HCF
View Answer

Answer: a
Explanation: : LCM (Least Common Multiple) and GCD are not same. GCM (Greatest Common Measure), GCF (Greatest Common Factor), HCF (Highest Common Factor) are other names for GCD.

2. What is the GCD of 8 and 12?
a) 8
b) 12
c) 2
d) 4
View Answer

Answer: d
Explanation: GCD is largest positive integer that divides each of the integer. So the GCD of 8 and 12 is 4.

3. If GCD of two number is 8 and LCM is 144, then what is the second number if first number is 72?
a) 24
b) 2
c) 3
d) 16
View Answer

Answer: d
Explanation: As A * B = GCD (A, B) * LCM (A, B). So B = (144 * 8)/72 = 16.
advertisement
advertisement

4. Which of the following is also known as GCD?
a) Highest Common Divisor
b) Highest Common Multiple
c) Highest Common Measure
d) Lowest Common Multiple
View Answer

Answer: a
Explanation: GCM (Greatest Common Measure), GCF (Greatest Common Factor), HCF (Highest Common Factor) and HCF (Highest Common Divisor) are also known as GCD.

5. Which of the following is coprime number?
a) 54 and 24
b) 4 and 8
c) 6 and 12
d) 9 and 28
View Answer

Answer: d
Explanation: Coprime numbers have GCD 1. So 9 and 28 are coprime numbers. While 54 and 24 have GCD 6, 4 and 8 have GCD 4, 6 and 12 have GCD 6.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. In terms of Venn Diagram, which of the following expression gives GCD (Given A ꓵ B ≠ Ø)?
a) Multiplication of A U B terms
b) Multiplication of A ꓵ B terms
c) Multiplication of A*B terms
d) Multiplication of A-B terms
View Answer

Answer: b
Explanation: In terms of Venn Diagram, the GCD is given by the intersection of two sets. So A ꓵ B gives the GCD. While A U B gives the LCM.

7. What is the GCD according to the given Venn Diagram?
The GCD is given by the intersection of two sets in terms of Venn Diagram
a) 2
b) 3
c) 5
d) 6
View Answer

Answer: c
Explanation: In terms of Venn Diagram, the GCD is given by the intersection of two sets. So A ꓵ B gives the GCD. While A U B gives the LCM. So here A ꓵ B is 5.
advertisement

8. What is the GCD of a and b?
a) a + b
b) gcd (a-b, b) if a>b
c) gcd (a+b, a-b)
d) a – b
View Answer

Answer: b
Explanation: As per Euclid’s Algorithm, gcd (a, b) = gcd (a-b, b) if a > b or gcd (a, b) = gcd (a, b-a) if b > a.

9. What is the GCD of 48, 18, 0?
a) 24
b) 2
c) 3
d) 6
View Answer

Answer: d
Explanation: GCD is largest positive integer that divides each of the integer. So the GCD of 48, 18, 0 is 6.
advertisement

10. Is 9 and 28 coprime number?
a) True
b) False
View Answer

Answer: a
Explanation: Coprime numbers have GCD 1. So 9 and 28 are coprime numbers.

11. If gcd (a, b) is defined by the expression, d=a*p + b*q where d, p, q are positive integers and a, b is both not zero, then what is the expression called?
a) Bezout’s Identity
b) Multiplicative Identity
c) Sum of Product
d) Product of Sum
View Answer

Answer: a
Explanation: If gcd (a, b) is defined by the expression, d=a*p + b*q where d, p, q are positive integers and a, b is both not zero, then the expression is called Bezout’s Identity and p, q can be calculated by extended form of Euclidean algorithm.

12. Is gcd an associative function.
a) True
b) False
View Answer

Answer: a
Explanation: The gcd function is an associative function as gcd (a, gcd (b, c)) = gcd (gcd (a, b), c).

13. Which is the correct term of the given relation, gcd (a, b) * lcm (a, b) =?
a) |a*b|
b) a + b
c) a – b
d) a / b
View Answer

Answer: a
Explanation: The gcd is closely related to lcm as gcd (a, b) * lcm (a, b) = |a*b|.

14. Who gave the expression for the probability and expected value of gcd?
a) James E. Nymann
b) Riemann
c) Thomae
d) Euler
View Answer

Answer: a
Explanation: In the year 1972, James E. Nymann showed some result to show the probability and expected value of gcd.

15. What is the computational complexity of Binary GCD algorithm where a and b are integers?
a) O (log a + log b)2)
b) O (log (a + b))
c) O (log ab)
d) O (log a-b)
View Answer

Answer: a
Explanation: From the Binary GCD algorithm, it is found that the computational complexity is O (log a + log b)2) as the total number of steps in the execution is at most the total sum of number of bits of a and b.

Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.

To practice all areas of Data Structures & Algorithms, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.