Which exception does Python raise when the body of an if statement is not indented?
Correct answer D. IndentationError
Subject / 421 questions
Page 11 of Programming multiple-choice questions with answers. Tap an option to check yourself.
Page 11 of 22
Correct answer D. IndentationError
Correct answer B. Types belong to objects and are checked at runtime, so a name can be rebound to a value of a different type
Correct answer A. tuple
Correct answer B. The int grows automatically, because integers have unlimited precision
Correct answer A. A ValueError is raised
Correct answer D. find() returns -1, while index() raises ValueError
Correct answer A. Python 3.6
Correct answer A. Dictionary keys must be hashable, and lists are mutable and unhashable
Correct answer C. Python 3.7
Correct answer B. set()
Correct answer A. (x * 2 for x in range(5))
Correct answer A. remove()
Correct answer B. Python 3.10
Correct answer D. case _:
Correct answer D. Nothing; it is a placeholder where a statement is syntactically required
Correct answer D. When the loop condition becomes false without a break being executed
Correct answer D. Use items=None and create the list inside the function when items is None
Correct answer D. None
Correct answer B. Local, Enclosing, Global, Built-in
Correct answer B. It lets the inner function rebind a variable in the nearest enclosing function scope