The document discusses various object-oriented programming concepts in Python like classes, inheritance, polymorphism, exceptions, and Tkinter GUI programming. It provides 72 questions related to defining classes with attributes and methods, inheriting properties between parent and child classes, handling exceptions, and creating graphical user interfaces using the Tkinter module.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0 ratings0% found this document useful (0 votes)
26 views3 pages
Practice Set OOP
The document discusses various object-oriented programming concepts in Python like classes, inheritance, polymorphism, exceptions, and Tkinter GUI programming. It provides 72 questions related to defining classes with attributes and methods, inheriting properties between parent and child classes, handling exceptions, and creating graphical user interfaces using the Tkinter module.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 3
Practice Set
Object Oriented Programming E2UC201C
1. Develop a program for creating a class named Students, initializing attributes
such as name, age, and grade during object instantiation. 2. Write a program to establish a valid empty class named Students, devoid of any properties. 3. Design a program for creating a child class Teacher that inherits properties from the parent class Staff. 4. Devise a Python program to define a Vehicle class with instance attributes max_speed and mileage. 5. Instantiate a Vehicle class without including any variables or methods. 6. Construct a child class Bus that inherits all variables and methods from the Vehicle class created in question 3. 7. Create a Python program to define a person class with attributes like name, country, and date of birth, and implement a method for determining the person’s age. 8. Implement a Python class named BankAccount representing a bank account, incorporating attributes such as accountNumber, name, and balance. Provide a complete code for the BankAccount class with various methods. 9. Discuss the importance of access modifiers (e.g., public, private, protected) in achieving the objectives of Object-Oriented Programming (OOP) in Python. 10. Explain how a destructor can be defined and utilized in a Python class. 11. Explore the usage of the 'private' access modifier in Python and discuss its implications. 12. Enumerate the different types of polymorphism in Object-Oriented Programming (OOP) in Python. 13. Develop a Python program that overloads the operator + and > for a custom class. 14. Demonstrate method overriding in Python to achieve runtime polymorphism with a code example. 15. Discuss the advantages and disadvantages of compile-time polymorphism compared to runtime polymorphism in Python. 16. Explain how method overriding showcases runtime polymorphism in Python. 17. Create a Python code example illustrating data overloading by defining multiple attributes with the same name in a class. 18. Differentiate between data overloading and data overriding in Python. 19. Define data overriding and provide an example demonstrating it in Python. 20. Present a Python code example showcasing data overloading using multiple constructors with different parameters. 21. List and explain the exceptions in Python. 22. Describe how to handle exceptions using try, except, and finally blocks in Python. 23. Explain the purpose of the raise statement in Python. 24. Discuss the use of the except clause without an exception type in Python. 25. Highlight the differences between the except and else blocks in Python exception handling. 26. Explain how to handle multiple exceptions in a single except block in Python. 27. Determine if it is possible to include other statements between 'try,' 'catch,' and 'finally' blocks in Python. 28. Elaborate on the concept of an unreachable catch block error in Python. 29. Differentiate between errors and exceptions in Python. 30. Enumerate and explain the types of exceptions in Python. 31. Explain the purpose of the finally block in Python exception handling. 32. Discuss the concept of custom exceptions in Python. 33. Explain the purpose of the assert statement in Python. 34. Differentiate between a built-in exception and a custom exception. 35. Describe how to re-raise an exception in Python. 36. Clarify the purpose of inheritance in Python. 37. Define the role of the super() function in Python. 38. Differentiate between throw, throws, and throwable in Python. 39. Explain the StackOverflowError in Python. 40. Explore whether it is possible to override a superclass method that throws an unchecked exception with checked exceptions in the sub-class. 41. Identify the class defined as a superclass for all types of errors and exceptions in Python. 42. Discuss the correct combination of try, catch, and finally blocks in Python. 43. Explain the use of the printStackTrace() method in Python. 44. Create a Bus child class that inherits from the Vehicle class, incorporating fare calculations with maintenance charges. 45. Provide examples of checked exceptions in Python. 46. Develop a Python code to create a decorator returning the square of a number. 47. Compare class method and static method, and demonstrate their use with a Python code example. 48. Validate functions such as append(), extend(), pop(), reverse(), remove(), sort(), and insert() of a list in Python. 49. Explain the purpose of the sys module in Python. 50. Define a lambda function with suitable code in Python. 51. Recall the process of installing a specific version of a package using pip in Python. 52. List at least five built-in modules with their functions in Python. 53. Write a Python code to generate a random number between 50 to 99 and shuffle a given list1=[21,22,23,24,25]. 54. Define iter() and next() functions with a suitable example in Python. 55. Differentiate between tuples and dictionaries in Python. 56. Explain the difference between module and package in Python. 57. Distinguish between PyPI and pip in Python. 58. Illustrate the use of a lambda function with a suitable example in Python. 59. Write a code to find the sum of a given list of numbers (list1=[5,6,7,8,9,12,15,18,21]) using the reduce function in Python. 60. Demonstrate how one function can be passed as an argument to another function in Python. 61. Describe the importance of virtual environments in Python development and explain how they are created. 62. Illustrate the use of the filter() function to find values above and equal to 18 from the given list1=[12,18,22,10,42,19]. 63. Use the 're' module to find all occurrences of a specific pattern in a given text in Python. 64. Explain the concepts of class method and static method decorators with a suitable example in Python. 65. Demonstrate the use of regular expressions to count the number of vowels in a given string in Python. 66. Describe the process of working with images in Tkinter, covering image loading, resizing, and display within a GUI. 67. Develop a detailed guide on creating a Tkinter application that includes multiple widgets, emphasizing effective organization and user interaction. 68. Explore the significance of Geometry Management in Tkinter, illustrating its role in creating responsive and visually appealing GUIs. 69. Design a comprehensive tutorial on implementing a complex Tkinter GUI application, incorporating buttons, canvas, and advanced widget functionalities. 70. Demonstrate the implementation of a Date Picker in a Tkinter GUI, including its significance. 71. Discuss the key features of a Color Picker and its application in enhancing Tkinter interfaces. 72. Elaborate on the role of Container Widgets, with a specific focus on the Frame widget in Tkinter. 73. Develop a comprehensive guide on implementing a complex Tkinter GUI application, incorporating buttons, canvas, and advanced widget functionalities.