menu

Python Concurrency and Parallelism


1. Which of the following is an advantage of using threads instead of processes in Python?

They can share state more easily.

They can be more efficient than using processes.

They can be easier to synchronize.

They can be easier to debug.


2. Which method is used to submit a task to a process pool in Python?

submit()

start()

create()

initiate()


3. Which of the following is a tool for detecting and debugging concurrency issues in Python?

PyCharm

Black

Flake8

Pyroscope


4. Which of the following is an example of a common use case for multiprocessing in Python?

Web scraping

GUI programming

Numerical computation

Database programming


5. Which method is used to cancel a running task in Python?

cancel()

stop()

terminate()

kill()


6. Which module is used to create and manage asynchronous I/O in Python?

threading

multiprocessing

asyncio

concurrent.futures


7. Which method is used to create a process in Python?

start()

run()

create()

initiate()


8. Which of the following is an advantage of using concurrent.futures module in Python?

It allows for more efficient use of CPU resources.

It allows for better memory management.

It allows for easier synchronization between tasks.

It allows for better handling of I/O bound tasks.


9. Which of the following is an example of a common use case for multithreading in Python?

Machine learning

GUI programming

Web scraping

Database programming


10. Which module is used to implement parallelism in Python using GPUs?

multiprocessing

concurrent.futures

asyncio

numba