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