CBSE Class 11 Computer Science
Question 121 of 161
Flow of Control — Question 30
Back to all questions 30
Question Question 13
In the nested for loop code below, how many times is the condition of the if clause evaluated?
for i in range(4):
for j in range(5):
if i + 1 == j or j + i == 4:
print ("+", end = ")
else:
print ("o", end = ")
print()Answer
Outer loop executes 4 times. For each iteration of outer loop, inner loop executes 5 times. Therefore, the total number of times the condition of the if clause gets evaluated is 4 * 5 = 20.