Question 43Asked in Bihar STET 2025 Paper II Computer Science, 7 Nov 2025, Shift 1 (9:00 AM)

What will be the output of the following code segment? a = 5निम्‍नलिखित कोड सेगमेंट का आउटपुट क्‍या होगा?

What will be the output of the following code segment? a = 5 def func_1(b=10): global a a=b-10 b+=a print (a,b) func_1(a)
निम्‍नलिखित कोड सेगमेंट का आउटपुट क्‍या होगा? a = 5 def func_1(b=10): global a a=b-10 b+=a print (a,b) func_1(a)
  1. A0 50 5
  2. B5 05 0
  3. C0 -50 -5
  4. D-5 0-5 0
Show answerHide answer

Correct answer: (D) -5 0-5 0

Explanation

func_1(5) is called, so b = 5. The function declares a as global, sets a = 5 − 10 = −5, then b += a makes b = 0, and it prints "-5 0".func_1(5) बुलाया जाता है, इसलिए b = 5। फ़ंक्शन a को global घोषित करता है, a = 5 − 10 = −5 करता है, फिर b += a से b = 0 होता है, और वह "-5 0" प्रिंट करता है।

From Bihar STET 2025 Paper II Computer Science PYQ, 7 Nov 2025, Shift 1 (9:00 AM)

This is question 43 of Bihar STET 2025 Paper II Computer Science PYQ, 7 Nov 2025, Shift 1 (9:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.