Learn Python MCQs

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

How do you remove an item from a list by index in Python?

1) del list[index]

2) list.remove(index)

3) list.pop(index)

4) Both a and c

Answer : Option 1

What will be the output of print(round(2.5))?

1) 2

2) 3

3) Error

4) None

Answer : Option 1

How do you access a value in a dictionary?

1) dict[key]

2) dict.get(key)

3) Both a and b

4) dict.key

Answer : Option 1

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

1) [1, 2, 1, 2, 1, 2]

2) [1, 2, 3]

3) Error

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

Answer : Option 1

Which of the following is not a Python keyword?

1) continue

2) break

3) pass

4) next

Answer : Option 1

How do you create a class in Python?

1) class MyClass:

2) MyClass = class()

3) def MyClass:

4) None of the above

Answer : Option 1

What is the output of print(len("Hello, World!"))?

1) 13

2) 12

3) Error

4) 14

Answer : Option 1

How do you check if a list is empty in Python?

1) if not list:

2) if list == []:

3) Both a and b

4) None of the above

Answer : Option 1

What is the output of print(5 ** 2)?

1) 25

2) 10

3) Error

4) None

Answer : Option 1

How do you create a virtual environment in Python?

1) python -m venv env

2) virtualenv env

3) None of the above

4) Both a and b

Answer : Option 1