Explore topic-wise InterviewSolutions in .

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

51.

What is the LCM of 48, 18, 6?(a) 12^2(b) 12*2(c) 3(d) 6I had been asked this question in class test.My question comes from GCD LCM recursion in chapter Recursion of Data Structures & Algorithms II

Answer» RIGHT choice is (a) 12^2

For explanation: The LCM of 48, 18, 6 is 144 and 12^2 is 144.
52.

Is 9 and 28 coprime number.(a) True(b) FalseThis question was posed to me in an internship interview.My enquiry is from GCD LCM recursion topic in division Recursion of Data Structures & Algorithms II

Answer» RIGHT option is (a) True

The explanation is: Coprime numbers have GCD 1 and LCM is the product of the two given terms. So 9 and 28 are coprime numbers.
53.

What is the lcm (a, b)?(a) a + b(b) gcd (a-b, b) if a>b(c) lcm (b, a)(d) a – bThe question was asked during an internship interview.This intriguing question comes from GCD LCM recursion topic in section Recursion of Data Structures & Algorithms II

Answer»

Correct ANSWER is (C) lcm (B, a)

Easy EXPLANATION - Since the LCM function is commutative, so lcm (a, b) = lcm (b, a).

54.

What is the LCM according to the given Venn Diagram?(a) 2(b) 3(c) 180(d) 6The question was asked in an online quiz.I'm obligated to ask this question of GCD LCM recursion in chapter Recursion of Data Structures & Algorithms II

Answer»

Right answer is (c) 180

Easiest explanation - In terms of Venn Diagram, the LCM is given by the Union of TWO SETS. So A U B GIVES the LCM. So PRODUCT of all the terms is 180.

55.

In terms of Venn Diagram, which of the following expression gives LCM (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 termsThe question was posed to me in a national level competition.I'm obligated to ask this question of GCD LCM recursion in section Recursion of Data Structures & Algorithms II

Answer»

Right choice is (a) Multiplication of A U B terms

The best I can EXPLAIN: In terms of VENN Diagram, the LCM is given by the UNION of two SETS. So A U B gives the LCM. While A ꓵ B gives the GCD.

56.

What is the LCM of two coprime numbers?(a) 1(b) 0(c) Addition of two coprime numbers(d) Multiplication of two coprime numbersThe question was posed to me in unit test.My question is from GCD LCM recursion in section Recursion of Data Structures & Algorithms II

Answer» RIGHT CHOICE is (d) Multiplication of TWO coprime numbers

The best explanation: Coprime numbers have GCD 1. While LCM of coprime numbers is the product of those two coprime numbers.
57.

Which is the smallest number of 3 digits that is divisible by 2, 4, 8?(a) 100(b) 102(c) 116(d) 104The question was asked at a job interview.The doubt is from GCD LCM recursion topic in portion Recursion of Data Structures & Algorithms II

Answer»

Right option is (d) 104

Best explanation: LCM of 2, 4, 8 is 8. So check for the number that is DIVISIBLE by 8. So 104 is the SMALLEST number that is divisible by 2, 4, 8.

58.

LCM is also called as ________(a) GCD(b) SCM(c) GCF(d) HCFI have been asked this question in class test.Query is from GCD LCM recursion in division Recursion of Data Structures & Algorithms II

Answer»

Right option is (b) SCM

Easy EXPLANATION - GCD (Greatest Common Divisor), GCF (Greatest Common Factor), HCF (Highest Common Factor) is not an alias for LCM. LCM is ALSO CALLED as Smallest Common Multiple(SCM).

59.

What is the LCM of 8 and 13?(a) 8(b) 12(c) 20(d) 104I got this question in quiz.This intriguing question comes from GCD LCM recursion topic in section Recursion of Data Structures & Algorithms II

Answer»

The CORRECT answer is (d) 104

For explanation: 104 is the smallest POSITIVE integer that is divisible by both 8 and 12.

60.

Which of the following is also known as LCM?(a) Lowest Common Divisor(b) Least Common Multiple(c) Lowest Common Measure(d) Highest Common MultipleThis question was addressed to me in an internship interview.The doubt is from GCD LCM recursion in division Recursion of Data Structures & Algorithms II

Answer»

Correct OPTION is (a) Lowest Common Divisor

For explanation: LEAST Common MULTIPLE is ALSO KNOWN as LCM or Lowest Common Multiple.

61.

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)This question was addressed to me by my school principal while I was bunking the class.The query is from GCD LCM Recursion, in chapter Recursion of Data Structures & Algorithms II

Answer»

Right CHOICE is (a) O (LOG a + log b)^2)

For 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.

62.

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 SumI got this question in an online quiz.The question is from GCD LCM Recursion, topic in chapter Recursion of Data Structures & Algorithms II

Answer»

Right choice is (a) Bezout’s Identity

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.

63.

