Python Questions and Answers – Exception Handling – 3

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Exception Handling – 3”. 1. What happens if the file is not found in the following Python code? a=False while not a: try: f_n = input("Enter file name") i_f = open(f_n, ‘r’) except: print("Input file not found") a) No error b) Assertion error … Read more

advertisement

Python Questions and Answers – Exception Handling – 2

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Exception Handling – 2”. 1. The following Python code will result in an error if the input value is entered as -5. assert False, ‘Spanish’ a) True b) False 2. What will be the output of the following Python code? x=10 y=8 assert … Read more

advertisement

Python Multiple Choice Questions – Exception Handling

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Exception Handling”. 1. How many except statements can a try-except block have? a) zero b) one c) more than one d) more than zero 2. When will the else part of try-except-else be executed? a) always b) when an exception occurs c) when … Read more

advertisement

Python Questions and Answers – Encapsulation

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Encapsulation”. 1. Which of these is not a fundamental features of OOP? a) Encapsulation b) Inheritance c) Instantiation d) Polymorphism 2. Which of the following is the most suitable definition for encapsulation? a) Ability of a class to derive members of another class … Read more

advertisement

Python Questions and Answers – Polymorphism

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Polymorphism”. 1. Which of the following best describes polymorphism? a) Ability of a class to derive members of another class as a part of its own definition b) Means of bundling instance variables and methods in order to restrict access to certain class … Read more

advertisement

Python Questions and Answers – Inheritance – 2

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Inheritance – 2”. 1. What type of inheritance is illustrated in the following Python code? class A(): pass class B(A): pass class C(B): pass a) Multi-level inheritance b) Multiple inheritance c) Hierarchical inheritance d) Single-level inheritance 2. What does single-level inheritance mean? a) … Read more

advertisement

Python Multiple Choice Questions – Inheritance

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Inheritance”. 1. Which of the following best describes inheritance? a) Ability of a class to derive members of another class as a part of its own definition b) Means of bundling instance variables and methods in order to restrict access to certain class … Read more

advertisement

Python Questions and Answers – Classes and Objects – 2

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Classes and Objects – 2”. 1. The assignment of more than one function to a particular operator is _______ a) Operator over-assignment b) Operator overriding c) Operator overloading d) Operator instance 2. Which of the following is not a class method? a) Non-static … Read more

advertisement

Python Questions and Answers – Classes and Objects – 1

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Classes and Objects – 1”. 1. _____ represents an entity in the real world with its identity and behaviour. a) A method b) An object c) A class d) An operator 2. _____ is used to create an object. a) class b) constructor … Read more

advertisement

Python Questions and Answers – Operator Overloading

This set of Python Interview Questions and Answers for Experienced people focuses on “Operator Overloading” 1. Which function is called when the following Python code is executed? f = foo() format(f) a) format() b) __format__() c) str() d) __str__() 2. Which of the following Python code will print True? a = foo(2) b = foo(3) … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.