Learn Python MCQs

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

What is the purpose of the pass statement in Python?

1) No operation

2) Break the loop

3) Continue the loop

4) Return a value

Answer : Option 1

How do you create a list in Python?

1) myList = []

2) myList = list()

3) Both a and b

4) myList = {}

Answer : Option 1

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

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

2) [5, 7]

3) Error

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

Answer : Option 1

Which of the following is used to check the length of a list?

1) length(list)

2) len(list)

3) size(list)

4) count(list)

Answer : Option 1

What will be the output of print(bool(""))?

1) True

2) False

3) None

4) Error

Answer : Option 1

How do you create a multi-line string in Python?

1) s = """Hello"""

2) s = "Hello"

3) s = 'Hello'

4) All of the above

Answer : Option 1

Which of the following is not a Python built-in function?

1) print()

2) input()

3) length()

4) len()

Answer : Option 1

What is the output of print(10 // 3)?

1) 3

2) 3.33

3) 3.0

4) Error

Answer : Option 1

How do you convert a list to a set in Python?

1) set(list)

2) list(set)

3) convert(list)

4) None of the above

Answer : Option 1

What is the output of print({1, 2, 3} - {2})?

1) {1, 3}

2) {2}

3) Error

4) {1, 2, 3}

Answer : Option 1