Question

# 4. In order to understand what a program tries to accomplish, it is essential to be...

4. In order to understand what a program tries to accomplish, it is essential to be able to follow the flow of control. In the following example, what happens when x = 4?

while True: for x in range(6):

y = 2*x+1

print(y)

if y>9:

break

(a) The program breaks out of the while loop and stops running

(b) The program breaks out of the for loop, but the while condition continues to be True, resulting in an infinite loop.

(c) The program does not break, but simply continues processing the for loop.

(a) Not true . because here while loop does not break ,it's infinite loop. because there is no condition to break while loop.

(b) Not true . because here when x=4 then y = 2 *4+1 = 9 .

if 9>9 :      condition not satisfy so, for loop not break. for loop will countinue.

(c)True .

because when x=4 then y = 9 and ( if 9>9 ) condition not satisfy.

so, for loop will countinue. when x=5 then y=11 and (if 11>9) condition satisfy.so , for loop breaks out.

but, here while loop does not break. so , again and again for loop processing.

so, correct option is (c).