当前位置: 首页 > 工具软件 > Quiz1 > 使用案例 >

Coursera Using Databases with Python quiz1

麻烨
2023-12-01

Quiz 1 Object Oriented Programming (100分)
1.Which came first, the instance or the class?
class
instance
method
function

2.In Object Oriented Programming, what is another name for the “attributes” of an object?
forms
portions
messages
methods
fields

3.At the moment of creation of a new object, Python looks at the _________ definition to define the structure and capabilities of the newly created object
method
constructor
instance
class
cache

4.Which of the following is NOT a good synonym for “class” in Python?
template
blueprint
pattern
direction

5.What does this Python statement do if PartyAnimal is a class?
zap = PartyAnimal()

Copy the value from the PartyAnimal variable to the variable zap
Use the PartyAnimal template to make a new object and assign it to zap
Clear out all the data in the PartyAnimal variable and put the old values for the data in zap
Subtract the value of the zap variable from the value in the PartyAnimal variable and put the difference in zap

6.What is the syntax to look up the fullname attribute in an object stored in the variable colleen?
colleen.fullname
colleen->fullname
colleen::fullname
colleen[‘fullname’]

7.Which of these statements is used to indicate that class A will inherit all the features of class B?
A=B++;
class A(B) :
class A instance Of B :
class A inherits B :
class A extends B :

8.What keyword is used to indicate the start of a method in a Python class?
break
def
function
continue

9.What is “self” typically used for in a Python method within a class?
To set the residual value in an expression where the method is used
To refer to the instance in which the method is being called
The number of parameters to the method
To terminate a loop

10.What does the Python dir() function show when we pass an object into it as a parameter?
It shows the methods and attributes of the object
It shows the number of parameters to the constructor
It shows the type of the object
It shows the parent class

11.Which of the following is rarely used in Object Oriented Programming?
Method
Destructor
Constructor
Attribute

 类似资料:

相关阅读

相关文章

相关问答