What does the pass statement do in Python?
Correct answer D. Nothing; it is a placeholder where a statement is syntactically required
Topic / 88 questions
Page 2 of Python multiple-choice questions with answers. Tap an option to check yourself.
Page 2 of 5
Correct answer D. Nothing; it is a placeholder where a statement is syntactically required
Correct answer D. case _:
Correct answer B. Python 3.10
Correct answer A. remove()
Correct answer A. (x * 2 for x in range(5))
Correct answer B. set()
Correct answer C. Python 3.7
Correct answer A. Dictionary keys must be hashable, and lists are mutable and unhashable
Correct answer A. Python 3.6
Correct answer D. find() returns -1, while index() raises ValueError
Correct answer B. The int grows automatically, because integers have unlimited precision
Correct answer A. A ValueError is raised
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
Correct answer D. Its body must be a single expression
Correct answer A. RecursionError
Correct answer A. So the code inside runs when the file is executed directly but not when it is imported