NIELIT O Level Exam

<p>What will be printed?</p><pre><span style="font-size: 14px;">x = 10<br></span><span style="font-size: 14px;">def f():<br></span><span style="font-size: 14px;">&nbsp; &nbsp; x = 20<br></span><span style="font-size: 14px;">&nbsp; &nbsp; print(x)<br></span><span style="font-size: 14px;">f()<br></span><span style="font-size: 14px;">print(x)</span></pre>

What will be printed?

x = 10
def f():
    x = 20
    print(x)
f()
print(x)


निम्न code का output क्या होगा?

x = 10
def f():
    x = 20
    print(x)
f()
print(x)

A. 10 10

B. 20 20

C. 20 10

D. Error




Correct Answer is :

C. 20 10



Explanation

The x inside f() is local (20), while the outside x remains 10.


Function के अंदर x local variable है जिसकी value 20 है, जबकि global x की value 10 ही रहती है।

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