Debugging Questions and Answers
Practice ModeShowing 10 of 25 questions
Q21
What is the output of this code?
numbers = [1, 2, 3]
result = numbers[3]
Answer: Option C
Explanation: Accessing index 3 in a list with only 3 elements (indices 0,1,2) causes IndexError.
Q22
Which module provides logging capabilities for debugging?
Answer: Option C
Explanation: The logging module provides flexible logging capabilities for debugging and monitoring applications.
Q23
What does "SyntaxError: invalid syntax" indicate?
Answer: Option C
Explanation: SyntaxError occurs when Python cannot parse the code due to violations of Python's grammatical rules.
Q24
How do you exit pdb debugger?
Answer: Option C
Explanation: The "q" command quits the pdb debugger and terminates the debugging session.
Q25
What is the purpose of the "globals()" function in debugging?
Answer: Option A
Explanation: globals() returns a dictionary of the current global symbol table, useful for inspecting global variables.