Set in Python MCQs Exercise I


Ques 1 Set


Set is a.....
  a) Mutable Datatype.
  b) Immutable Datatype.
  c) Both (a) and (b)
  d) None of these


a is the correct option





Ques 2 Set


What is the correct syntax of Sets?
  a) se={}
  b) se={1,2,3,4}
  c) Both (a) and (b)
  d) None of these


b is the correct option





Ques 3 Set


What is the output of the following Python Code?


se={1,2,3,4,5,6}
print(se[-1])

  a) 6
  b) 5
  c) 2
  d) Error


d is the correct option





Ques 4 Set


What is the output of the following Python Code?


se={11,12,13}
se.add(14)
print(se)

  a) {11,12,13}
  b) Set is immutable.
  c) {11,12,13,14}
  d) Error


c is the correct option





Ques 5 Set


What is the output of the following Python Code?


se={11,12,13}
se.push(14)
print(se)

  a) {11,12,13}
  b) Set is immutable.
  c) {11,12,13,14}
  d) Error


d is the correct option