Learn Python MCQs

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

Which of the following is a Python framework for web development?

1) Flask

2) Django

3) Bottle

4) All of the above

Answer : Option 1

What does the map() function do in Python?

1) Applies a function to all items in an iterable

2) Filters items in an iterable

3) Creates a new iterable

4) Sorts items in an iterable

Answer : Option 1

What is the output of print([1, 2, 3] + [4, 5])?

1) [1, 2, 3, 4, 5]

2) [5, 7, 8]

3) [1, 2, 3, 4] + [5]

4) [1, 2, 3][4, 5]

Answer : Option 1

Which of the following methods is used to add an element at the end of a list?

1) add()

2) insert()

3) append()

4) extend()

Answer : Option 1

What is the output of print(2 == "2")?

1) True

2) False

3) None

4) Error

Answer : Option 1

How do you create a virtual environment in Python?

1) python -m venv myenv

2) python create venv myenv

3) python venv myenv

4) venv create myenv

Answer : Option 1

What is the output of print("Hello"[0])?

1) H

2) e

3) o

4) Hello

Answer : Option 1

What is the keyword to define a generator function in Python?

1) def

2) yield

3) return

4) function

Answer : Option 1

What will be the output of print("Hello".upper())?

1) HELLO

2) hello

3) Hello

4) Error

Answer : Option 1

Which of the following is used to handle multiple exceptions in Python?

1) try/except

2) try/catch

3) catch/throw

4) try/finally

Answer : Option 1