NIELIT O Level Exam

<p>What will be the output of the following Python code?</p><pre>myList = [1, 5, 5, 5, 5, 1]<br>max = myList[0]<br>indexOfMax = 0<br>for i in range(1, len(myList)):<br>&nbsp; &nbsp; if myList[i] &gt; max:<br>&nbsp; &nbsp; &nbsp; &nbsp; max = myList[i]<br>&nbsp; &nbsp; &nbsp; &nbsp; indexOfMax = i&nbsp; &nbsp;<br>print(indexOfMax)</pre>

What will be the output of the following Python code?

myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
    if myList[i] > max:
        max = myList[i]
        indexOfMax = i   
print(indexOfMax)


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

myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
    if myList[i] > max:
        max = myList[i]
        indexOfMax = i   
print(indexOfMax)

A. 1

B. 2

C. 3

D. 4




Correct Answer is :

A. 1



Explanation
First time the highest number is encountered is at index 1.
Latest Current Affairs 2025 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