Home » Programming Language (coding) » Python MCQs » Python MCQ Questions and Answers (Part – 2)

Python MCQ Questions and Answers (Part – 2)

(Q) What is the output of the following?

try:
    if '1' != 1:
        raise "someError"
    else:
        print("someError has not occurred")
except "someError":
    print ("someError has occurred")

A. someError has occured
B. someError has not occured
C. invalid code
D. none of the mentioned

C. invalid code

Discuss Answer


(Q) Which one of these is floor division?

A. //
B. /
C. %
D. None of the mentioned


(Q) Which of the following expressions results in an error?

A. int(‘1011’)
B. int(1011,2)
C. int(‘1011’,23)
D. int(1011)

B. int(1011,2)

Discuss Answer


(Q) What error will occur when you execute the following code?

MANGO = APPLE

A. NameError
B. SyntaxError
C. TypeError
D. ValueError

A. NameError

Discuss Answer


(Q) Study the following statement:

>>>"a"+"bc"

What will be the output of this statement?

A. a+bc
B. abc
C. a bc
D. a

B. abc

Discuss Answer


(Q) Which of the following option is not a core data type in the python language?

A. Dictionary
B. Lists
C. Class
D. All of the above

C. Class

Discuss Answer


(Q) Study the following statements:

>>> print(ord('h') - ord('z'))

A. 18
B. -18
C. 17
D. -17

B. -18

Discuss Answer


(Q) All keywords in Python are in _

A. UPPER CASE
B. Capitalized
C. lower case
D. None of the mentioned

D. None of the mentioned

Discuss Answer


Parts of Python MCQ Questions & Answers:

Take Part in Discussion:

Your email address will not be published.

Solve : *
23 + 11 =