Explore topic-wise MCQs in Python.

This section includes 5 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.

1.

If a={5,6,7}, what happens when a.add(5) is executed?

A. a={5,5,6,7}
B. a={5,6,7}
C. Error as there is no add function for set data type
D. Error as 5 already exists in the set
Answer» C. Error as there is no add function for set data type
2.

If a={5,6,7,8}, which of the following statements is false?a) print(len(a))b) print(min(

A. print(len(a))
B. print(min(a))
C. a.remove(5)
D. a[2]=45
Answer» E.
3.

Which of the following statements is used to create an empty set?

A. { }
B. set()
C. [ ]
D. ( )
Answer» C. [ ]
4.

Which of the following is not the correct syntax for creating a set?

A. set([[1,2],[3,4]])
B. set([1,2,2,3,4])
C. set((1,2,3,4))
D. {1,2,3,4}
Answer» B. set([1,2,2,3,4])
5.

Which of these about a set is not true?

A. Mutable data type
B. Allows duplicate values
C. Data type with unordered values
D. Immutable data type
Answer» E.