Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the output of the code shown below?

    l1=[1, 2, 3, [4]]
    l2=list(l1)
    id(l1)==id(l2)
  2. A.
    True
    B.
    False
    C.
    Error
    D.
    Address of l1

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The code shown above shows a nested list. A nested list will undergo shallow copy when the list as a whole undergoes deep copy. Hence the output of this code is False.


Be The First To Comment