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.

1.

If the height of a binary tree is 54, how many null pointers are there as children?(a) 1267(b) 3^58(c) 56(d) 2^55The question was asked by my college professor while I was bunking the class.My question is taken from Recursion topic in division Induction and Recursion of Discrete Mathematics

Answer»

Correct option is (d) 2^55

The explanation is: Depth-first SEARCH (DFS) algorithm of a binary tree, is a trivial example of short-circuiting. We can have a standard RECURSIVE algorithm in CASE of DFS. Now, a perfect binary tree of HEIGHT h has 2^h+1 Null pointers as children.

h = 54

2^54+1

2^55.

2.

Every recursive algorithm must have the problem of ________(a) overhead of repeated function calls(b) collision of different function calls(c) searching for all duplicate elements(d) make only two recursive callsThis question was addressed to me in final exam.Question is from Recursion topic in chapter Induction and Recursion of Discrete Mathematics

Answer» RIGHT choice is (a) overhead of REPEATED FUNCTION calls

To elaborate: Due to the overhead of repeated function calls and returns, recursive ALGORITHMS may be inefficient for small data. Any recursion can be replaced by iteration with an explicit CALL stack whereas iteration can be replaced with tail recursion.
3.

Which of the following functions generates new data at each step of a method?(a) corecursive function(b) structural recursive function(c) unirecursive function(d) indirect functionThe question was asked during an internship interview.I want to ask this question from Recursion topic in section Induction and Recursion of Discrete Mathematics

Answer»

The correct option is (a) corecursive function

Easiest explanation: The generatively recursive functions or corecursive functions is defined as generation of the NEW data at each step that is successive APPROXIMATION in Regula Falsi method. In terms of loop variants, there is no such loop variant, and termination DEPENDS on error of approximation.

4.

In which of the following problems recurrence relation holds?(a) Optimal substructure(b) Tower of Hanoi(c) Hallmark substitution(d) Longest common subsequenceThis question was addressed to me in an interview for internship.The query is from Recursion in chapter Induction and Recursion of Discrete Mathematics

Answer»

Correct choice is (B) Tower of Hanoi

To explain: We can have recurrence RELATION for tower of hanoi and that is hn = 2 hn-1 + 1h1 = 1, for n NUMBER of disks in one peg.

5.

The argument of each recursive call is the content of a field of the original output. This definite characteristic belongs to which of the following function?(a) Structurally recursive function(b) Generativity recursive function(c) General function(d) Indirect recursive functionThe question was posed to me during an interview.The query is from Recursion in section Induction and Recursion of Discrete Mathematics

Answer»

The correct option is (a) Structurally recursive function

To explain I would say: A structurally recursive function has a characteristic that the argument to each recursive call is the content of a FIELD of the ORIGINAL input. This recursion function includes mostly all TREE traversals which includes binary tree creation and search, XML processing ETC.

6.

The mutual recursion is also termed as ______(a) indirect recursion(b) constructive recursion(c) generative recursion(d) definitive recursionI had been asked this question in a national level competition.Asked question is from Recursion topic in section Induction and Recursion of Discrete Mathematics

Answer»

The CORRECT choice is (a) indirect recursion

To EXPLAIN: When a function is not called by itself but by ANOTHER function which it has called either directly or INDIRECTLY is termed as Indirect recursion. Mutual recursion is a more symmetric term of Indirect recursion.

7.

_______ recursion consists of multiple self-references.(a) binary recursion(b) single recursion(c) multiple recursion(d) coinductive recursionI got this question during an interview.I want to ask this question from Recursion in chapter Induction and Recursion of Discrete Mathematics

Answer»

Right OPTION is (C) multiple recursion

Best explanation: A recursion which consists of multiple self-references and requires exponential time and space is called multiple recursion. Multiple recursions include TREE traversal of a graph, such as in a depth-first search. However, SINGLE recursion is more efficient than multiple recursion.

8.

How many types of self-referential recursive data are there in computer programs?(a) 6(b) 2(c) 10(d) 4I had been asked this question in semester exam.This intriguing question originated from Recursion in division Induction and Recursion of Discrete Mathematics

Answer»

Right CHOICE is (b) 2

Explanation: There are TWO types of self-referential definitions and these are inductive and coinductive definitions. An inductively defined recursive data definition MUST have to SPECIFY how to CONSTRUCT instances of the data. For example, linked lists are defined as an inductively recursive data definition.

