Question 4 (Beginner):
Which of the following is not a valid Python data type?
A) tuple
B) map
C) set
D) float
#Python #DataTypes #Beginner #ProgrammingQuiz #LearnPython
Which of the following is not a valid Python data type?
A) tuple
B) map
C) set
D) float
#Python #DataTypes #Beginner #ProgrammingQuiz #LearnPython
❤1
Advanced Python Test
1. What is the output of the following code?
A) [0, 1] [0, 1, 4] [0, 1, 4]
B) [0, 1] [0, 1, 4] [0, 1, 4, 0, 1, 4]
C) [0, 1] [0, 1, 4] [0, 1, 4, 0, 1, 4, 0, 1, 4]
D) [0, 1] [0, 1, 4] [0, 1, 4, 0, 1, 4, 0, 1, 4, 0, 1, 4]
2. Which statement about metaclasses in Python is TRUE?
A) A metaclass is used to create class instances
B) The
C) All classes must explicitly specify a metaclass
D) Metaclasses cannot inherit from other metaclasses
3. What does this decorator do?
A) Measures function execution time
B) Logs function calls with arguments
C) Prints the function name when called
D) Prevents function execution in debug mode
4. What is the purpose of context managers?
A) To manage class inheritance hierarchies
B) To handle resource allocation and cleanup
C) To create thread-safe operations
D) To optimize memory usage in loops
#Python #AdvancedPython #CodingTest #ProgrammingQuiz #PythonDeveloper #CodeChallenge
By: t.iss.one/DataScienceQ 🚀
1. What is the output of the following code?
def func(x, l=[]):
for i in range(x):
l.append(i * i)
return l
print(func(2))
print(func(3, []))
print(func(3))
A) [0, 1] [0, 1, 4] [0, 1, 4]
B) [0, 1] [0, 1, 4] [0, 1, 4, 0, 1, 4]
C) [0, 1] [0, 1, 4] [0, 1, 4, 0, 1, 4, 0, 1, 4]
D) [0, 1] [0, 1, 4] [0, 1, 4, 0, 1, 4, 0, 1, 4, 0, 1, 4]
2. Which statement about metaclasses in Python is TRUE?
A) A metaclass is used to create class instances
B) The
__call__
method of a metaclass controls instance creation C) All classes must explicitly specify a metaclass
D) Metaclasses cannot inherit from other metaclasses
3. What does this decorator do?
from functools import wraps
def debug(func):
@wraps(func)
def wrapper(*args, **kwargs):
print(f"Calling {func.__name__}")
return func(*args, **kwargs)
return wrapper
A) Measures function execution time
B) Logs function calls with arguments
C) Prints the function name when called
D) Prevents function execution in debug mode
4. What is the purpose of context managers?
A) To manage class inheritance hierarchies
B) To handle resource allocation and cleanup
C) To create thread-safe operations
D) To optimize memory usage in loops
#Python #AdvancedPython #CodingTest #ProgrammingQuiz #PythonDeveloper #CodeChallenge
By: t.iss.one/DataScienceQ 🚀
Telegram
Python Data Science Jobs & Interviews
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.
Admin: @Hussein_Sheikho
Admin: @Hussein_Sheikho
❤3