Python Quiz
VISHAL B G 2341669
Created on September 5, 2024
More creations to inspire you
TRUE FALSE GEOGRAPHY
Quizzes
ENGLISH SCHOOL VOCABULARY
Quizzes
PARTS OF SPEECH REVIEW
Quizzes
ANIMALS BY CATEGORY
Quizzes
DRACULA ESL
Quizzes
MODALS 1 BACH MARIO GAME
Quizzes
RECYCLING SORTING GAME
Quizzes
Transcript
<
>
PYTHON
Quiz
start>
Which of the following statements about Python's Global Interpreter Lock (GIL) is true?
question 1 of 5
It allows multiple threads to execute simultaneously in Python.
It prevents multiple threads from executing simultaneously, even on multi-core processors.
It is only applicable to Python 2.x and not Python 3.x.
>
CORRECT!
What does the nonlocal keyword do in Python?
question 2 of 5
It declares a variable as global, allowing it to be modified anywhere in the code.
It is used to declare a variable that is local to a specific block or function.
It allows a variable defined in an inner function to refer to a variable in the nearest enclosing scope.
>
CORRECT!
Which of the following is true about Python's memory management?
question 3 of 5
BOTH
Python uses a reference counting algorithm for memory management.
Python has automatic garbage collection using a mark-and-sweep algorithm.
>
CORRECT!
Which of the following is true regarding Python's generators?
question 4 of 5
Generators use less memory than lists because they generate items on-the-fly.
Generators can be iterated over multiple times.
Generators can be created using a yield statement or list comprehensions.
>
CORRECT!
Which of the following statements is true about Python's @staticmethod decorator?
question 5 of 5
A staticmethod can modify the class state that applies across all instances of the class.
A staticmethod is required to modify instance state directly from the method.
A staticmethod does not receive any implicit first argument, and it cannot access or modify the class or instance state.
>
CORRECT!
Quiz completed
I
<
/
>
>
¡Oh, no!