Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 subjective questions Classes and objects; Object oriented programming terminology

INT108 — Python Programming 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Define a class in Python. Explain the general syntax for creating a class with a suitable example.

  2. Question 2 of 20

    What is an instance object? Describe how instance objects are created and initialized in Python.

  3. Question 3 of 20

    Explain the purpose of the self parameter in Python classes. What happens if it is omitted from an instance method?

  4. Question 4 of 20

    Distinguish between instance attributes and class attributes in Python, using an example.

  5. Question 5 of 20

    Describe different ways of accessing, modifying, adding, and deleting object attributes in Python.

  6. Question 6 of 20

    Explain the role of the __init__() method. Is it technically responsible for creating an object?

  7. Question 7 of 20

    Define inheritance. Demonstrate single inheritance in Python and explain its advantages.

  8. Question 8 of 20

    Describe single, multilevel, hierarchical, and multiple inheritance in Python. Give a short example of each.

  9. Question 9 of 20

    What is method overriding? Explain how it enables runtime polymorphism with a suitable Python program.

  10. Question 10 of 20

    Explain the use of super() in inheritance. How can a child class extend a parent class initializer and an overridden method?

  11. Question 11 of 20

    What is the Method Resolution Order (MRO)? Explain how Python resolves methods in multiple inheritance.

  12. Question 12 of 20

    Define data hiding in Python. Explain the conventions for public, protected, and private attributes.

  13. Question 13 of 20

    Explain name mangling for private attributes in Python. Does it provide complete data security?

  14. Question 14 of 20

    Describe how getter and setter methods can be used to implement controlled access to hidden data.

  15. Question 15 of 20

    Explain the @property decorator. Write a class that uses a property to validate an attribute.

  16. Question 16 of 20

    What is function overloading? Explain why conventional compile-time function overloading is not directly supported in Python.

  17. Question 17 of 20

    Demonstrate how default arguments and variable-length arguments can simulate function overloading in Python.

  18. Question 18 of 20

    Explain how functools.singledispatch provides type-based function overloading. State its main limitation.

  19. Question 19 of 20

    Compare method overriding and function overloading in Python.

  20. Question 20 of 20

    Design a Python class hierarchy for a bank account system that demonstrates object creation, inheritance, method overriding, data hiding, and controlled attribute access.

That's unit 5

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.