हिंदी

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Inheritance [Latest edition]

Advertisements

Chapters

Unit -1 : Review of Phython & Concept of Oops

    1: Review of Phython

    2: Concept of Object Oriented Programming

    3: Classes in Python

▶ 4: Inheritance

Unit -2 : Advanced Programming with Python

    1: Liner List Manipulation

    2: Stacks & Queues in list

    3: Data File Handling

    4: Exception Handling & Generate Functions

Unit -3 : Databases Management Systems and SQL

    1: Databases Concepts and SQL

    2: Structure Query Language

Unit -4 : Introduction to Boolean Algebra

    1: Boolean Algebra

    2: Boolean Functions and Reduce Forms

   Chapter 3: Application of Boolean Logic

Unit -5 : Communication Technologies

   Chapter 1: Networking Concepts Part I

   Chapter 2: Networking Concepts Part II

   Chapter 3: Networking Protocols

   Chapter 4: Mobile Telecommunication Technologies, Network Security and Internet Services

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Inheritance - Shaalaa.com
Advertisements

Solutions for Chapter 4: Inheritance

Below listed, you can find solutions for Chapter 4 of CBSE CBSE for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२.


EXERCISE
EXERCISE [Pages 77 - 86]

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ 4 Inheritance EXERCISE [Pages 77 - 86]

1.Page 77

Define the term inheritance.

2.Page 77

Give one example for abstract method.

3.Page 77

What is single inheritance?

4.Page 77

What is multiple inheritance? Explain with an example.

5.Page 77

Give one example of multilevel inheritance.

6.Page 77

Based on the given diagram, answer the following;

  1. Write the name of the base class and derived class of state.
  2. Write the type of inheritance depicted in the diagram.
7.Page 77

Based on the above diagram, answer the following;

  1. Write the name of the base class and derived classes.
  2. Write the type of inheritance depicted in the above diagram.
8.Page 77

Based on the above diagram, answer the following;

  1. Write the name of the base classes and derived class.
  2. Name the type of inheritance depicted in the above example.
9.Page 78

Explain the significance of super() function.

10.Page 78

What are abstract methods?

11.Page 78

Explain the concept of overriding methods.

12.Page 78

Explain multiple inheritance with the help of an example.

13.Page 78

How do we implement abstract method in Python. Support your answer with an example.

14. a.Page 78

Find the output of the following code and write the type of inheritance:

class person(object):
     def __init__(self,name,age):
     self.name=name
     self.age=age 
     def display1(self):
     print "Name :",self.name
     print "Age :",self.age
class student(person):
def __init__(self,name,age,rollno,marks): 
     super(student,self).__init__(name,age)
     self.rollno=rollno
     self.marks=marks
     def display(self):
     self.display1()
     print " Roll No:",self.rollno
     print " Marks :",self.marks
     p=student('Mona',20,12,99)
p.display()
14. b.Page 79

Find the output of the following code and write the type of inheritance:

class person(object):
def __init__(self,name,age):
     self.name=name
     self.age=age
def display1(self): 
     print "Name :",self.name
     print "Age :",self.age
class student(person):
def __init__(self,name,age,rollno,marks):
     super(student,self).__init__(name,age)
     self.rollno=rollno
     self.marks=marks
def display(self):
     self.display1()
     print " Roll No:",self.rollno
     print " Marks :",self.marks
class Gstudent(student):
def __init__(self,name,age,rollno,marks,stream):
     super(Gstudent,self).__init__(name,age,rollno,marks)
self.stream=stream
def display2(self):
     self.display()
     print " stream:",self.stream
p=Gstudent('Mona',20,12,99,'computer')
p.display2()
14. c.Page 80

Find the output of the following code and write the type of inheritance:

class person(object):
     def __init__(self,name,age):
     self.name=name
     self.age=age
def display1(self):
     print "Name :",self.name
     print "Age :",self.age
class student(object):
def __init__(self,rollno,marks):
     self.rollno=rollno
     self.marks=marks
def display(self):
     print " Roll No:",self.rollno 
     print " Marks :",self.marks
class Gstudent(person,student):
def __init__(self,name,age,rollno,marks,stream):
     super(Gstudent,self).__init__(self,stream)
     person.__init__(self,name,age)
     student.__init__(self,rollno,marks)
     self.stream=stream
def display2(self):
     self.display1() s
     elf.display()
     print " stream:",self.stream
p=Gstudent('Mona',20,12,99,'computer')
p.display2()
15.Page 81

Rewrite the following code after removing errors. Underline each correction and write the output after correcting the code:

class First():
def __init__(self):
     print "first":
class Second(object):
def __init__(self):
     print "second"
class Third(First, Second):
def __init__(self):
     First.__init__(self):
     Second.__init__(self):
     print "that's it" 
t=Third()t=Third()
16.Page 81

Complete the following code:

class employee(object):
def __init__(self,no,name,age):
     self.no=no
     self.name=_____        #complete the statement
     self.age=______       #complete the statement
def printval(self):
     print "Number:",self.no
     print "Name :",self.name
     print "Age :",self.age
class pay(object):
     def __init__(self,dept,salary): #complete the definition
     __________
     __________
     def display(self):                  #complete the definition
     ____________________           # call printval()
     __________________         # print dept
     ___________________  # print salary
17.Page 82

