Python Concurrency and Parallelism
Python Concurrency and Parallelism - Important Points
21. | Which of the following is an example of a common use case for multithreading in Python? |
---|
A. Machine learning
B. GUI programming
C. Web scraping
D. Database programming
View Answer Discuss Work SpaceAnswer: option b
Explanation:
22. | What is the difference between concurrency and parallelism? |
---|
A. Concurrency refers to the ability to execute multiple tasks simultaneously, while parallelism refers to the ability to execute multiple tasks on multiple processors simultaneously.
B. Concurrency refers to the ability to execute multiple tasks on multiple processors simultaneously, while parallelism refers to the ability to execute multiple tasks simultaneously.
C. Concurrency refers to the ability to execute multiple tasks on a single processor simultaneously, while parallelism refers to the ability to execute multiple tasks on multiple processors simultaneously.
D. Concurrency and parallelism are the same thing.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
23. | What is the Global Interpreter Lock (GIL) in Python? |
---|
A. A mechanism that ensures only one thread can execute Python bytecode at a time.
B. A mechanism that allows multiple threads to execute Python bytecode simultaneously.
C. A mechanism that allows multiple processes to execute Python bytecode simultaneously.
D. A mechanism that prevents Python code from being executed on more than one processor at a time.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
24. | Which of the following is an example of a concurrency bug in Python? |
---|
A. A race condition
B. A deadlock
C. A livelock
D. A memory leak
View Answer Discuss Work SpaceAnswer: option a
Explanation:
25. | Which of the following is a tool for detecting and debugging concurrency issues in Python? |
---|
A. PyCharm
B. Black
C. Flake8
D. Pyroscope
View Answer Discuss Work SpaceAnswer: option d
Explanation: