Exam GPYC All QuestionsBrowse all questions from this exam
Question 6

Review the following code, written in Python. What are the contents of variable a?

    Correct Answer: B

    The code creates two sets, a and b, containing the specified strings. The update method on a adds all elements of set b to set a. Since sets are unordered collections in Python, the final contents of a will be all unique items from both sets a and b. Therefore, the contents of variable a are 'dandelion', 'rose', 'cat', 'violet', 'bird', and 'dog'.

Discussion
VenudharOption: D

The option isD