Vidyalelo
Python · Q2

Python MCQs: Variable Names and Operators Chapter

Programming · Python · question 2

Q2

Which of the following is not a keyword?

A.
eval
Answer
B.
assert
C.
nonlocal
D.
pass

Answer: Option A

Solution

Answer: Option A
Solution:
In Python, keywords are reserved words that have special meaning and cannot be used as identifiers (variable names, function names, etc.). The Python language defines a specific set of keywords that are used for various programming constructs.

Let's analyze each option:

Option A: "eval" - This is not a keyword in Python. "eval" is a built-in function that evaluates a Python expression from a string and returns the result.

Option B: "assert" - This is a keyword in Python used for debugging purposes to test assertions.

Option C: "nonlocal" - This is a keyword in Python used to declare that a variable inside a nested function or lambda function is not local to it, meaning it should be looked up in the enclosing scope.

Option D: "pass" - This is a keyword in Python used as a placeholder indicating that no action is to be taken.

Therefore, the correct answer is Option A: eval.