Python Data Science Jobs & Interviews
19.6K subscribers
189 photos
4 videos
24 files
295 links
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
Download Telegram
Advanced Python Test

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 🚀
3