已知存在一个类Animal,现在想创建一个新类Bird类同时要继承Animal类,下列代码格式正确的是?

python2-lesson14

Quiz
•
Computers
•
3rd - 12th Grade
•
Medium

hang zheng
Used 18+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
def Animal(BIrd):
def Bird(Animal):
class Animal(Bird):
class Bird(Animal):
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
观察上图中的代码,谁是父类,谁是子类?
Animal是父类,Dog是子类
Dog是父类,Animal是子类
两个都是父类
两个类毫无关联,没有父类子类的区分
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
观察上述代码,请问创建的实例d中有几个属性?
1
2
3
4
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
super().__init__()中的super()表示什么?
父类
子类
父类的__init__()方法
子类的__init__()方法
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
运行上述代码,程序会产生什么结果?
程序报错
输出1
程序运行正常,但什么都不输出
输出None
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Animal类中有一个run方法,现在有一个Dog类的实例d,Dog类中并没有run方法,请问d可以运行run方法吗?
一定可以,因为Animal中有run()方法
不一定,因为无法确定Dog类是否继承了Animal类
一定不可以,因为Dog类中没有run方法
一定可以,Dog类自带一个run()方法
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
观察上述代码,如果想让实例d执行run()方法,下列代码正确的是?
Animal.run()
Dog.run()
d.run()
run()
Create a free account and access millions of resources
Similar Resources on Quizizz
10 questions
20/8/21六年级TMK ms24-25页

Quiz
•
6th Grade
12 questions
第六章储存装置PART 1

Quiz
•
9th - 12th Grade
10 questions
人工智能

Quiz
•
8th Grade
10 questions
统考电脑上册(29/9)

Quiz
•
12th Grade
7 questions
西方美术史

Quiz
•
9th Grade
15 questions
认识电脑(2011~2018年)

Quiz
•
6th - 8th Grade
10 questions
顺序结构复习

Quiz
•
10th Grade
10 questions
3-1資料處理

Quiz
•
7th Grade - University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade