Python keywords MCQS
Q. Which of the following is NOT a Python keyword?
Solution:
eval is a built-in function; the others are keywords.
Q. Which keyword is used to define a function?
Solution:
def starts a function definition.
Q. Which keyword is used to define a class?
Solution:
class is lowercase; Python is case-sensitive.
Q. How many keywords does Python 3.12 have?
Solution:
keyword.kwlist has 35 entries in Python 3.12.
Q. Which of these is a reserved keyword in Python?
Solution:
nonlocal is reserved; print is a function, main and self are ordinary names.
Q. Which keywords begin with a capital letter?
Solution:
True, False and None are the only capitalised keywords.
Q. What does keyword.iskeyword("switch") return?
Solution:
Python has no switch keyword; it uses match-case (soft keywords) instead.
Q. Which statement about soft keywords is correct?
Solution:
match, case, _ and type are keywords only in their special syntax and can be ordinary names elsewhere.
Get Question Bank
Strengthen Your Practice with our comprehensive question bank.