0% found this document useful (0 votes)
2 views4 pages

Python MCQ Questions

This document contains a series of multiple-choice questions (MCQs) related to Python programming. It covers topics such as Python identifiers, keywords, data types, functions, and operators, providing correct answers for each question. The questions are designed to test knowledge of Python fundamentals and syntax.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Python MCQ Questions

This document contains a series of multiple-choice questions (MCQs) related to Python programming. It covers topics such as Python identifiers, keywords, data types, functions, and operators, providing correct answers for each question. The questions are designed to test knowledge of Python fundamentals and syntax.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Python MCQ Questions

1. What is the maximum length of a Python identifier?

 A. 16
 B. 32
 C. 64
 D. No fixed length is specified

Answer: D

2. Which of the following is not a keyword in Python?

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

Answer: B

3. What is the output of: type([])?

 A. <class 'list'>
 B. <type 'list'>
 C. list
 D. <list>

Answer: A

4. Which one of the following is used to define a block of code in Python?

 A. Curly braces
 B. Parenthesis
 C. Indentation
 D. Quotation

Answer: C

5. Which keyword is used for function in Python?

 A. define
 B. def
 C. function
 D. fun

Answer: B

6. What data type is the object below?


x = [1, 2, 3]

 A. List
 B. Dictionary
 C. Tuple
 D. Array

Answer: A

7. Which of the following functions can help us to find the version of python that we are
currently working on?

 A. sys.version(1)
 B. sys.version()
 C. sys.version
 D. sys.version[]

Answer: C

8. Which operator is used to check whether two variables are equal in Python?

 A. =
 B. ==
 C. !=
 D. ><

Answer: B

9. What is the correct file extension for Python files?

 A. .pt
 B. .pyt
 C. .py
 D. .p

Answer: C
10. How do you insert COMMENTS in Python code?

 A. // This is a comment
 B. /* This is a comment */
 C. # This is a comment
 D. <!-- This is a comment -->

Answer: C

11. Which one is the immutable data type in Python?

 A. List
 B. Dictionary
 C. Set
 D. Tuple

Answer: D

12. What will be the output of: print(bool(0))?

 A. True
 B. False
 C. None
 D. 0

Answer: B

13. Which of the following is the correct way to create a function in Python?

 A. function myFunc():
 B. def myFunc():
 C. create myFunc():
 D. function:myFunc()

Answer: B

14. Which of these is not a core data type in Python?

 A. Lists
 B. Dictionary
 C. Tuples
 D. Class
Answer: D

15. Which keyword is used for loop in Python?

 A. repeat
 B. loop
 C. for
 D. iterate

Answer: C

You might also like