Who gave the expression for the probability and expected value of gcd?(a) James E. Nymann(b) Riemann(c) Thomae(d) EulerThis question was addressed to me in an internship interview.My question is taken from GCD LCM Recursion, topic in division Recursion of Data Structures & Algorithms II

Answer»

Correct CHOICE is (a) James E. Nymann

To explain: In the year 1972, James E. Nymann SHOWED some result to show the probability and expected value of GCD.

64.

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 / bI had been asked this question in an international level competition.My query is from GCD LCM Recursion, in chapter Recursion of Data Structures & Algorithms II

Answer»

Correct choice is (a) |a*B|

The BEST explanation: The gcd is CLOSELY related to LCM as gcd (a, b) * lcm (a, b) = |a*b|.

65.

Is gcd an associative function.(a) True(b) FalseI have been asked this question by my college director while I was bunking the class.My question is taken from GCD LCM Recursion, in division Recursion of Data Structures & Algorithms II

Answer»

The correct answer is (a) True

Explanation: The gcd FUNCTION is an ASSOCIATIVE function as gcd (a, gcd (B, c)) = gcd (gcd (a, b), c).

66.

Is 9 and 28 coprime number?(a) True(b) FalseThe question was posed to me by my college professor while I was bunking the class.The above asked question is from GCD LCM Recursion, in section Recursion of Data Structures & Algorithms II

Answer» CORRECT choice is (a) True

The BEST explanation: COPRIME NUMBERS have GCD 1. So 9 and 28 are coprime numbers.
67.

What is the GCD of 48, 18, 0?(a) 24(b) 2(c) 3(d) 6I had been asked this question in semester exam.The doubt is from GCD LCM Recursion, in chapter Recursion of Data Structures & Algorithms II

Answer»

Right option is (d) 6

The explanation is: GCD is LARGEST POSITIVE integer that divides each of the integer. So the GCD of 48, 18, 0 is 6.

68.

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 – bI have been asked this question in class test.The query is from GCD LCM Recursion, in division Recursion of Data Structures & Algorithms II

Answer»

Correct OPTION is (b) gcd (a-b, b) if a>b

Best 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.

69.

What is the GCD according to the given Venn Diagram?(a) 2(b) 3(c) 5(d) 6This question was posed to me during an internship interview.This is a very interesting question from GCD LCM Recursion, in portion Recursion of Data Structures & Algorithms II

Answer» CORRECT answer is (C) 5

For 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.
70.

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 termsThe question was posed to me by my college director while I was bunking the class.This question is from GCD LCM Recursion, topic in section Recursion of Data Structures & Algorithms II

Answer»

Correct answer is (b) Multiplication of A ꓵ B terms

Easiest 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.

71.

Which of the following is also known as GCD?(a) Highest Common Divisor(b) Highest Common Multiple(c) Highest Common Measure(d) Lowest Common MultipleThe question was asked by my school teacher while I was bunking the class.Origin of the question is GCD LCM Recursion, topic in chapter Recursion of Data Structures & Algorithms II

Answer»

The CORRECT answer is (a) HIGHEST Common Divisor

The best explanation: GCM (GREATEST Common MEASURE), GCF (Greatest Common Factor), HCF (Highest Common Factor) and HCF (Highest Common Divisor) are ALSO known as GCD.

72.

Which of the following is coprime number?(a) 54 and 24(b) 4 and 8(c) 6 and 12(d) 9 and 28This question was posed to me by my college director while I was bunking the class.This is a very interesting question from GCD LCM Recursion, in chapter Recursion of Data Structures & Algorithms II

Answer» RIGHT CHOICE is (d) 9 and 28

Easy 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.
73.

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) 16I have been asked this question in my homework.The doubt is from GCD LCM Recursion, in portion Recursion of Data Structures & Algorithms II

Answer» CORRECT answer is (d) 16

The explanation is: As A * B = GCD (A, B) * LCM (A, B). So B = (144 * 8)/72 = 16.
74.

Which of the following gives the sum of the first n natural numbers?(a) nC2(b) (n-1)C2(c) (n+1)C2(d) (n+2)C2I had been asked this question during an internship interview.The above asked question is from Sum of n Natural Numbers using Recursion in division Recursion of Data Structures & Algorithms II

Answer»

Right ANSWER is (C) (n+1)C2

Easiest explanation - The sum of first n natural numbers is GIVEN by n*(n+1)/2, which is equal to (n+1)C2.

75.

What is the GCD of 8 and 12?(a) 8(b) 12(c) 2(d) 4I have been asked this question in an internship interview.Origin of the question is GCD LCM Recursion, in section Recursion of Data Structures & Algorithms II

Answer» CORRECT OPTION is (d) 4

Easiest explanation - GCD is largest positive integer that divides each of the integer. So the GCD of 8 and 12 is 4.
76.

