What will be the output of following code? import threading k = 10 x = 0 m = threading.Lock() def foo(): global x for i in xrange(k): with m: x += 1 def bar(): global x for i in xrange(k): with m: x -= 1 t1 = threading.Thread(target=foo) t2 = threading.Thread(target=bar) t1.start() t2.start() t1.join() t2.join() print x
Correct Answer: It will raise an exception.
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Python MCQ Questions