Define a class furniture in Python with the given specifications:

Instance variables:

→ Type 
→ Model 
Methods 
→ getType() To return instance variable Type 
→ getModel()To return instance variable Model 
→ show() To print instance variable Type and Model 
Define a class sofa: 
→ No_of_seats 
→ Cost 
Methods 
→ getSeats() To return instance variable No_of_seats
→ getCost() To return instance variable Cost 
→ show() To print instance variable No_of_seats and Cost

This class inherits class furniture

18.Page 82

Define a class trainer in Python with the given specifications:

Instance variables:

→ Name 
→ T_ID 
Methods 
→ getName()To print instance variable Name

2   getTID()To print instance variable T_ID
Define a class learner in Python with the given specifications:
Instance variables:
→ L_Name 
→ L_ID 
Methods
→ getName()To print instance variable L_Name 
→ getLID()To print instance variable L_ID 
Define a class Institute in Python with the given specifications:
Instance variables:
→ I_Name 
→ I_Code 
Methods
→ getName()To print instance variable I_Name 
→ getICode()To print instance variable I_Code 
The class Institute inherits the class Trainer and Learner

19.Page 83

Define a class student in Python with the given specifications:

Instance variables:
Roll number, name
Methods:
     Getdata()- To input roll number and name
     Printdata()- To display roll number and name
Define another class marks, which is derived from student class
     Instance variable
          Marks in five subjects
     Methods:
          Inputdata() - To call Getdata() and input 5 subjects marks.
          Outdata() - To call printdata() and to display 5 subjects marks.

Implement the above program in python.

20.Page 83

Define a class employee in Python with the given specifications:

Instance variables:
Employee number, name
     Methods:
           Getdata()- To input employee number and name
          Printdata()- To display employee number and name
Define another class Teaching, which is derived from employee
     Instance variable
     Department name
Methods:
     Inputdata() - To call Getdata() and input department name.
     Outdata() - To call printdata() and to display department name.
Define another class Non_teaching, which is derived from employee
     Instance variable
     Designation
Methods:
     Inputdata() - To call Getdata() and input designation.
     Outdata() - To call printdata() and to display designation.

Implement the above program in python.

21.Page 84

Define a class employee in Python with the given specifications:

 Instance variables:
     Employee number, name
Methods:
     Getdata()- To input employee number and name
     Printdata()- To display employee number and name
Define another class payroll, which is derived from employee
     Instance variable 
          Salary
Methods:
     Inputdata() - To call Getdata() and input salary.
     Outdata() - To call printdata() and to display salary.
Define another class leave, which is derived from payroll.
     Instance variable
          No of days
Methods:
     acceptdata() - To call Inputdata() and input no of days.
     showdata() - To call Outdata() and to display no of days.

Implement the above program in python.

22.Page 85

Pay roll information system:

→ Declare the base class 'employee' with employee's number, name, designation, address, phone number.

→ Define and declare the function getdata() and putdata() to get the employee's details and print employee's details.

→ Declare the derived class salary with basic pay, DA, HRA, Gross pay, PF, Income tax and Net pay.

→ Declare and define the function getdata1() to call getdata() and get the basic pay,

→ Define the function calculate() to find the net pay

→ Define the function display() to call putdata() and display salary details .

→ Create the derived class object.

→ Read the number of employees.

→ Call the function getdata1() and calculate() to each employees.

→ Call the display() function.

23.Page 85

Railway reservation System

→ Declare the base class Train with train number, name, Starting station, destination, departure time, arrival time, etc.

→ Define and declare the function getdata() and putdata() to get the train details and print the details.

→ Define search() function to search train detail using train number.

→ Declare the derived class passenger with ticket number, PNR name of the passenger, gender, age, address, phone number, etc.

→ Declare and define the function getdata1() to call search() function to get the train details and get the passenger's information.

→ Define the function display() to call putdata() and display passenger's details.

→ Create base class object.

→ Read the number of trains.

→ Create the derived class object.

→ Read the number of passengers.

→ Call the function getdata1() to each passenger

→ Call the display() function.

24.Page 86

SKP Hotel offers accommodation, meals facilities.

→ Create a class Accommodation with Room Number, type of room, and rent, etc..

→ Create a class meals services includes: meals code, name, price, etc..

→ Create a class customer with customer number, name, address, etc.

→ Customer class is derived by using Accommodation and meals classes.

25.Page 86

Implement the following using multilevel information.

→ Create a student class with student number and name

→ Class graduate is created by using student.

→ Graduate class is created using subject code and subject name.

→ Class Post Graduate is created by using Graduat

→ Post Graduate class is created using master subject code and master subject name

Solutions for 4: Inheritance

EXERCISE
CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Inheritance - Shaalaa.com

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Inheritance

Shaalaa.com has the CBSE Mathematics कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ CBSE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. CBSE solutions for Mathematics कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ CBSE 4 (Inheritance) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.

Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. CBSE textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.

Concepts covered in कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 Inheritance are .

Using CBSE कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ solutions Inheritance exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in CBSE Solutions are essential questions that can be asked in the final exam. Maximum CBSE कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ students prefer CBSE Textbook Solutions to score more in exams.

Get the free view of Chapter 4, Inheritance कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ additional questions for Mathematics कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ CBSE, and you can use Shaalaa.com to keep it handy for your exam preparation.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×