Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 4 : 99 / 99
Advertisement
Detailed Solution
सही उत्तर 99 / 99 है।
Key Points
Helpful?
Question:
What is the output of the following Python code involving try-except-finally? / try-except-finally वाले निम्नलिखित Python कोड का आउटपुट क्या होगा? try: x = 10 / 0 except ZeroDivisionError: x = -1 finally: x += 100 print(x)
1.
-1 / -1
2.
100 / 100
3.
Unhandled exception / अनियंत्रित अपवाद
4.
99 / 99
Correct Answer: 99 / 99
The division raises ZeroDivisionError, the handler sets x to -1, and the finally block always executes, making x = -1 + 100 = 99. / भाग से ZeroDivisionError उठता है, हैंडलर x को -1 करता है, और finally ब्लॉक हमेशा चलता है, अतः x = -1 + 100 = 99।
Downloaded from PrepSnap (prepsnap.in)