Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

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

    def mk(x):
        def mk1():
            print("Decorated")
            x()
        return mk1
    def mk2():
        print("Ordinary")
    p = mk(mk2)
    p()
  2. A.

    Decorated

    Decorated

    B.

    Ordinary

    Ordinary

    C.

    Ordinary

    Decorated

    D.

    Decorated

    Ordinary

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    The code shown above first prints the word "Decorated and then "ordinary. Hence the output of this code is: 

    Decorated 


Be The First To Comment