FINAL EXAM – 2026|||questions and
answers with rationales/graded
A+/2026 update/100% correct
/instant download
Total Questions: 80+
Time: 3 Hours
Instructions: Select the best answer for each question.
SECTION A: PYTHON BASICS FOR DATA (Q1–15)
Q1. Which of the following is the most Pythonic way to filter even numbers from a
list nums = [1,2,3,4,5,6]?
• A) list(filter(lambda x: x%2==0, nums))
• B) [x for x in nums if x%2==0]
• C) for i in nums: if i%2==0: print(i)
• D) nums[nums%2==0]
Rationale: List comprehension is the most Pythonic and readable for simple
filtering.
Q2. What does *args do in a function definition?
• A) Passes a variable number of positional arguments as a tuple
• B) Passes keyword arguments as a dictionary
• C) Unpacks a list into separate arguments
, • D) Creates a pointer to a global variable
Rationale: *args collects extra positional arguments into a tuple.
Q3. Which method is best to read a large CSV file (10GB) without loading entirely
into memory?
• A) pd.read_csv()
• B) open().readlines()
• C) pd.read_csv(chunksize=10000)
• D) np.loadtxt()
Rationale: chunksize returns an iterator, processing file in manageable pieces.
Q4. Output of print(2**3**2)?
• A) 64
• B) 512
• C) 256
• D) 12
Rationale: Exponentiation is right-associative: 3**2=9, then 2**9=512.
Q5. Which of these is NOT a mutable data type?
• A) List
• B) Dictionary
• C) Tuple
• D) Set
Rationale: Tuples are immutable; lists, dicts, sets are mutable.
Q6. How to properly handle missing values in a Python list of numeric data?
• A) list.remove(None)
• B) Ignore them
• C) Use filter(None, data) or list comprehension with is not None
, • D) Convert to string
Rationale: filter(None, ...) removes falsy values (None, 0, False). For just None: [x
for x in data if x is not None].
Q7. Which library is the foundation for numerical computing in Python?
• A) Pandas
• B) NumPy
• C) SciPy
• D) Matplotlib
Rationale: NumPy provides N-dimensional arrays and vectorized operations.
Q8. What is the result of np.array([True, False]) | np.array([False, True])?
• A) [True, True]
• B) [False, False]
• C) [True, True] (same as A but literally array([ True, True]))
• D) [False, True]
Rationale: Element-wise OR: True|False=True, False|True=True.
Q9. Which statement about Python’s GIL (Global Interpreter Lock) is true?
• A) It prevents multiple threads from executing Python bytecode
simultaneously
• B) It speeds up I/O-bound threading
• C) It is removed in Python 3.12
• D) It only affects NumPy
Rationale: GIL allows only one thread to run Python code at a time; removed only
in some experimental builds.
Q10. Which of these is a valid way to handle a ZeroDivisionError?
• A) if x = 0: pass
• B) catch ZeroDivisionError: