Python Features MCQs - 25 Multiple Choice Questions
1. Which of the following is a feature of Python?
A) Strongly typed
B) Compiled language
C) Dynamically typed
D) All of the above
Answer: C
A) Strongly typed
B) Compiled language
C) Dynamically typed
D) All of the above
Answer: C
2. Python supports:
A) Object-oriented programming
B) Functional programming
C) Procedural programming
D) All of the above
Answer: D
A) Object-oriented programming
B) Functional programming
C) Procedural programming
D) All of the above
Answer: D
3. Which of the following is true about Python lists?
A) Lists are immutable
B) Lists can contain different data types
C) Lists can only contain integers
D) Lists are fixed size
Answer: B
A) Lists are immutable
B) Lists can contain different data types
C) Lists can only contain integers
D) Lists are fixed size
Answer: B
4. What is the output of the expression 3 * 'Python'?
A) 3Python
B) PythonPythonPython
C) Error
D) Python3
Answer: B
A) 3Python
B) PythonPythonPython
C) Error
D) Python3
Answer: B
5. Which of the following is NOT a built-in data type in Python?
A) List
B) Dictionary
C) Array
D) Tuple
Answer: C
A) List
B) Dictionary
C) Array
D) Tuple
Answer: C
6. How does Python handle memory management?
A) Manual memory management
B) Automatic garbage collection
C) Static allocation
D) None of the above
Answer: B
A) Manual memory management
B) Automatic garbage collection
C) Static allocation
D) None of the above
Answer: B
7. What feature allows Python to handle large amounts of data efficiently?
A) Dynamic typing
B) List comprehensions
C) Generator expressions
D) All of the above
Answer: D
A) Dynamic typing
B) List comprehensions
C) Generator expressions
D) All of the above
Answer: D
8. What is the purpose of the `__init__` method in Python?
A) To initialize a class
B) To create a function
C) To create an instance of a class
D) To terminate a class
Answer: C
A) To initialize a class
B) To create a function
C) To create an instance of a class
D) To terminate a class
Answer: C
9. Which of the following features is used for code reuse in Python?
A) Functions
B) Modules
C) Classes
D) All of the above
Answer: D
A) Functions
B) Modules
C) Classes
D) All of the above
Answer: D
10. What type of programming paradigm does Python support?
A) Imperative
B) Declarative
C) Object-oriented
D) All of the above
Answer: D
A) Imperative
B) Declarative
C) Object-oriented
D) All of the above
Answer: D
11. How can you create a virtual environment in Python?
A) venv
B) virtualenv
C) pyenv
D) All of the above
Answer: D
A) venv
B) virtualenv
C) pyenv
D) All of the above
Answer: D
12. Which feature of Python makes it suitable for rapid application development?
A) Simple syntax
B) Extensive libraries
C) Interpreted nature
D) All of the above
Answer: D
A) Simple syntax
B) Extensive libraries
C) Interpreted nature
D) All of the above
Answer: D
13. What is the significance of indentation in Python?
A) It determines the flow of control
B) It is used for comments
C) It is not significant
D) It is used for variable declarations
Answer: A
A) It determines the flow of control
B) It is used for comments
C) It is not significant
D) It is used for variable declarations
Answer: A
14. Which of the following can be used to handle exceptions in Python?
A) try/except
B) if/else
C) for/while
D) None of the above
Answer: A
A) try/except
B) if/else
C) for/while
D) None of the above
Answer: A
15. What feature allows you to define functions with variable-length arguments?
A) Default arguments
B) Keyword arguments
C) *args and **kwargs
D) None of the above
Answer: C
A) Default arguments
B) Keyword arguments
C) *args and **kwargs
D) None of the above
Answer: C
16. How can you concatenate two lists in Python?
A) list1.add(list2)
B) list1.append(list2)
C) list1 + list2
D) list1.concat(list2)
Answer: C
A) list1.add(list2)
B) list1.append(list2)
C) list1 + list2
D) list1.concat(list2)
Answer: C
17. Which of the following is a feature of Python’s dictionaries?
A) Ordered
B) Mutable
C) Indexed
D) All of the above
Answer: B
A) Ordered
B) Mutable
C) Indexed
D) All of the above
Answer: B
18. What is the output of the expression `5 is 5`?
A) True
B) False
C) None
D) Error
Answer: A
A) True
B) False
C) None
D) Error
Answer: A
19. How do you define a class in Python?
A) class ClassName:
B) define ClassName:
C) new ClassName:
D) None of the above
Answer: A
A) class ClassName:
B) define ClassName:
C) new ClassName:
D) None of the above
Answer: A
20. Which of the following statements about Python’s `map()` function is true?
A) It applies a function to all items in an input list
B) It only works with lists
C) It modifies the original list
D) None of the above
Answer: A
A) It applies a function to all items in an input list
B) It only works with lists
C) It modifies the original list
D) None of the above
Answer: A
21. What is a lambda function in Python?
A) A function defined using the def keyword
B) An anonymous function
C) A function that returns another function
D) None of the above
Answer: B
A) A function defined using the def keyword
B) An anonymous function
C) A function that returns another function
D) None of the above
Answer: B
22. Which feature of Python allows for easy debugging?
A) Dynamic typing
B) Extensive libraries
C) Readable syntax
D) None of the above
Answer: C
A) Dynamic typing
B) Extensive libraries
C) Readable syntax
D) None of the above
Answer: C
23. What feature of Python helps in creating web applications?
A) Django
B) Flask
C) Pyramid
D) All of the above
Answer: D
A) Django
B) Flask
C) Pyramid
D) All of the above
Answer: D
24. What is the primary purpose of the `self` keyword in Python?
A) To refer to the instance of a class
B) To refer to the class itself
C) To create a new instance
D) None of the above
Answer: A
A) To refer to the instance of a class
B) To refer to the class itself
C) To create a new instance
D) None of the above
Answer: A
25. Which of the following is used for web scraping in Python?
A) Beautiful Soup
B) NumPy
C) Matplotlib
D) SciPy
Answer: A
A) Beautiful Soup
B) NumPy
C) Matplotlib
D) SciPy
Answer: A
0 Comments