Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

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

    def f1():
        x=100
        print(x)
    x=+1
    f1()
  2. A.
    Error
    B.
    100
    C.
    101
    D.
    99

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The variable x is a local variable. It is first printed and then modified. Hence the output of this code is 100.


Be The First To Comment