Report Bug

Qus

What will be printed?

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

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

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


A. 10 10
B. 20 20
C. 20 10
D. Error


Solution
C. 20 10



Explanation
<p><span style="font-size: 14px;">The x inside f() is local (20), while the outside x remains 10.</span></p><p><span style="font-size: 14px;"><br></span></p><p><span style="font-size: 14px;">Function के अंदर x local variable है जिसकी value 20 है, जबकि global x की value 10 ही रहती है।</span></p>
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