Skip to content
CY-406 · Advance Python Programming/Important Questions

Advance Python Programming (CY-406) - Important Questions

  1. Unit 17 Marks High Priority

    Define class and object in Python. Write a class Person with attributes name and age, a constructor, a method display() that prints details, then create two objects and show their outputs.

    Core fundamental question on object oriented programming in Python; frequently asked as basic/conceptual plus coding.

  2. Unit 15 Marks Medium Priority

    Explain the difference between class variables and instance variables in Python. Provide a code example that demonstrates how changing a class variable affects all instances while changing an instance variable affects only that instance.

    Important distinction tested often: storage and behavior difference between class and instance scope.

  3. Unit 110 Marks Medium Priority

    Explain inheritance in Python. With suitable examples implement single inheritance, multilevel inheritance, and multiple inheritance. Demonstrate method overriding and how to call a parent class method from an overridden method.

    Covers inheritance variations and method overriding which are commonly examined together.

  4. Unit 110 Marks Medium Priority

    What is polymorphism in Python? Demonstrate polymorphism using method overriding. Additionally, implement operator overloading for a Vector class to support addition using the add method and provide a str method for readable output.

    Polymorphism and operator overloading are standard advanced object-oriented topics for Python tests.

  5. Unit 17 Marks Medium Priority

    Explain the differences between instance methods, @classmethod and @staticmethod in Python. Provide code examples showing when and how to use each type of method.

    Routine question focusing on method types within classes and their appropriate uses.

  6. Unit 15 Marks Medium Priority

    Explain encapsulation in Python. How does Python implement 'private' attributes (name mangling)? Provide an example that shows protected and private attribute conventions and how name mangling works.

    Encapsulation and name mangling are regularly tested to assess understanding of access control idioms in Python.

  7. Unit 110 Marks Medium Priority

    Explain Python's iterator protocol. Write a custom iterable class RangeLike that implements iter and next to iterate from 0 up to a given limit. Show example usage in a for loop.

    Tests knowledge of Python iterator protocol and custom iterable classes which is a common practical question.

  8. Unit 17 Marks Low Priority

    What are abstract base classes in Python? Using the abc module, define an abstract class Shape with an abstract method area() and implement concrete subclasses Circle and Rectangle that provide area() implementations.

    Advanced but relevant topic: abstraction using the abc module is occasionally asked to test interface design skills.

  9. Unit 17 Marks Low Priority

    Explain the use of property() and the @property decorator in Python. Create a class Celsius with a private attribute _temp and a temperature property that enforces a minimum value (e.g., not below -273.15). Demonstrate getter, setter and deleter.

    Descriptors and property-based attribute control are important for designing robust classes; less frequent but high-value.

  10. Unit 114 Marks Low Priority

    What is a metaclass in Python? Write a simple metaclass that logs the name of each class created using it. Demonstrate its use by creating a sample class that uses this metaclass and show the logged output.

    Metaclasses are an advanced topic that appears rarely but is a high-value distinguishing question for deep understanding of class creation.

  11. Unit 17 Marks Low Priority

    Explain the dataclass decorator in Python 3.7+. Define an immutable (frozen) dataclass Point with coordinates x and y, demonstrate autogenerated methods (like eq and repr), and show how default_factory can be used for mutable fields.

    Modern Python feature related to class definitions; tests use of standard library dataclasses for concise class creation.

Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in