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