Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 3 MCQs Recursion and Advanced Techniques

CSE330 — Competitive Coding Approaches-Techniques 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Introduction to recursion Easy

    What is recursion in programming?

  2. Question 2 of 60 Base condition Easy

    What is the main purpose of a base condition in recursion?

  3. Question 3 of 60 Solving problems using recursion Easy

    Which problem is commonly solved by using the recursive relation ?

  4. Question 4 of 60 Solving problems using recursion Easy

    When designing a recursive solution, the original problem is usually reduced to what?

  5. Question 5 of 60 Classic and Modern Approaches Easy

    Which technique is a classic recursive example?

  6. Question 6 of 60 Classic and Modern Approaches Easy

    Which modern technique avoids repeatedly solving the same recursive subproblems?

  7. Question 7 of 60 Direct vs. Indirect Recursion Easy

    When a function calls itself directly, what type of recursion is used?

  8. Question 8 of 60 Direct vs. Indirect Recursion Easy

    Function A calls function B, and function B calls function A. What does this demonstrate?

  9. Question 9 of 60 Tailed vs. Non-Tailed Recursion Easy

    In tail recursion, where does the recursive call appear?

  10. Question 10 of 60 Tailed vs. Non-Tailed Recursion Easy

    Which statement describes non-tail recursion?

  11. Question 11 of 60 Memory Allocation in Recursion Easy

    Where are active recursive function calls generally stored?

  12. Question 12 of 60 Memory Allocation in Recursion Easy

    What error may occur when recursion creates too many active calls?

  13. Question 13 of 60 Advantages & disadvantages of recursive programming Easy

    What is a common advantage of recursion?

  14. Question 14 of 60 Advantages & disadvantages of recursive programming Easy

    What is a common disadvantage of recursive programming?

  15. Question 15 of 60 Backtracking Easy

    What does a backtracking algorithm usually do after a choice leads to an invalid solution?

  16. Question 16 of 60 Permutations Easy

    How many permutations are possible for three distinct elements?

  17. Question 17 of 60 Combination Sum Easy

    What is the goal of the Combination Sum problem?

  18. Question 18 of 60 N-Queens Easy

    In the N-Queens problem, which queens attack each other?

  19. Question 19 of 60 Next happy number Easy

    How is the next value generated while checking whether a number is happy?

  20. Question 20 of 60 Sum string Easy

    What property must the numeric parts of a sum string satisfy?

  21. Question 21 of 60 Introduction to recursion Medium

    Consider the recursive function:

    F(n) = 1 when n = 0, and F(n) = n + F(n - 1) otherwise.

    What value is returned by F(4)?

  22. Question 22 of 60 Base condition Medium

    A recursive function is intended to compute for non-negative integers:

    power(a, n) = a * power(a, n - 1)

    Which base condition makes the function correct?

  23. Question 23 of 60 Solving problems using recursion Medium

    A recursive binary search is called on a sorted array of elements. In the worst case, approximately how many times can the search range be halved before it becomes empty?

  24. Question 24 of 60 Classic and Modern Approaches Medium

    A direct recursive Fibonacci implementation repeatedly solves the same subproblems. Which technique most directly improves it while preserving its recursive structure?

  25. Question 25 of 60 Direct vs. Indirect Recursion Medium

    Function A calls function B, function B calls function C, and function C calls function A. What type of recursion does this call structure represent?

  26. Question 26 of 60 Direct vs. Indirect Recursion Medium

    Which function demonstrates direct recursion?

  27. Question 27 of 60 Tailed vs. Non-Tailed Recursion Medium

    Which recursive return statement is tail-recursive, assuming acc stores the partial result?

  28. Question 28 of 60 Tailed vs. Non-Tailed Recursion Medium

    Why is return n * factorial(n - 1) classified as non-tail recursion?

  29. Question 29 of 60 Memory Allocation in Recursion Medium

    A recursive function makes one call with n - 1 until n == 0, and each call stores only a constant amount of local data. What is its auxiliary stack-space complexity?

  30. Question 30 of 60 Advantages & disadvantages of recursive programming Medium

    For traversing a very deep tree, what is the main practical risk of using recursive depth-first search instead of an explicit stack?

  31. Question 31 of 60 Backtracking Medium

    A backtracking algorithm places values into positions and discovers that the current partial assignment violates a constraint. What should it do next?

  32. Question 32 of 60 Backtracking Medium

    Which change most effectively prunes a backtracking search without removing valid solutions?

  33. Question 33 of 60 Permutations Medium

    How many distinct permutations can be formed from the characters in AABC?

  34. Question 34 of 60 Permutations Medium

    In a swap-based recursive permutation algorithm, what must happen after returning from the recursive call for a chosen position?

  35. Question 35 of 60 Combination Sum Medium

    Given candidates [2, 3, 6, 7], where each candidate may be reused, which set contains all unique combinations whose sum is ?

  36. Question 36 of 60 Combination Sum Medium

    In a Combination Sum backtracking algorithm where candidates may be reused, which recursive index should be passed after choosing candidate i?

  37. Question 37 of 60 N-Queens Medium

    When placing a queen at row r and column c, which previously placed queen creates a diagonal conflict?

  38. Question 38 of 60 N-Queens Medium

    A row-by-row N-Queens solver stores occupied columns and diagonals in sets. Which pair of expressions can identify the two diagonals of position (r, c)?

  39. Question 39 of 60 Next happy number Medium

    A happy number repeatedly replaces a number with the sum of the squares of its digits until reaching . What is the smallest happy number greater than ?

  40. Question 40 of 60 Sum string Medium

    A sum string can be split into numbers such that every number after the first two equals the sum of the previous two. Which split correctly proves that 122436 is a sum string?

  41. Question 41 of 60 Introduction to recursion Hard

    Consider a recursive procedure that makes two calls on an input of half the original size and performs constant local work: , with . Assuming no memoization, which pair correctly describes its total running time and maximum recursion depth?

  42. Question 42 of 60 Base condition Hard

    A function uses if (n == 1) return; as its only base condition and otherwise calls itself with n / 2 using integer division. Which replacement guarantees termination for every integer input?

  43. Question 43 of 60 Solving problems using recursion Hard

    A power function computes an even exponent using power(x, n/2) * power(x, n/2) without storing the first result. For restricted to powers of two, what are its time complexity and recursion depth?

  44. Question 44 of 60 Classic and Modern Approaches Hard

    A language has no tail-call optimization, but a deeply recursive state machine must avoid native stack overflow while preserving recursive control flow. Which transformation best achieves this?

  45. Question 45 of 60 Direct vs. Indirect Recursion Hard

    Consider A(n) = 0 for and otherwise A(n) = 1 + B(n-1). Also, B(n) = 0 for and otherwise B(n) = 1 + A(\lfloor n/2 \rfloor). What are the value returned by A(20) and the maximum number of simultaneously active calls, including the base-case call?

  46. Question 46 of 60 Tailed vs. Non-Tailed Recursion Hard

    Which implementation is tail-recursive, assuming ordinary eager evaluation?

  47. Question 47 of 60 Memory Allocation in Recursion Hard

    Quicksort is modified to recurse only on the smaller partition and process the larger partition by updating bounds inside a loop. What worst-case bounds does this guarantee for auxiliary call-stack space and running time?

  48. Question 48 of 60 Advantages & disadvantages of recursive programming Hard

    A depth-first traversal explores a tree with branching factor and maximum depth . Which statement accurately compares a recursive implementation with an iterative implementation using an explicit stack?

  49. Question 49 of 60 Backtracking Hard

    A combination-search algorithm sorts candidates and stops its loop when currentSum + candidate[i] > target. Under which condition is this pruning rule logically valid?

  50. Question 50 of 60 Backtracking Hard

    A backtracking solver builds assignments for variables, each with possible values. A feasibility test costing is executed at every recursion-tree node. With no effective pruning, what is the tightest asymptotic upper bound on running time?

  51. Question 51 of 60 Permutations Hard

    For the multiset , how many distinct full-length permutations exist, and which loop condition correctly prevents duplicate generation after sorting?

  52. Question 52 of 60 Permutations Hard

    Using one-based indexing, what is the nd lexicographic permutation of ?

  53. Question 53 of 60 Combination Sum Hard

    Candidates are $[2,3,5]`, each may be reused any number of times, and combinations differing only by order are identical. How many combinations sum to $10$?

  54. Question 54 of 60 Combination Sum Hard

    A recursive Combination Sum solver allows unlimited reuse by recursing with the same candidate index. Which input property can make the recursion nonterminating even when the target is finite?

  55. Question 55 of 60 N-Queens Hard

    In a bitmask N-Queens solver, cols, diagL, and diagR mark columns attacked in the current row, and full has its lowest bits set. Which expression computes available positions, and how are diagonal masks advanced after choosing bit p?

  56. Question 56 of 60 N-Queens Hard

    On a board with zero-based indices, queens have been placed at , , and . Which columns remain legal for a queen in row ?

  57. Question 57 of 60 Next happy number Hard

    A happy number repeatedly replaces a number by the sum of the squares of its decimal digits until reaching or entering a cycle. What is the smallest happy number strictly greater than ?

  58. Question 58 of 60 Sum string Hard

    A sum string can be partitioned into at least three decimal numbers such that every number after the first two equals the sum of its two predecessors. For 199100199, which initial pair produces a valid complete partition?

  59. Question 59 of 60 Sum string Hard

    When testing all possible first and second numbers of a sum string, which validation rule correctly handles leading zeros and termination?

  60. Question 60 of 60 Water overflow Hard

    Identical glasses of capacity are arranged in rows. Overflow from each glass is divided equally between the two glasses directly below it. If units are poured into the top glass, how much water is retained in the glass at row , column , using zero-based indices?

That's unit 3

Answer a few questions and your score shows up here.