Quiz 2

Test what you have learnt so far.

We'll cover the following...

Question # 1

Consider the snippet below:

from multiprocessing import Value, Lock


lock = Lock()
pi = Value('d', 3.1415, lock=lock)

lock.acquire()
print(pi.value)
lock.release()
Q

What will be the output of running the above snippet?

A)

Deadlock

B)

3.1415 is printed on the console

C)

Error is raised

Press + to interact
from multiprocessing import Value, Lock
lock = Lock()
pi = Value('d', 3.1415, lock=lock)
lock.acquire()
print(pi.value)
lock.release()
...