在前面几题的基础上,有子类Dog和Cat继承了父类Animal,如下空格的输出是以下哪个选项?dog = Dog('coco','small'); cat = Cat('kawaii') >>> isinstance(dog, Animal) ___________ >>> isinstance(cat, Animal) ___________ >>> isinstance(dog, Dog) ___________ >>> isinstance(dog, Cat) ____________
A: True True False False
B: True True True False
C: True False False True
D: True True True True
A: True True False False
B: True True True False
C: True False False True
D: True True True True
举一反三
- 在前面几题的基础上,有子类Dog和Cat继承了父类Animal,如下空格的输出是以下哪个选项?dog = Dog(coco,small); cat = Cat(kawaii)>>> isinstance(dog, Animal)___________>>> isinstance(cat, Animal)___________>>> isinstance(dog, Dog)___________>>> isinstance(dog, Cat)____________
- 已知creature=("cat","dog","tiger","human"),则表达式“"dog"increature”的值是()。 A: False B: True C: false D: true
- 若Animal是Cat,Dog的父类,则下列选项中,正确的是() A: Animal animal = new Cat(); B: Animal a = new Cat(); Cat cat = (Cat) a; C: Animal animal = new Dog(); D: Cat cat = (Cat)new Dog();
- 若Animal是Cat,Dog的父类,则下列选项中,正确的是() A: Animal animal = new Cat(); B: Cat cat = (Cat)new Animal(); C: Animal animal = new Dog(); D: Cat cat = (Cat)new Dog();
- 有以下程序: 则输出结果为() A: False,true,true,true B: True,false,false,false C: False,false,true,false D: True,true,false,true