iGET

Python Programming - MCQ Practice Questions

Core Python MCQs — syntax, data types, OOP, libraries for placements & IT exams.

188 questions | 100% Free

Q.121Medium

Which of the following sorting algorithms has the best average-case time complexity?

Q.122Medium

What will be the output of the following code that uses recursion to compute the -th Fibonacci number? ```python def fib(n): if n <= 1: return n return fib(n - 1) + fib(n - 2) print(fib(6)) ```

Q.123Medium

What is the space complexity of Merge Sort?

Q.124Medium

What will be the output of the following Python code implementing linear search? ```python def linear_search(arr, target): for i, val in enumerate(arr): if val == target: return i return -1 result = linear_search([10, 30, 20, 50, 40], 50) print(result) ```

Q.125Medium

Which of the following correctly describes the working principle of Insertion Sort?

Q.126Medium

What will be the output of the following code that implements a recursive binary search? ```python def rec_binary_search(arr, low, high, target): if low > high: return -1 mid = (low + high) // 2 if arr[mid] == target: return mid elif arr[mid] < target: return rec_binary_search(arr, mid + 1, high, target) else: return rec_binary_search(arr, low, mid - 1, target) arr = [1, 3, 5, 7, 9, 11] print(rec_binary_search(arr, 0, len(arr) - 1, 7)) ```