मराठी

CBSE solutions for कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२ chapter 3 - Classes in Python [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 3 - Classes in Python - Shaalaa.com
Advertisements

Solutions for Chapter 3: Classes in Python

Below listed, you can find solutions for Chapter 3 of CBSE CBSE for कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२.


EXERCISE
EXERCISE [Pages 62 - 65]

CBSE solutions for कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२ 3 Classes in Python EXERCISE [Pages 62 - 65]

1. a.Page 62

Give one word for the following:

A sort of constructor in Python.

1. b.Page 62

Give one word for the following:

A region of a Python program where a namespace is directly accessible

1. c.Page 62

Give one word for the following:

It returns the docstring of a class.

1. d.Page 62

Give one word for the following:

It returns the string representation of an object.

1. e.Page 62

Give one word for the following:

A method used to delete an attribute.

2. a.Page 62

Define a namespace.

2. b.Page 62

Give examples of namespaces with respect to Python.

3.Page 62

Is data of different types treated differently in Python? Support your answer with an example.

4.Page 62

Explain LEGB rule.

5.Page 62

Is an object of a class mutable? Why/why not?

6.Page 62

Explain the usage of keyword 'pass' in class definition.

7.Page 62

What is the use of __init__? When is it called? Explain with an example.

8.Page 62

Explain the importance of self in Python classes.

9.Page 62

Differentiate between class attributes and instance attributes.

10.Page 62

Explain __str__ with an example.

11.Page 62

What do you mean by name mangling? Support your answer with a relevant example.

12.Page 62

Differentiate between reference counting and automatic garbage collection with respect to Python.

13.Page 62

If we want to make a method that is added dynamically to a class available to all the instances of the class, how can it be done? Explain with an example.

14. (i)Page 62

Predict the output of the given code snippet.

ptr=40
def result():
     print ptr
     ptr=90
def func(var):
     if var<=60:
     ptr=30
     print ptr
result()
func(60)
func(70)
14. (ii)Page 63

Predict the output of the given code snippet.

ptr=50
def result():
     global ptr
     ptr=ptr+1
print ptr
result()
print ptr
15. a.Page 63

Name the methods that can be used to access attribute of an object.

15. b.Page 63

Name the methods that can be used to delete an attribute of an object.

16. a.Page 63

Give the statement to check whether the attribute str exists in the class Test whose object is T1.

16. b.Page 63

Give the statement to assign a value "Hello" to the attribute str of class Test and object T1.

17.Page 63

Consider the following class definition:

class Yourclass
       marks=10
       name= "ABC"
       def __init__(self,marks,name):
              self.marks=marks
              self.name=name
       def display(self):
              print marks
              print name

Give the statement to create an object of class Yourclass.

18.Page 64

In the code given what will be output if the following command is given: (Assuming YC is the object) YC.display()

class Yourclass
       marks=10
       name= "ABC"
       def __init__(self,marks,name):
              self.marks=marks
              self.name=name
       def display(self):
              print marks
              print name
19.Page 64

Predict the output of the given class-attribute program.

class Match:
     ' "Runs and Wickets" '
     runs=281
     wickets=5
     def __init__(self,runs,wickets):
          self.runs=runs
          self.wickets=wickets
     print " Runs scored are : ",runs
     print "Wickets taken are : ",wickets
print "Test.__do__:", Match.__doc__
print "Test.__name__:", Match.__name__
print "Test.__module__:", Match.__module__
print "Test.__bases__:", Match.__bases__
print "Test.__dict__:", Match.__dict__
20.Page 64

Create the class SOCIETY with following information:

society_name
house_no
no_of_members
flat
income

Methods

→ An __init__ method to assign initial values of society_name as "Surya Apartments", flat as "A Type", house_no as 20, no_of_members as 3, income as 25000.

→ Inputdata( ) - to read data members(society,house_no,no_of_members&income) and call allocate_flat().

→ allocate_flat( ) - To allocate flat according to income

Income Flat
>=25000 A Type
>=20000 and <25000 B Type
<15000 C Type

→ Showdata( ) - to display the details of the entire class.

21.Page 65

Define a class ITEMINFO in Python with the following description:

ICode (Item Code)
Item (Item Name)
Price (Price of each item)
Qty (quantity in stock)
Discount (Discount percentage on the item)
Netprice (Final Price)

Methods

→ A member function FindDisc( ) to calculate discount as per the following rule:

If Qty<=10         Discount is 0
If Qty (11 to 20)         Discount is 15
If Qty>=20         Discount is 20

→ A constructor( __init__ method) to assign the value with 0 for ICode, Price, Qty, Netprice and Discount and null for Item respectively

→ A function Buy( ) to allow user to enter values for ICode, Item, Price, Qty and call function FindDisc( ) to calculate the discount and Netprice(Price*Qty-Discount).

→ A Function ShowAll( ) to allow user to view the content of all the data members.

Solutions for 3: Classes in Python

EXERCISE
CBSE solutions for कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२ chapter 3 - Classes in Python - Shaalaa.com

CBSE solutions for कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२ chapter 3 - Classes in Python

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 3 (Classes in Python) 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 3 Classes in Python are .

Using CBSE कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२ solutions Classes in Python 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 3, Classes in Python कॉम्प्युटर सायन्स विद पाइथान [इंग्रजी] इयत्ता १२ 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×