NIELIT O Level Exam

<p>What is the output of following?</p><pre>a = [1, 2, 3]<br>b = a<br>b.append(4)<br>print(a)</pre>

What is the output of following?

a = [1, 2, 3]
b = a
b.append(4)
print(a)


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

a = [1, 2, 3]
b = a
b.append(4)
print(a)

A. [1, 2, 3]

B. [1, 2, 3, 4]

C. Error

D. [4]




Correct Answer is :

B. [1, 2, 3, 4]



Explanation
a and b refer to the same list object, so modifying b also changes the list seen through a.

a और b एक ही list object को refer करते हैं, इसलिए b में change करने पर a में भी वही change दिखाई देता है।
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