what will be the output of the following python code MCQ question

what-will-be-the-output-of-the-following-python-code

1. what will be the output of the following python code?

name = 'webwoob'
name = 'programmer'
print(name)

A. programmer
B. throw error
C. webwoob
D. None of the above

ANSWER: A

2. what will be the output of the following python code?

y = 10
for i in range(y):
    print(i)

A. 10
B. throw error
C. 0,1,2,3,4,5,6,7,8,9
D. None of the above

ANSWER: A

3. what will be the output of the following python code?

i = '4'
print(int(i) + 2)

A. 6
B. 2
C. throw error
D. None of the above

ANSWER: A

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. throw error
D. None of the above

ANSWER: A

5. what will be the output of the following python code?

sum = 1 + 1 - 2
print(sum)

A. -1
B. 0
C. throw error
D. 2

ANSWER: B

6. what will be the output of the following python code?

for k in range(0):
print(k)

A. -1
B. 0
C. throw error
D. No Output

ANSWER: D

7. what will be the output of the following python code?

for i in range(10):
i + 1

A. 2
B. 12
C. throw error
D. None of the above

ANSWER: A

8. what will be the output of the following python code?

name = 'webwoob'
print(name)

A. name
B. coder
C. throw error
D. None of the above

ANSWER: B

9. what will be the output of the following python code?

numbers = [1, 2, 3, 4] 
numbers.append([5,6,7,8]) 
print(len(numbers))

A. 4
B. 5
C. 12
D. 8

ANSWER: B

Also Read:- Priority Scheduling Program In C

Leave a Reply

Your email address will not be published. Required fields are marked *