Learn Python MCQs

Prepare Python MCQs (Multiple choice Questions) for exam and job interviews.

What is the output of print("Python" == "python")?

1) True

2) False

3) None

4) Error

Answer : False

Which method can be used to remove an item from a set in Python?

1) remove()

2) discard()

3) pop()

4) All of the above

Answer : All of the above

How do you access the last element of a list in Python?

1) list[-1]

2) list[len(list)]

3) list.last()

4) list.getLast()

Answer : list[-1]

What is the output of print(type([1, 2, 3]))?

1) <class 'list'>

2) <type 'list'>

3) list

4) Error

Answer : <class 'list'>

Which of the following is used to import a module in Python?

1) import module

2) include module

3) require module

4) module import

Answer : import module

What is the output of print("abc" == "ABC")?

1) True

2) False

3) None

4) Error

Answer : False

How do you create a for loop in Python?

1) for i in range(5):

2) for i = 0; i < 5; i++:

3) foreach i in range(5):

4) loop i in range(5):

Answer : for i in range(5):

Which of the following is a mutable data type in Python?

1) list

2) tuple

3) string

4) All of the above

Answer : list

What is the output of print("3" + 2)?

1) Error

2) 32

3) 5

4) 33

Answer : Error

How do you declare a global variable in Python?

1) global var

2) var = global

3) var is global

4) None of the above

Answer : global var