Python Foundation

+91-7982108418            
                      PYTHON OOPs CONCEPTS QUESTIONS

1.Write a Python program to import built-in array module and display the namespace of the said module.

2. Write a Python program to create a class and display the namespace of the said class.

3. Write a Python program to create an instance of a specified class and display the namespace of the said instance.

4. ‘builtins’ module provides direct access to all ‘built-in’ identifiers of Python.
Write a python program which import the abs() function using the builtins module, display the documentation of abs() function and find the absolute value of -155.

5. Define a Python function student(). Using function attributes display the names of all arguments.

6. Write a Python function student_data () which will print the id of a student (student_id). If the user passes an argument student_name or student_class the function will print the student name and class.

7. Write a simple Python class named Student and display its type. Also, display the __dict__ attribute keys and the value of the __module__ attribute of the Student class.

8. Write a Python program to crate two empty classes, Student and Marks. Now create some instances and check whether they are instances of the said classes or not. Also, check whether the said classes are subclasses of the built-in object class or not.

9. Write a Python class named Student with two attributes student_name, marks. Modify the attribute values of the said class and print the original and modified values of the said attributes.

10. Write a Python class named Student with two attributes student_id, student_name. Add a new attribute student_class and display the entire attribute and their values of the said class. Now remove the student_name attribute and display the entire attribute with values.

11. Write a Python class named Student with two attributes student_id, student_name. Add a new attribute student_class. Create a function to display the entire attribute and their values in Student class.

12. Write a Python class named Student with two instances student1, student2 and assign given values to the said instances attributes. Print all the attributes of student1, student2 instances with their values in the given format.

13. Write a Python class to convert an integer to a roman numeral.

14. Write a Python class to convert a roman numeral to an integer.

15. Write a Python class to find validity of a string of parentheses, ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]. These brackets must be close in the correct order, for example “()” and “()[]{}” are valid but “[)”, “({[)]” and “{{{” are invalid.

16. Write a Python class to get all possible unique subsets from a set of distinct integers.
Input : [4, 5, 6]
Output : [[], [6], [5], [5, 6], [4], [4, 6], [4, 5], [4, 5, 6]]

17. Write a Python class to find a pair of elements (indices of the two numbers) from a given array whose sum equals a specific target number.

18. Write a Python class to find the three elements that sum to zero from a set of n real numbers.
Input array : [-25, -10, -7, -3, 2, 4, 8, 10]
Output : [[-10, 2, 8], [-7, -3, 10]]

19. Write a Python class to implement pow(x, n).

20. Write a Python class to reverse a string word by word.
Input string : ‘hello .py’

21. Write a Python class which has two methods get_String and print_String. get_String accept a string from the user and print_String print the string in upper case.

22. Write a Python class named Rectangle constructed by a length and width and a method which will compute the area of a rectangle.

23. Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a circle.

24. Write a Python program to get the class name of an instance in Python.

Powered by BetterDocs

Contact Us
close slider

error: Content is protected !!