Tuple in Python MCQs Exercise I


Ques 1 Tuple


Tuple is a........
  a) Mutable Datatype.
  b) Immutable Datatype.
  c) Both (a) and (b)
  d) None of the above.


b is the correct option





Ques 2 Tuple


What is the output of the following Python Code?


tu=("Vikas" , "SmallCode" , 12) tu[0]="Vicky" print(tu[0])

  a) Error
  b) ("Vicky" , "SmallCode" , 12)
  c) ("Vikas" , "SmallCode" , 12)
  d) None of the above.


a is the correct option





Ques 3 Tuple


What is the output of the following Python Code?


tu=("Vikas" , "SmallCode" , 12)
tu=list(tu)
tu[0]="Vicky"
tu=tuple(tu)
print(tu)

  a) Error
  b) ("Vicky" , "SmallCode" , 12)
  c) ("Vikas" , "SmallCode" , 12)
  d) None of the above.


b is the correct option





Ques 4 Tuple


What is the output of the following Python Code?


tu=(1,2,3,4,5,6,7,8)
p=[1:-1]
p[0]="Vicky"
print(tu)

  a) Error
  b) (2,3,4,5,6,7)
  c) (2,3,4,5,6,7,8)
  d) (1,2,3,4,5,6,7,8)


a is the correct option