Posts

Showing posts with the label set quiz

Set quiz

  MCQ Quiz on Set Data Type in Python Which of the following creates an empty set? {} [] set() empty() Which feature of a set is correct? Ordered collection Unordered unique elements Allows duplicates Supports indexing What will be the output of {1, 2, 2, 3}? {1,2,2,3} {1,2,3} {2,3} Error Which method is used to add an element to a set? add() append() insert() push() Which method removes an element without raising an error? remove() discard() pop() delete() Which operator performs union? & - | ^ Which is NOT a valid set method? update() intersection() difference() slice() What is the output of {1, 2, 3} & {2, 3, 4}? {1,4} {2,3} {1,2,3,4} {3,4} Which operator is used for symmetric difference? | & ^ % What will {1,2,3} - {2,3} return? {1} {2} {3} {1,2,3} Which method clears a set? removeAll() clear() delete() empty() The pop() method remov...