9.

________ is the consequence of dynamic programming.(a) Bellman equation(b) Frobenius equation(c) Linear equation(d) Boolean expressionThe question was asked in a job interview.My question comes from Recursion in portion Induction and Recursion of Discrete Mathematics

Answer»

Right OPTION is (a) Bellman equation

The best I can explain: DYNAMIC programming can LEAD to recursive optimization that can restate a multistep optimization problem in its recursive form. The Bellman equation that writes the VALUE of the optimization problem at an earlier time in terms of its value at a LATER time is the result of dynamic programming.

10.

Which of the following is contained in a recursive grammar?(a) semantic rules(b) production rules(c) recursive language(d) recursive functionThe question was asked during an online interview.Question is from Recursion topic in division Induction and Recursion of Discrete Mathematics

Answer»
11.

A polygon with 25 sides can be triangulated into _______(a) 23(b) 20(c) 22(d) 21This question was posed to me in an online quiz.This key question is from Strong Induction and Well-Ordering topic in division Induction and Recursion of Discrete Mathematics

Answer» CORRECT ANSWER is (a) 23

For explanation: A SIMPLE POLYGON with n SIDES can be triangulated into n-2 triangles, where n > 2.
12.

Suppose that P(n) is a propositional function. Determine for which positive integers n the statement P(n) must be true if: P(1) and P(2) is true; for all positive integers n, if P(n) and P(n+1) is true then P(n+2) is true.(a) P(1)(b) P(2)(c) P(4)(d) P(n)I had been asked this question by my college professor while I was bunking the class.Asked question is from Strong Induction and Well-Ordering topic in section Induction and Recursion of Discrete Mathematics

Answer»

Correct ANSWER is (d) P(n)

The best I can EXPLAIN: By induction, we can prove that P(n) is TRUE.

13.

Suppose that P(n) is a propositional function. Determine for which positive integers n the statement P(n) must be true if: P(1) is true; for all positive integers n, if P(n) is true then P(n+2) is true.(a) P(3)(b) P(2)(c) P(4)(d) P(6)This question was addressed to me in homework.My question comes from Strong Induction and Well-Ordering topic in portion Induction and Recursion of Discrete Mathematics

Answer»

Correct answer is (a) P(3)

To EXPLAIN: By induction we can PROVE that P(3)is TRUE but we can’t CONCLUDE about P(2), p(6) and P(4).

14.

Which amount of postage can be formed using just 3-cent stamp and 10-cent stamps?(a) 27(b) 20(c) 11(d) 5This question was posed to me in an interview for job.I need to ask this question from Strong Induction and Well-Ordering topic in section Induction and Recursion of Discrete Mathematics

Answer»

The CORRECT OPTION is (a) 27

The explanation is: We can form 27 cent of postage with NINE 3-cent stamp and 20-cent postage can be formed by using two 10-cent STAMPS.

15.

22-cent of postage can be produced with two 4-cent stamp and one 11-cent stamp.(a) True(b) FalseThis question was posed to me in a national level competition.Query is from Strong Induction and Well-Ordering topic in division Induction and Recursion of Discrete Mathematics

Answer»

Right ANSWER is (b) False

Easiest EXPLANATION: By USING two 4-cent stamp and one 11-cent stamp, 27-cent POSTAGE is PRODUCED.

16.

Which amount of postage can be formed using just 4-cent and 11-cent stamps?(a) 2(b) 5(c) 30(d) 10I had been asked this question in semester exam.My question is taken from Strong Induction and Well-Ordering topic in portion Induction and Recursion of Discrete Mathematics

Answer»

The CORRECT answer is (d) 10

Explanation: We can FORM 30 CENT of POSTAGE with two 4-cent stamp and two 11-cent stamp.

17.

Let P(n) be the statement that postage of n cents can be formed using just 3-cents stamps and 5-cents stamps. Is the statements P(8) and P(10) are Correct?(a) True(b) FalseThe question was asked at a job interview.I want to ask this question from Strong Induction and Well-Ordering topic in portion Induction and Recursion of Discrete Mathematics

Answer»

Right answer is (a) True

The best explanation: We can form 8 cent of POSTAGE with one 3-cent STAMP and one 5-cent stamp. P(10) is true because we can form it using two 5-cent STAMPS.

18.

