Python Concurrency and Parallelism
Python Concurrency and Parallelism - Important Points
26. | Which of the following is an example of a parallel algorithm? |
---|
A. Merge sort
B. Bubble sort
C. Quick sort
D. Insertion sort
View Answer Discuss Work SpaceAnswer: option a
Explanation:
27. | Which of the following is a disadvantage of using multiprocessing in Python? |
---|
A. It can be more difficult to share state between processes.
B. It can be less efficient than using threads.
C. It can be more difficult to synchronize tasks between processes.
D. It can be more difficult to detect and debug issues in multiprocessing code.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
28. | Which of the following is an advantage of using threads instead of processes in Python? |
---|
A. They can share state more easily.
B. They can be more efficient than using processes.
C. They can be easier to synchronize.
D. They can be easier to debug.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
29. | Which of the following is a method of creating a new thread in Python? |
---|
A. Using the multiprocessing module
B. Using the threading module
C. Using the concurrent.futures module
D. Using the asyncio module
View Answer Discuss Work SpaceAnswer: option b
Explanation:
30. | What is the purpose of the concurrent.futures module in Python? |
---|
A. To provide a simple way to create and manage threads and processes.
B. To provide a way to execute code concurrently using coroutines.
C. To provide a way to execute code concurrently using threads and processes.
D. To provide a way to manage and control concurrency in Python code.
View Answer Discuss Work SpaceAnswer: option c
Explanation: