Question Bank

3705 approved questions from the community

Decorators in Python heavily rely on the concept of closures.

EASY
TRUE FALSE
25s
Python
by Mohamed

List comprehensions are generally faster than equivalent for loops in Python.

MEDIUM
TRUE FALSE
25s
Python
by Mohamed

What is a generator function in Python?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed

What are the three requirements to create a closure in Python?

MEDIUM
SINGLE CHOICE
40s
Python
by Mohamed

When multiple decorators are stacked on a function, in what order are they applied?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed

In Python, when you assign a variable to another variable (e.g., b = a), you are creating a reference to the same object, not a copy.

EASY
TRUE FALSE
25s
Python
by Mohamed

In Python, using two underscores before a variable name (e.g., __variable) makes it truly private and completely inaccessible from outside the class.

EASY
TRUE FALSE
30s
Python
by Mohamed

In Python, you can add a list as an element to a set.

MEDIUM
TRUE FALSE
25s
Python
by Mohamed

In Python's object creation process, which method is called first: __new__() or __init__()?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed

What is the primary difference between class variables and instance variables?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed

Python 3.8 introduced the walrus operator (:=) which allows assignment within expressions.

EASY
TRUE FALSE
25s
Python
by Mohamed

Python 3.13 introduced an experimental JIT compiler that can transform bytecode sequences directly into machine code.

MEDIUM
TRUE FALSE
30s
Python
by Mohamed

What is sys.getrefcount() used for in Python?

MEDIUM
SINGLE CHOICE
30s
Python
by Mohamed

How can you define a Python dictionary where multiple keys have the same value efficiently?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed

What is the recommended way to merge two dictionaries in Python 3.5+?

EASY
SINGLE CHOICE
30s
Python
by Mohamed

What is the purpose of Python's Generational Garbage Collector?

HARD
SINGLE CHOICE
45s
Python
by Mohamed

What is the difference between an expression and a statement in Python?

EASY
SINGLE CHOICE
30s
Python
by Mohamed

What is an abstract class in Python?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed

Why does calling a function repeatedly with a mutable default argument (like []) cause unexpected behavior?

HARD
SINGLE CHOICE
40s
Python
by Mohamed

What is the key characteristic of Python's 'range' type?

MEDIUM
SINGLE CHOICE
35s
Python
by Mohamed
PreviousPage 120 of 186Next