11. What is the result of the following: type(set([1,2,3]))

  • set
  • list

12. What method do you use to add an element to a set?

  • extend
  • add
  • append

13. What is the result of the following operation : {'a','b'} &{'a'}

  • {‘a’,’b’}
  • {‘a’}

Module 2 Graded Quiz

14. Consider the tuple A=((1),[2,3],[4]), that contains a tuple and list. What is the result of the following operation A[2] ?

  • [4]
  • [2,3]
  • 1

15. Consider the tuple A=((11,12),[21,22]), that contains a tuple and list. What is the result of the following operation A[0][1]?

  • 21
  • 11
  • 12

16. The method append does the following:

  • adds one element to a list
  • merges two lists or insert multiple elements to a list

17. Consider the following list : A=["hard rock",10,1.2]

What will list A contain after the following command is run: del(A[0]) ?

  • [10,1.2]
  • [“hard rock”,10,1.2]
  • [“hard rock”,10]

18. What is the syntax to clone the list A and assign the result to list B ?

  • B=A
  • B=A[:]

Shuffle Q/A 2

19. What is the result of the following: len(("disco",10,1.2, "hard rock",10)) ?

  • 5
  • 6
  • 0

20. Consider the following dictionary:

{ "The Bodyguard":"1992", "Saturday Night Fever":"1977"}

select the values

  • “1977”
  • “1992”
  • “The Bodyguard”
  • “Saturday Night Fever”

Leave a Reply