Python object-oriented exercises

First, multiple choice

About object-oriented and process-oriented, the following statement is wrong (). A. a thought process-oriented and object-oriented problem solving are

B. is a process-oriented object-oriented

C. emphasized that the process-oriented steps to resolve the problem

D. Object-oriented emphasis is subject to solve the problem

  1. Relationship between classes and objects, the following description is correct ().

The core object oriented classes and A.

B. class is an individual reality of things

C. according to the object class is created, and a class corresponding to only one object

D. reality object is a description of the individual, which is an instance of the class

3. The effect is the constructor ().

A. General method to initialize the members of the class B.

D. C. initialize the object the establishment of an object

  1. Constructor method is a special class, Python is in its name ().

A. C. and named classes _construct B. the init D. the init

  1. Python class contains a special variable (), which represents the object itself, you can access the members of the current class

A. self B. me C.this D. and named classes

  1. The following options, consistent with naming conventions class is ().

A. HolidayResort B. Holiday Resort C. hoildayResort D.hoilidayresort

  1. Python class method for releasing resources occupied is ().

A. _ init _ b \ the C. D. delete _from

Second, determine the question

It is based on object-oriented process-oriented. () You can create objects by class, and only one object instance. () Method and cedar format is exactly the same. When () object class is created, the system will automatically call the constructor to initialize. After () finished creating the object, the initial value of the property is fixed, the outside world can not be modified. () Using the del statement to delete an object, you can manually release the resources that it holds. () Third, fill in the blank

In Python, you can use ___________ keyword to declare a class. Object-oriented issues need to be divided into multiple independent ___________, and then call its methods to solve the problem. Methods of the class must have a parameter _________, located at the beginning of the parameter list. Python provides a constructor name of _________, which allows object classes to complete the initialization. To modify the default value of the property can be used ___________ provided constructor. Fourth, the short answer questions

Please significance brief self in class. Which class is composed of three parts? Please simply how the book constructors and destructors methods. Fifth, the programming problem

Design of a Circle (circle) type, comprising a center position, the radius, color and other attributes. Writing the constructor and other methods, to calculate the perimeter and area. Please write functional program verification class.

Guess you like

Origin blog.csdn.net/A_xiansheng/article/details/94487294