Report Bug

Qus: <p>What will be the output of the following code?</p><pre><span style="font-size: 14px;">for i in range(1,5):<br></span><span style="font-size: 14px;">&nbsp; &nbsp; if i == 3:<br></span><span style="font-size: 14px;">&nbsp; &nbsp; &nbsp; &nbsp; break<br></span><span style="font-size: 14px;">&nbsp; &nbsp; print(i, end=" ")</span></pre>

Qus<p>निम्न code का output क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;"><span style="font-size: 14px;">for i in range(1,5):<br></span><span style="font-size: 14px;">&nbsp; &nbsp; if i == 3:<br></span><span style="font-size: 14px;">&nbsp; &nbsp; &nbsp; &nbsp; break<br></span><span style="font-size: 14px;">&nbsp; &nbsp; print(i, end=" ")</span></pre>


A. 1 2 3
B. 1 2 3 4
C. 1 2 4
D. 1 2


Solution
D. 1 2



Explanation
When i becomes 3, break terminates the loop before print() executes for 3. <br><br> i = 3 होने पर break loop को तुरंत समाप्त कर देता है, इसलिए केवल 1 और 2 print होते हैं।
Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test , CCC MCQ Python Coding Tutorials Best Computer Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Website development Company in Allahabad