♻️

Logic Building - Phase 3: Recursion

Test your recursive thinking and ability to solve problems using self-referencing functions

35 questions•4 pages•~53 min

Use this quiz track to strengthen recall, speed, and exam-style decision making. Attempt one page first, review explanations, and then re-attempt incorrect questions without notes.

A good scoring strategy is to mark uncertain questions, finish known ones quickly, and return with elimination logic. This improves accuracy while keeping momentum under time constraints.

Progress: 0 / 350%
Page 4 of 4 • Questions 31-35 of 35
Q31hard

What will be printed? def binary_search(arr, target, left, right): if left > right: return -1 mid = (left + right) // 2 if arr[mid] == target: return mid elif arr[mid] > target: return binary_search(arr, target, left, mid-1) else: return binary_search(arr, target, mid+1, right)

Q32medium

What is the result of sum_range(1, 5)?

def sum_range(start, end):
    if start > end:
        return 0
    return start + sum_range(start+1, end)
Q33hard

What will be printed? def print_numbers(n): if n == 0: return print(n, end=" ") print_numbers(n-1) print(n, end=" ") print_numbers(3)

Q34medium

What does this function calculate? def product_digits(n): if n == 0: return 1 return (n % 10) * product_digits(n // 10)

Q35medium

What is the output?

def print_pattern(n, i=1):
    if i > n:
        return
    print("*" * i)
    print_pattern(n, i+1)

print_pattern(4)
...

Quiz Pages

Navigate directly to paginated quiz sets. These links help you revise by page and make every page discoverable.