Exams.RecruitmentIndia.in

A Learning Portal from Recruitment India

  • Home
  • Questions
    • Aptitude Questions
    • English Questions
    • Technical Questions
    • HR Interview Questions
    • Reasoning Questions
    • GK Questions
    • Current Affairs
    • Entrance Exams
  • IT Jobs By Location
    • Ahmedabad
    • Bangalore
    • Chandigarh
    • Chennai
    • Coimbatore
    • Delhi
    • Gurgaon
    • Hyderabad
    • Kolkata
    • Lucknow
    • Mumbai
    • Noida
    • Pune
    • Vizag
    • Vijaywada
  • Govt Jobs Portal
  • Online Tests Portal
  • Contact Us
New
Latest Private Jobs 2022 || Today Walkins || Latest Central Govt Jobs
New Recruitment India Job Notifications & Preparation Portal App || RecruitmentIndia Online Mock tests app
You are here: Home / Question and Answers

What will be the output of the following Python code?
def c(f):
def inner(*args, **kargs):
inner.co += 1
return f(*args, **kargs)
inner.co = 0
return inner
@c
def fnc():
pass
if __name__ == ‘__main__’:
fnc()
fnc()
fnc()
print(fnc.co)

A. 

4

B. 

3

C. 
0
D. 

1

Answer
Workspace
Report
Discuss

Answer with explanation

Answer: Option B

Explanation

The code shown above returns the number of times a given function has been called. Hence the output of this code is: 3

Workspace

Discuss about the question Cancel reply

Search

State Wise Govt Jobs

  • Andhra Pradesh Govt Jobs
  • Arunachal Pradesh Govt Jobs
  • Assam Govt Jobs
  • Bihar Govt Jobs
  • Chattishgarh Govt Jobs
  • Goa Govt Jobs
  • Gujarat Govt Jobs
  • Haryana Govt Jobs
  • Himachal Pradesh Govt Jobs
  • Jammu and Kashmir Govt Jobs
  • Jharkhand Govt Jobs
  • Karnataka Govt Jobs
  • Kerala Govt Jobs
  • Madhya Pradesh Govt Jobs
  • Maharashtra Govt Jobs
  • Tripura Govt Jobs
  • Uttar Pradesh Govt Jobs
  • Uttarakhand Govt Jobs
  • Manipur Govt Jobs
  • Meghalaya Govt Jobs
  • Mizoram Govt Jobs
  • Nagaland Govt Jobs
  • Odisha Govt Jobs
  • Punjab Govt Jobs
  • Rajasthan Govt Jobs
  • Sikkim Govt Jobs
  • Tamilnadu Govt Jobs
  • Telangana Govt Jobs
  • West Bengal Govt Jobs

Advertisement

Useful Links

  • About Us
  • Privacy Policy
  • Disclaimer Policy
  • Contact Us

Our Android Applications

  • Preparation & Job Updates App
  • Download Online Mock Tests App

Copyright © 2016 -2022 Exams Recruitment India || Product from Recruitment India Made with ❤ in India.