Computer Science, asked by niyathipoojary2001, 6 months ago


1. What will be the output of the following Python code?
True = False
while True:
print(True)
break *​

Answers

Answered by DivBro
24

Answer:

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “While and For Loops”.

1. What will be the output of the following Python code?

advertisement

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

View Answer

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

View Answer

3. What will be the output of the following Python code?

advertisement

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

View Answer

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

View Answer

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

View Answer

advertisement

6. What will be the output of the following Python code?

i = 5

while True:

if i%0O9 == 0:

break

print(i)

i += 1

a) 5 6 7 8

b) 5 6 7 8 9

c) 5 6 7 8 9 10 11 12 13 14 15 ….

d) error

View Answer

7. 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 …

View Answer

8. What will be the output of the following Python code?

advertisement

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

View Answer

9. 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

View Answer

10. 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

View Answer

Similar questions