NIELIT O Level Exam

<p>What will be printed?</p><pre>x = 5<br>def f():<br>&nbsp; &nbsp; global x<br>&nbsp; &nbsp; x = 10<br>f()<br>print(x)</pre>

What will be printed?

x = 5
def f():
    global x
    x = 10
f()
print(x)


निम्न code क्या print करेगा?

x = 5
def f():
    global x
    x = 10
f()
print(x)


A. 5

B. 10

C. Error

D. None




Correct Answer is :

B. 10



Explanation
global x allows the function to modify the global variable.

global x function को global x की value बदलने की अनुमति देता है।
Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad