🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Recursion & Backtracking Quiz: questions with answers

7 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What happens if a recursive function has no base case?
  2. Q2. What does this print? (code)
  3. Q3. How many subsets does a set of 4 distinct elements have?
  4. Q4. What are the three steps of the backtracking template?
  5. Q5. Why must you append a COPY of path (path[:] / new ArrayList<(path)) to the results?
  6. Q6. Naive recursive Fibonacci fib(n) = fib(n−1) + fib(n−2) has roughly what time complexity?
  7. Q7. To avoid duplicate combinations when the input has repeated numbers (Subsets II), you… (select all that apply)