How do you import a module in Python?
Anonymous Quiz
60%
using the import keyword
20%
using the include keyword
20%
using the require keyword
0%
using the module keyword
🔥1
What is the difference between arguments and parameters in Python functions?
Anonymous Quiz
0%
No difference
100%
Parameters define, arguments call
0%
Arguments define, parameters call
0%
Based on data type
🔥1
In Python, what is the purpose of the try statement?
Anonymous Quiz
60%
To test a block of code for errors
40%
To execute code regardless of errors
0%
To generate an error
0%
To declare variables
🔥1
Which exception is raised by Python when a file you try to open does not exist?
Anonymous Quiz
80%
FileNotFoundError
20%
IOError
0%
OSError
0%
ValueError
🔥1
When is the else clause in a try-except block executed?
Anonymous Quiz
0%
Always after the try block
75%
When no exceptions are raised
25%
When an exception is handled
0%
It is never executed
🔥1
What is a list comprehension in Python?
Anonymous Quiz
25%
A concise way to create lists
0%
A method to iterate through lists
75%
A type of Python comprehension
0%
A special function for lists
🔥1
What is the key difference between list comprehensions and generator expressions?
Anonymous Quiz
25%
The syntax used
0%
The type of brackets used
75%
List comprehensions produce lists, while generator expressions produce generators
0%
Execution speed
🔥1
What will this list comprehension produce:
[x**2 for x in range(5)]
[x**2 for x in range(5)]
Anonymous Quiz
0%
[0, 1, 2, 3, 4]
17%
[1, 4, 9, 16, 25]
83%
[0, 1, 4, 9, 16]
0%
[1, 2, 3, 4, 5]
🔥1
What is a lambda expression in Python?
Anonymous Quiz
80%
A one-time anonymous function
20%
A named, reusable function
0%
A loop structure
0%
A data type
🔥1
How is a lambda function different from a regular function defined using def in Python?
Anonymous Quiz
60%
Lambda can only have one expression
0%
Lambda can return multiple values
20%
Lambda functions are faster
20%
Lambda functions can't have arguments
🔥1
What is the output of the following lambda expression?
(lambda x, y: x * y)(3, 4)
(lambda x, y: x * y)(3, 4)
Anonymous Quiz
17%
7
67%
12
0%
0
17%
Error
🔥1
What is a class in Python?
Anonymous Quiz
67%
A blueprint for creating objects
17%
A function inside an object
17%
A variable inside an object
0%
A specific object instance
🔥1
In Python, what is 'self' in a class method?
Anonymous Quiz
25%
A variable that holds the class name
25%
A reference to the class itself
50%
A reference to the instance that calls the method
0%
A placeholder for future arguments
🔥1
What will this list comprehension produce:
[x**2 for x in range(5)]
[x**2 for x in range(5)]
Anonymous Quiz
0%
[0, 1, 2, 3, 4]
29%
[1, 4, 9, 16, 25]
57%
[0, 1, 4, 9, 16]
14%
[1, 2, 3, 4, 5]
🔥1
In OOP, what is the benefit of using encapsulation?
Anonymous Quiz
50%
Improved code organization
0%
Code reusability
50%
Enhanced code readability
0%
Increased system performance
🔥1
