Looping
1.

What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
    i.upper()
print(x)
A.  

[‘ab’, ‘cd’]

B.  

[‘AB’, ‘CD’]

C.  

[None, None]

D.  

none of the mentioned

2.

What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
    x.append(i.upper())
print(x)
A.  

[‘AB’, ‘CD’]

B.  

[‘ab’, ‘cd’, ‘AB’, ‘CD’]

C.  

[‘ab’, ‘cd’]

D.  

none of the mentioned

3.

What will be the output of the following Python code?

i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    i + = 1
A.  

1 2

B.  

1 2 3

C.  

error

D.  

none of the mentioned

4.

What will be the output of the following Python code?

i = 1
while True:
    if i%0O7 == 0:
        break
    print(i)
    i += 1
A.  

1 2 3 4 5 6

B.  

1 2 3 4 5 6 7

C.  

error

D.  

none of the mentioned

5.

What will be the output of the following Python code?

i = 5
while True:
    if i%0O11 == 0:
        break
    print(i)
    i += 1
A.  

5 6 7 8 9 10

B.  

5 6 7 8

C.  

5 6

D.  

error

6.

What will be the output of the following Python code?

i = 1
while True:
    if i%2 == 0:
        break
    print(i)
    i += 2
A.  

1

B.  

1 2

C.  

1 2 3 4 5 6 …

D.  

1 3 5 7 9 11 …

7.

What will be the output of the following Python code?

i = 2
while True:
    if i%3 == 0:
        break
    print(i)
    i += 2
A.  

2 4 6 8 10 …

B.  

2 4

C.  

2 3

D.  

error

8.

What will be the output of the following Python code?

i = 1
while False:
    if i%2 == 0:
        break
    print(i)
    i += 2
A.  

1

B.  

1 3 5 7 …

C.  

1 2 3 4 …

D.  

none of the mentioned

9.

What will be the output of the following Python code?

True = False
while True:
    print(True)
    break
A.  

True

B.  

False

C.  

None

D.  

none of the mentioned

10.

What will be the output of the following Python code?

i = 0
while i < 5:
    print(i)
    i += 1
    if i == 3:
        break
else:
    print(0)
A.  

0 1 2 0

B.  

0 1 2

C.  

error

D.  

none of the mentioned