MCQ Answer

<p>What will be the output of the following Python code?</p><pre><span style="font-size: 14px;">x = 'abcd'<br></span><span style="font-size: 14px;">for i in x:<br></span><span style="font-size: 14px;">&nbsp; &nbsp; print(i)<br></span><span style="font-size: 14px;">&nbsp; &nbsp; x.upper()</span></pre>

What will be the output of the following Python code?

x = 'abcd'
for i in x:
    print(i)
    x.upper()


निम्नलिखित Python कोड का आउटपुट क्या होगा?

x = 'abcd'
for i in x:
    print(i)
    x.upper()
Topic : Sequence data types in python

A. a B C D

B. a b c d

C. A B C D

D. error




Correct Answer is :

B. a b c d



Explanation
Changes do not happen in-place, rather a new instance of the string is returned.
CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials 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 Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz