True or False
title: True or False keywords: [python, quiz, python quiz, dataidea, data science,] author: Juma Shafara description: Test your python basics knowledge with this True or Fals Quiz date: "2024-03"

For this Python Quiz Respond with Either True or False only. Answers are provided at the bottom.
- True or False: In Python, the
__init__method is called a constructor and is automatically invoked when a new instance of a class is created.
- True or False: The
globalkeyword allows you to modify a variable outside of the current scope.
- True or False: In Python,
argsandkwargsare used to pass a variable number of arguments to a function.
- True or False: Python's
setdata type does not allow duplicate elements and is unordered.
- True or False: The
mapfunction in Python applies a given function to each item of an iterable (like a list) and returns a list of the results.
- True or False: List comprehensions in Python can include conditional statements.
- True or False: In Python, the
finallyblock will be executed whether or not an exception is raised in thetryblock.
- True or False: The
selfparameter in class methods refers to the instance of the class.
- True or False: Python supports method overloading, which means you can define multiple methods with the same name but different arguments.
- True or False: The
isoperator compares the values of two objects to check for equality.
- True or False: The
yieldkeyword is used in Python to create a generator.
- True or False: In Python, a dictionary key must be immutable and unique.
- True or False: Python's
remodule can be used to perform operations on strings using regular expressions.
- True or False: The
delkeyword in Python can be used to delete an item from a list by index.
- True or False: In Python,
__name__ == "__main__"is used to check if the script is being run on its own or being imported somewhere else.
- True or False: Python's
copymodule provides a functiondeepcopyto create a deep copy of an object.
- True or False: The
superfunction in Python is used to call a method from the parent class.
- True or False: Python supports both procedural and object-oriented programming paradigms.
- True or False: The
joinmethod in Python is used to concatenate a list of strings into a single string, separated by a specified delimiter.
- True or False: Python's
functoolsmodule provides higher-order functions that act on or return other functions.
Answers
- True
- True
- True
- True
- False (The
mapfunction returns a map object, which is an iterator, not a list) - True
- True
- True
- False (Python does not support method overloading like other languages; you can define methods with default parameters instead)
- False (The
isoperator checks for object identity, not equality) - True
- True
- True
- True
- True
- True
- True
- True
- True
- True