Learn Python MCQs

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

What is the output of print("Hello".startswith("H"))?

1) True

2) False

3) Error

4) None

Answer : Option 1

How do you create an empty dictionary in Python?

1) dict = {}

2) dict = []

3) dict = ()

4) None of the above

Answer : Option 1

What is the output of print("Hello".find("e"))?

1) 1

2) 0

3) Error

4) None

Answer : Option 1

How do you convert a string to an integer in Python?

1) int(string)

2) string.toInt()

3) convert(string)

4) None of the above

Answer : Option 1

What is the output of print("abc".upper())?

1) ABC

2) Abc

3) Error

4) None

Answer : Option 1

How do you remove duplicates from a list in Python?

1) list(set(list))

2) list.remove_duplicates()

3) None of the above

4) list.unique()

Answer : Option 1

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

1) 8

2) 6

3) Error

4) 4

Answer : Option 1

How do you create a tuple in Python?

1) tuple = ()

2) tuple = []

3) tuple = {}

4) None of the above

Answer : Option 1

What is the output of print("abc" + "def")?

1) abcdef

2) abc def

3) Error

4) None

Answer : Option 1

How do you handle exceptions in Python?

1) try/except

2) if/else

3) None of the above

4) try/catch

Answer : Option 1