What will be the output of the following Python code?
i = 2while True: if i%3 == 0: break print(i) i += 2
2 4 6 8 10 …
2 4
2 3
error
do..while
while
for
if..elif
What will be the output after the following statements?
for i in range(1,6): print(i, end='') if i == 3: break
1 2
1 2 3
1 2 3 4
1 2 3 4 5
for i in range(5): if i == 5: break else: print(i)else: print("Here")
0 1 2 3 4 Here
0 1 2 3 4 5 Here
0 1 2 3 4
i = 1while False: if i%2 == 0: break print(i) i += 2
1
1 3 5 7 …
1 2 3 4 …
Nothing will be printed
What will be the output of the following Python code snippet?
x = 2for i in range(x): x += 1 print (x)
0 1 2 3 4 …
3 4
0
x = "abcdef"while i in x: print(i, end=" ")
a b c d e f
abcdef
i i i i i i …
Selection
Sequential
Simple
Loop
for i in range(2.0): print(i)
0.0 1.0
0 1
none of the mentioned
x = 'abcd'for i in range(x): print(i)
a b c d
0 1 2 3
x = "abcdef"i = "i"while i in x: print(i, end=" ")
no output
i = 1while True: if i%7 == 0: break print(i) i += 1
1 2 3 4 5 6
1 2 3 4 5 6 7
What is the output of the following code?
for i in range(3): print(i,end=" ")
0 1 2
Error
i = 1while True: if i%2 == 0: break print(i) i += 2
1 2 3 4 5 6 …
1 3 5 7 9 11 … infinite time
True
False
Infinite
NULL
for i in range(0): print(i)
count=0while count<3: print(count,end=" ") count+=1
a = 0b = 3while a + b < 8: a += 1 print(a, end='')
None of these
x = "abcdef"i = "a"while i in x: print(i, end = " ")
a a a a a a …
i = 0while i < 3: print(i) i += 1else: print(0)
0 1 2 3 0
0 1 2 0
for i in range(int(2.0)): print(i)
x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x)
[‘AB’, ‘CD’]
[‘ab’, ‘cd’, ‘AB’, ‘CD’]
[‘ab’, ‘cd’]
Infinite Loop
x = 'abcd' for i in range(len(x)): x = 'a' print(x)
a
abcd abcd abcd
a a a a
x = 'abcd' for i in range(len(x)): print(x) x = 'a'
abcd abcd abcd abcd
What is the output of the following program:
i = 0while i < 3: print (i) i=i+1 print (i+1)
0 2 1 3 2 4
0 1 2 3 4 5
Infinite loop
Both A and B
None of the above
x = 'abcd'for i in range(len(x)): i.upper()print (x)
colon
comma
semicolon
hyphen
x = 'abcd'for i in range(len(x)): print(i)
x = "abcdef" i = "a" while i in x: print('i', end = " ")
i i i i i i … infinite Time
What value does the following expression evaluate to ?
x = 5while x < 10: print(x, end='')
Closed loop
one time loop
Evergreen loop
; (semicolon)
,(Comma)
: (colan)
11
8
x = 'abcd'for i in range(len(x)): print(i.upper())
Entry Controlled Loop
Exit Controlled Loop
Both of the above