Learn Python MCQs

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

What is the output of print(type(None))?

1)

2)

3)

4)

Answer : Option 1

How do you create a tuple with a single element?

1) myTuple = (1,)

2) myTuple = (1)

3) myTuple = [1]

4) myTuple = {1}

Answer : Option 1

What is the output of print("abc" * 2)?

1) abcabc

2) abc abc

3) abcabc

4) Error

Answer : Option 1

How do you create a new list from an existing one in Python?

1) newList = oldList.copy()

2) newList = oldList()

3) newList = oldList[:]

4) Both a and c

Answer : Option 1

What will be the output of print(2 ** 3)?

1) 8

2) 9

3) 6

4) 4

Answer : Option 1

How do you check the data type of a variable in Python?

1) type(var)

2) check(var)

3) var.type()

4) isinstance(var)

Answer : Option 1

What is the output of print(1, 2, 3, sep="-")?

1) 1-2-3

2) 1,2,3

3) 1 2 3

4) 1- 2- 3

Answer : Option 1

Which of the following is a Python built-in function to convert an integer to a string?

1) str()

2) string()

3) toString()

4) intToString()

Answer : Option 1

What is the purpose of the self parameter in a class method?

1) Refers to the instance of the class

2) Refers to the class itself

3) Represents a global variable

4) None of the above

Answer : Option 1

How do you create an empty set in Python?

1) mySet = set()

2) mySet = {}

3) mySet = []

4) mySet = ()

Answer : Option 1