Which of the following is not another name for GCD(Greatest Common Divisor)?(a) LCM(b) GCM(c) GCF(d) HCFI had been asked this question in an online interview.This intriguing question originated from GCD LCM Recursion, topic in chapter Recursion of Data Structures & Algorithms II

Answer» CORRECT option is (a) LCM

The BEST 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.
77.

Which of the following methods used to find the sum of first n natural numbers has the least time complexity?(a) Recursion(b) Iteration(c) Binomial coefficient(d) All have equal time complexityThe question was asked by my school principal while I was bunking the class.Asked question is from Sum of n Natural Numbers using Recursion topic in chapter Recursion of Data Structures & Algorithms II

Answer»

The correct answer is (C) BINOMIAL coefficient

For explanation: Recursion and iteration take O(n) time to find the sum of FIRST n NATURAL numbers while binomial coefficient takes O(1) time.

78.

Which of the following recursive formula can be used to find the factorial of a number?(a) fact(n) = n * fact(n)(b) fact(n) = n * fact(n+1)(c) fact(n) = n * fact(n-1)(d) fact(n) = n * fact(1)I had been asked this question in quiz.I'm obligated to ask this question of Factorial using Recursion topic in chapter Recursion of Data Structures & Algorithms II

Answer»

Correct ANSWER is (c) fact(n) = n * fact(n-1)

For explanation: fact(n) = n * fact(n – 1) can be used to find the factorial of a NUMBER.

79.

Which of the following option is wrong about natural numbers?(a) Sum of first n natural numbers can be calculated by using Iteration method(b) Sum of first n natural numbers can be calculated by using Recursion method(c) Sum of first n natural numbers can be calculated by using Binomial coefficient method(d) No method is prescribed to calculate sum of first n natural numberI got this question during an interview.The origin of the question is Sum of n Natural Numbers using Recursion in section Recursion of Data Structures & Algorithms II

Answer»

The CORRECT option is (d) No method is prescribed to CALCULATE sum of first n natural number

The BEST explanation: All of the above mentioned methods can be used to FIND the sum of first n natural numbers.

80.

In general, which of the following methods isn’t used to find the factorial of a number?(a) Recursion(b) Iteration(c) Dynamic programming(d) Non iterative / recursiveThis question was addressed to me in an interview.I want to ask this question from Factorial using Recursion in section Recursion of Data Structures & Algorithms II

Answer»

Correct answer is (d) Non iterative / recursive

Easy explanation - In general we USE recursion, ITERATION and dynamic programming to FIND the factorial of a number. We can also implement without using iterative / recursive method by using tgammal() method. Most of us never use it generally.

81.

Which of the following statements is true?(a) Recursion is always better than iteration(b) Recursion uses more memory compared to iteration(c) Recursion uses less memory compared to iteration(d) Iteration is always better and simpler than recursionThe question was posed to me by my college director while I was bunking the class.This interesting question is from Recursion in division Recursion of Data Structures & Algorithms II

Answer» CORRECT answer is (B) Recursion uses more memory compared to iteration

To explain: Recursion uses more memory compared to iteration because EVERY time the RECURSIVE function is called, the function call is stored in STACK.
82.

In recursion, the condition for which the function will stop calling itself is ____________(a) Best case(b) Worst case(c) Base case(d) There is no such conditionThe question was posed to me in an online quiz.I would like to ask this question from Recursion in division Recursion of Data Structures & Algorithms II

Answer»

Correct option is (c) BASE case

For EXPLANATION: For recursion to end at some point, there always has to be a condition for which the FUNCTION will not CALL itself. This condition is KNOWN as base case.

83.

Recursion is similar to which of the following?(a) Switch Case(b) Loop(c) If-else(d) if elif elseI had been asked this question in an interview.The above asked question is from Recursion topic in portion Recursion of Data Structures & Algorithms II

Answer»

The correct answer is (B) Loop

The BEST I can EXPLAIN: RECURSION is similar to a loop.

84.

Which of the following problems can’t be solved using recursion?(a) Factorial of a number(b) Nth fibonacci number(c) Length of a string(d) Problems without base caseThe question was asked in an online interview.My doubt stems from Recursion topic in division Recursion of Data Structures & Algorithms II

Answer»

The correct answer is (d) Problems without base CASE

To EXPLAIN: Problems without base case leads to infinite recursion call. In general, we will assume a base case to avoid infinite recursion call. Problems LIKE FINDING Factorial of a number, Nth FIBONACCI number and Length of a string can be solved using recursion.

85.

Recursion is a method in which the solution of a problem depends on ____________(a) Larger instances of different problems(b) Larger instances of the same problem(c) Smaller instances of the same problem(d) Smaller instances of different problemsThe question was asked during an online interview.The origin of the question is Recursion topic in section Recursion of Data Structures & Algorithms II

Answer»

Correct CHOICE is (c) SMALLER INSTANCES of the same PROBLEM

Best explanation: In recursion, the solution of a problem DEPENDS on the solution of smaller instances of the same problem.