A polygon with 12 sides can be triangulated into _______(a) 7(b) 10(c) 5(d) 12I have been asked this question in an online interview.My enquiry is from Strong Induction and Well-Ordering topic in division Induction and Recursion of Discrete Mathematics

Answer»

Correct CHOICE is (b) 10

Easy EXPLANATION: A simple polygon with n sides can be triangulated into n-2 TRIANGLES, where n > 2.

19.

A polygon with 7 sides can be triangulated into ________(a) 7(b) 14(c) 5(d) 10I have been asked this question at a job interview.My enquiry is from Strong Induction and Well-Ordering topic in division Induction and Recursion of Discrete Mathematics

Answer»
20.

Every simple polynomial has an interior diagonal.(a) True(b) FalseI got this question in an online quiz.My doubt is from Strong Induction and Well-Ordering topic in chapter Induction and Recursion of Discrete Mathematics

Answer»

Right choice is (a) True

The EXPLANATION: By USING STRONG INDUCTION.

21.

What is the induction hypothesis assumption for the inequality m ! > 2^m where m>=4?(a) for m=k, k+1!>2^k holds(b) for m=k, k!>2^k holds(c) for m=k, k!>3^k holds(d) for m=k, k!>2^k+1 holdsThe question was asked by my college professor while I was bunking the class.My question is based upon Principle of Mathematical Induction topic in portion Induction and Recursion of Discrete Mathematics

Answer»
22.

According to principle of mathematical induction, if P(k+1) = m^(k+1) + 5 is true then _____ must be true.(a) P(k) = 3m^(k)(b) P(k) = m^(k) + 5(c) P(k) = m^(k+2) + 5(d) P(k) = m^(k)I had been asked this question in an interview for job.The above asked question is from Principle of Mathematical Induction in division Induction and Recursion of Discrete Mathematics

Answer»

Correct choice is (b) P(K) = m^(k) + 5

The BEST I can explain: By the principle of mathematical induction, if a statement is true for any number m = k, then for its successor m = k + 1, the statement also satisfies, PROVIDED the statement is true for m = 1. So, the required answer is p(k) = m^k + 5.

23.

For any positive integer m ______ is divisible by 4.(a) 5m^2 + 2(b) 3m + 1(c) m^2 + 3(d) m^3 + 3mI had been asked this question during an interview.I want to ask this question from Principle of Mathematical Induction topic in division Induction and Recursion of Discrete Mathematics

Answer» RIGHT ANSWER is (d) m^3 + 3m

Best explanation: The required answer is, m^3 + 3m. Now, by INDUCTION hypothesis, we have to prove for m=K, k^3+3k is divisible by 4. So, (k + 1)^3 + 3 (k + 1) = k^3 + 3 k^2 + 6 k + 4

= [k^3 + 3 k] + [3 k^2 + 3 k + 4] = 4M + (12k^2 + 12k) – (8K^2 + 8k – 4), both the terms are divisible by 4. Hence (k + 1)^3 + 3 (k + 1) is also divisible by 4 and hence it is proved for any integer m.
24.

Which of the following is the base case for 4^n+1 > (n+1)^2 where n = 2?(a) 64 > 9(b) 16 > 2(c) 27 < 91(d) 54 > 8I had been asked this question in a national level competition.Asked question is from Principle of Mathematical Induction topic in section Induction and Recursion of Discrete Mathematics

Answer»

Right choice is (a) 64 > 9

The BEST explanation: Statement By PRINCIPLE of MATHEMATICAL induction, for n=2 the base case of the inequation 4^n+1 > (n+1)^2 should be 64 > 9 and it is TRUE.

25.

By induction hypothesis, the series 1^2 + 2^2 + 3^2 + … + p^2 can be proved equivalent to ____________(a) \(\frac{p^2+2}{7}\)(b) \(\frac{p*(p + 1)*(2p + 1)}{6}\)(c) \(\frac{p*(p+1)}{4}\)(d) p+p^2This question was addressed to me in an interview for internship.Origin of the question is Principle of Mathematical Induction topic in division Induction and Recursion of Discrete Mathematics

Answer»

The correct answer is (b) \(\frac{p*(p + 1)*(2p + 1)}{6}\)

The best explanation: By PRINCIPLE of mathematical INDUCTION, we now ASSUME that p (b) is true 1^2 + 2^2 + 3^2 + … + b^2 = \(\frac{b (b + 1) (2b + 1)}{6}\)

