Tuesday, April 14, 2020

Python Application Programming - Module 4 - 17CS664, 18CS55

  1. What is a class?. How to define a class in Python?. How to instantiate a class? How the members are accessed?
  2. Differentiate class variables and instance variables
  3. Write a python program that uses date time module within a class, takes a birthday date as input from the user and prints the age and number of days, hours, minutes and seconds until the next birthday.
  4. Differentiate between simple, multiple and multilevel inheritance
  5. Write a python program that has a class Point with attributes as X and Y coordinates. Create two objects of this class and find the midpoint of both these points. Add a method reflex_x to class Point which returns a new point. Which is the reflection of the point about the X- axis.ex: Point(5,10) = refle_x returns point (5,-10).
  6. Write a program that has a class Person, inherit a class student from person which also has a class MarksAttendence. Assume the attributes for person class as USN, Name, DOB,Gender.  Attributes for student class as : Class, Branch,Year , Attributes for MarksAttendence : Marks, Attendance. Create a student S=Student(‘1JS20IS001’,’unknown’,20-20-2000,’M’,90,95) and display the details of the student.
  7. Write a python program to express instances as return values to define a class rectangle with members width, height, corner_x, corner_y and member function: to find centre, area and perimeter of rectangle.
  8. Explain __init__ and str method with an example python program.
  9. Define polymorphism. Demonstrate polymorphism with function to find histogram to count the number of times each letter appears in a word and in sentence.
  10. What is pure function. Write a python program to find duration of event if start and end time is given by defining class Time.
  11. Write a python program to illustrate the concept of global variable.

No comments:

Post a Comment

Database Management systems - Module 2

1 a. Explain the entity integrity and referential integrity constraints.   Why is each considered important. Give examples.    b. Discuss eq...