Python MCQ Questions (Multiple Choice Quizz)

Table of Contents

Python MCQ Questions and Answer help beginners to get expertise in Python Fundamentals and test their knowledge of Python Programming Language.

1). Which of the following is not a valid variable name?
  a) testvar
  b) test_var
  c) _testvar
  d) 11testvar

Correct answer is d).
Explanation: Variable name can not start with a number.

2). Which is not a Python variable type?
  a) int
  b) float
  c) string
  d) Lambda
  e) None

Correct answer is d).
Explanation: Lambda is an anonymous function in Python, not a variable.

3). Which is a valid Python identifier?
  a) 9test
  b) 1002
  c) _test10
  d) 10test

Correct answer is c).
Explanation: An identifier can not start with a number so a), b), and d) are invalid and c) is valid.

4). What is the maximum length of an identifier?
  a) 70 characters
  b) 89 characters
  c) 81 characters
  d) None of these

Correct answer is d).
Explanation: An identifier can have no limit on length.

5). Which is not a Python keyword?
  a) True
  b) False
  c) On
  d) None

Correct answer is c).
Explanation: True, False, and None are valid keywords but On is an invalid one.

6). Which is not a valid Python identifier?
  a) 9test
  b) test10
  c) Testing
  d) Testing10

Correct answer is a).
Explanation: An identifier can not start with a number.

7). Can Keywords be used as identifiers?
  a) True
  b) False

Correct answer is b).
Explanation: Keywords can not be used as identifiers. Those are used to define the syntax.

8). Does the case matter for Python identifiers?
  a) True
  b) False

Correct answer is a).
Explanation: Yes case always matters for Python identifiers.

9). Are the names of the identifiers unique in Python?
  a) True
  b) False

Correct answer is a).
Explanation: Yes, and hence Name and name are different.

10). Which is the correct way of declaring and initializing a variable?
  a) str mystr = “this is a string”
  b) mystr = “this is a string”
  c) mystr = this is a string
  d) str mystr
      mystr = “this is a string”

Correct answer is b).
Explanation: Correct way to declare and initialize a variable is to assign a value to the variable.
For example, If the variable name is mystr, then assign value to the same using mystr = “value”.

Variables MCQ

Conditional MCQ

Loops MCQ

String MCQ

List MCQ

Tuple MCQ

Dictionary MCQ

Sets MCQ

Functions MCQ

File Handling MCQ

OOPS MCQ

Pandas MCQ

NumPy MCQ

Leave a Comment