so to prove P(b+1): 1^2 + 2^2 + 3^2 + … + b^2 + (b + 1)^2 = \(\frac{b (b + 1) (2b + 1)}{6}\) + (b + 1)^2

By induction ASSUMPTION it is shown that 1^2 + 2^2 + 3^2 + … + b^2 + (b + 1)^2 = \(\frac{(b + 1) [(b + 2) (2b + 3)]}{6}\). Hence it is proved that 1^2 + 2^2 + 3^2 + … + p^2 = \(\frac{p*(p + 1)*(2p + 1)}{6}\).

26.

For m = 1, 2, …, 4m+2 is a multiple of ________(a) 3(b) 5(c) 6(d) 2This question was addressed to me by my college director while I was bunking the class.Question is from Principle of Mathematical Induction topic in section Induction and Recursion of Discrete Mathematics

Answer» CORRECT option is (d) 2

Explanation: For n = 1, 4 * 1 + 2 = 6, which is a multiple of 2. Assume that 4m+2 is true for m=k and so 4k+2 is true based on the assumption. Now, to PROVE that 4k+2 is also a multiple of 2 ⇒ 4(k+1)+2 ⇒ 2 * 4k – 4k + 6 ⇒ 2*4k+4 – 4k+2 ⇒ 2(4k+2) – 2(2k+1). Here, the FIRST term 2(4k+2) is true as PER assumption and the second term 2(4k+2) is must to be a multiple of 2. Hence, 4(k+1)+2 is a multiple of 2. So, by induction HYPOTHESIS, (4m+2) is a multiple of 2, for m = 1,2,3,…
27.

For any integer m>=3, the series 2+4+6+…+(4m) can be equivalent to ________(a) m^2+3(b) m+1(c) m^m(d) 3m^2+4The question was posed to me in class test.Question is taken from Principle of Mathematical Induction topic in division Induction and Recursion of Discrete Mathematics

Answer»

Right choice is (a) m^2+3

To EXPLAIN: The REQUIRED answer is m^2+3. Now, by induction assumption, we have to PROVE 2+4+6+…+4(k+1) = (k+1)^2+3also can be TRUE, 2+4+6+…+4(k+1) = 2+4+6+⋯+(4k+4) and by the subsequent steps, we can prove that (m+1)^2+3 also holds for m=k. So, it is proved.

28.

For every natural number k, which of the following is true?(a) (mn)^k = m^kn^k(b) m*k = n + 1(c) (m+n)^k = k + 1(d) m^kn = mn^kThe question was asked in an interview for job.Enquiry is from Principle of Mathematical Induction topic in portion Induction and Recursion of Discrete Mathematics

Answer» RIGHT answer is (a) (mn)^K = m^kn^k

Explanation: In the first step, for k = 1, (mn)^1 = m^1n^1 = mn, hence it is true. Let us assume the statement is true for k = l, Now by induction ASSUMPTION, (mn)^1 = m^1n^1 is true. So, to PROVE, (mn)^l+1 = m^l + 1n^l+1, we have (mn)^l = m^ln^l and multiplying both sides by (mn) ⇒ (mn)^1(mn)=(m^1n^1)(mn)

⇒ (mn)^l+1 = (mm^1)(nn^1) ⇒(mn)^l+1 = (m^l+1n^l+1). Hence, it is proved.So, (mn)^k = m^kn^k is true for EVERY natural number k.
29.

In the principle of mathematical induction, which of the following steps is mandatory?(a) induction hypothesis(b) inductive reference(c) induction set assumption(d) minimal set representationThis question was posed to me in homework.Query is from Principle of Mathematical Induction topic in division Induction and Recursion of Discrete Mathematics

Answer»

The correct choice is (a) induction hypothesis

Best explanation: The hypothesis of Step is a must for MATHEMATICAL induction that is the statement is true for n = k, where n and k are any NATURAL NUMBERS, which is also called induction assumption or induction hypothesis.

30.

What is the base case for the inequality 7^n > n^3, where n = 3?(a) 652 > 189(b) 42 < 132(c) 343 > 27(d) 42

Answer»

The correct option is (C) 343 > 27

For explanation I would SAY: By the principle of MATHEMATICAL induction, we have 7^3 > 3^3 ⇒ 343 > 27 as a BASE case and it is true for n = 3.