Subject / 421 questions

Programming MCQs

Page 11 of Programming multiple-choice questions with answers. Tap an option to check yourself.

Page 11 of 22

Question 202 Python

What does it mean to say that Python is dynamically typed?

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

Open question
Advertisement
Advertisement
Question 215 Python

What does the pass statement do in Python?

Correct answer D. Nothing; it is a placeholder where a statement is syntactically required

Open question
Advertisement
Question 216 Python

When does the else block of a Python while loop execute?

Correct answer D. When the loop condition becomes false without a break being executed

Open question
Question 217 Python

What is the recommended way to give a function parameter a fresh empty list as its default on every call?

Correct answer D. Use items=None and create the list inside the function when items is None

Open question
Question 220 Python

What is the purpose of the nonlocal statement in a nested function?

Correct answer B. It lets the inner function rebind a variable in the nearest enclosing function scope

Open question