MCQ Answer

<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)

Topic : Functions in Python

A. 5

B. 10

C. Error

D. None




Correct Answer is :

B. 10



Explanation
global x allows the function to modify the global variable. <br><br> global x function को global x की value बदलने की अनुमति देता है।
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad