Python Concurrency and Parallelism
Python Concurrency and Parallelism - Important Points
6. | Which module provides a high-level interface for asynchronously executing functions and methods? |
---|
A. threading
B. multiprocessing
C. concurrent.futures
D. asyncio
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The "asyncio" module provides a high-level interface for asynchronously executing functions and methods.
7. | Which keyword is used to define a Python function as a coroutine? |
---|
A. async
B. await
C. coroutine
D. yield
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The "async" keyword is used to define a Python function as a coroutine.
8. | Which function is used to run an asyncio event loop? |
---|
A. asyncio.run()
B. asyncio.loop()
C. asyncio.start()
D. asyncio.stop()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The "asyncio.run()" function is used to run an asyncio event loop.
9. | Which method is used to create a thread in Python? |
---|
A. start()
B. run()
C. create()
D. initiate()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The "start()" method is used to create a thread in Python.
10. | Which method is used to create a process in Python? |
---|
A. start()
B. run()
C. create()
D. initiate()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The "Process()" method is used to create a process in Python.