Deck 9: Inheritance

ملء الشاشة (f)
exit full mode
سؤال
Which of the following shows the inheritance relationships among classes in a manner similar to that of a family tree.

A) UML diagram
B) CRC card
C) flowchart
D) class hierarchy
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
When a class contains an abstract method, you cannot create an instance of the class.
سؤال
You can write a super statement that calls a superclass constructor but only in the subclass's constructor.
سؤال
In an inheritance relationship, the subclass constructor always executes before the superclass constructor.
سؤال
A __________ member's access is somewhere between public and private.

A) package
B) protected
C) static
D) final
سؤال
Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.
سؤال
An abstract class is not instantiated itself but serves as a superclass for other classes.
سؤال
When an "is a" relationship exists between objects, it means that the specialized object has all the characteristics of the general object plus additional characteristics that make it special.
سؤال
A(n) __________ method is a method that appears in a superclass but expects to be overridden in a subclass.

A) abstract
B) protected
C) static
D) overloaded
سؤال
If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method.
سؤال
Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.
سؤال
You show inheritance in a UML diagram by connecting two classes with a line that has an open arrowhead pointing to the subclass.
سؤال
All fields declared in an interface

A) have protected access
B) must be initialized in the class implementing the interface
C) have private access
D) are treated as final and static
سؤال
What type of relationship exists between two objects when one object is a specialized version of another object?

A) "is a"
B) "contains a"
C) "has a"
D) "consists of"
سؤال
In object-oriented programming, __________ allows you to extend the capabilities of a class by creating another class that is a specialized version of it.

A) prototyping
B) code reusability
C) inheritance
D) data hiding
سؤال
When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object.
سؤال
When an "is a" relationship exists between objects, the specialized object has

A) some of the characteristics of the general class, but not all, plus additional characteristics
B) some, but not all, of the characteristics of the general object
C) none of the characteristics of the general object
D) all of the characteristics of the general object plus additional characteristics
سؤال
If a subclass constructor does not explicitly call a superclass constructor,

A) the superclass's fields will be set to the default values for their data types
B) Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes
C) it must include the code necessary to initialize the superclass fields
D) Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
سؤال
In Java, a reference variable is __________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.

A) static
B) dynamic
C) polymorphic
D) public
سؤال
A subclass can directly access

A) only protected and private members of the superclass
B) all members of the superclass
C) only public and private members of the superclass
D) only public and protected members of the superclass
سؤال
All methods specified by an interface are

A) private
B) public
C) protected
D) static
سؤال
In a UML diagram you show a realization relationship by connecting a class and an interface with a

A) dashed line with an open arrowhead at one end
B) line with an open diamond at one end
C) dashed line
D) line with an open arrowhead at one end
سؤال
A class becomes abstract when you place the __________ key word in the class definition.

A) super
B) extends
C) final
D) abstract
سؤال
When a class does not use the extends key word to inherit from another class, Java automatically extends it from the __________ class.

A) Object
B) subclass
C) superclass
D) public
سؤال
If ClassC is derived from ClassB which is derived from ClassA, this would be an example of

A) a chain of inheritance
B) linear inheritance
C) multiple interfaces
D) cascading classes
سؤال
Which of the following is the operator used to determine whether an object is an instance of a particular class?

A) equals
B) instanceOf
C) >>
D) isa
سؤال
In the following statement, which is the superclass? public class ClassA extends ClassB implements ClassC

A) ClassA
B) ClassB
C) ClassC
D) both ClassB and ClassC are superclasses
سؤال
Protected class members can be denoted in a UML diagram with the __________ symbol.

A) +
B) -
C) *
D) #
سؤال
A protected member of a class may be directly accessed by

A) methods of the same class
B) methods of a subclass
C) methods in the same package
D) Any of these
سؤال
Which key word indicates that a class inherits from another class?

A) final
B) super
C) implements
D) extends
سؤال
In a class hierarchy

A) the more general classes are toward the right of the tree and the more specialized classes are toward the left
B) the more general classes are toward the top of the tree and the more specialized classes are toward the bottom
C) the more general classes are toward the left of the tree and the more specialized classes are toward the right
D) the more general classes are toward the bottom of the tree and the more specialized classes are toward the top
سؤال
Which of the following statements declares Salaried as a subclass of PayType?

A) public class Salaried implements PayType
B) public class PayType derives Salaried
C) public class Salaried extends PayType
D) public class Salaried derivedFrom(PayType)
سؤال
When a class implements an interface, an inheritance relationship known as __________ inheritance is established.

A) implemented
B) interface
C) realized
D) abstract
سؤال
If a method in a subclass has the same signature as a method in the superclass, the subclass method __________ the superclass method.

A) inherits
B) overloads
C) overrides
D) implements
سؤال
In the following statement, which is the subclass?
public class ClassA extends ClassB implements ClassC

A) ClassA
B) ClassB
C) ClassC
D) both ClassB and ClassC are subclasses
سؤال
If you don't provide an access specifier for a class member, the class member is given __________ access by default.

A) private
B) public
C) protected
D) package
سؤال
In __________, inheritance is shown with a line that has an open arrowhead at one end that points to the superclass.

A) pseudocode
B) a UML diagram
C) a CRC card
D) a hierarchy chart
سؤال
In the following statement, which is the interface? public class ClassA extends ClassB implements ClassC

A) ClassA
B) ClassB
C) ClassC
D) all are interfaces
سؤال
Which of the following statements correctly specifies two interfaces?

A) public class ClassA implements [Interface1, Interface2]
B) public class ClassA implements (Interface1, Interface2)
C) public class ClassA implements Interface1, Interface2
D) public class ClassA implements Interface1 | Interface2
سؤال
When a method is declared with the __________ modifier, it cannot be overridden in a subclass.

A) final
B) super
C) void
D) public
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 9: Inheritance
1
Which of the following shows the inheritance relationships among classes in a manner similar to that of a family tree.

A) UML diagram
B) CRC card
C) flowchart
D) class hierarchy
D
2
When a class contains an abstract method, you cannot create an instance of the class.
True
3
You can write a super statement that calls a superclass constructor but only in the subclass's constructor.
True
4
In an inheritance relationship, the subclass constructor always executes before the superclass constructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
5
A __________ member's access is somewhere between public and private.

A) package
B) protected
C) static
D) final
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
7
An abstract class is not instantiated itself but serves as a superclass for other classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
8
When an "is a" relationship exists between objects, it means that the specialized object has all the characteristics of the general object plus additional characteristics that make it special.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
9
A(n) __________ method is a method that appears in a superclass but expects to be overridden in a subclass.

A) abstract
B) protected
C) static
D) overloaded
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
10
If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
12
You show inheritance in a UML diagram by connecting two classes with a line that has an open arrowhead pointing to the subclass.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
13
All fields declared in an interface

A) have protected access
B) must be initialized in the class implementing the interface
C) have private access
D) are treated as final and static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
14
What type of relationship exists between two objects when one object is a specialized version of another object?

A) "is a"
B) "contains a"
C) "has a"
D) "consists of"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
15
In object-oriented programming, __________ allows you to extend the capabilities of a class by creating another class that is a specialized version of it.

A) prototyping
B) code reusability
C) inheritance
D) data hiding
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
16
When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
17
When an "is a" relationship exists between objects, the specialized object has

A) some of the characteristics of the general class, but not all, plus additional characteristics
B) some, but not all, of the characteristics of the general object
C) none of the characteristics of the general object
D) all of the characteristics of the general object plus additional characteristics
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
If a subclass constructor does not explicitly call a superclass constructor,

A) the superclass's fields will be set to the default values for their data types
B) Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes
C) it must include the code necessary to initialize the superclass fields
D) Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
19
In Java, a reference variable is __________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.

A) static
B) dynamic
C) polymorphic
D) public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
20
A subclass can directly access

A) only protected and private members of the superclass
B) all members of the superclass
C) only public and private members of the superclass
D) only public and protected members of the superclass
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
21
All methods specified by an interface are

A) private
B) public
C) protected
D) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
22
In a UML diagram you show a realization relationship by connecting a class and an interface with a

A) dashed line with an open arrowhead at one end
B) line with an open diamond at one end
C) dashed line
D) line with an open arrowhead at one end
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
23
A class becomes abstract when you place the __________ key word in the class definition.

A) super
B) extends
C) final
D) abstract
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
24
When a class does not use the extends key word to inherit from another class, Java automatically extends it from the __________ class.

A) Object
B) subclass
C) superclass
D) public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
25
If ClassC is derived from ClassB which is derived from ClassA, this would be an example of

A) a chain of inheritance
B) linear inheritance
C) multiple interfaces
D) cascading classes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following is the operator used to determine whether an object is an instance of a particular class?

A) equals
B) instanceOf
C) >>
D) isa
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
27
In the following statement, which is the superclass? public class ClassA extends ClassB implements ClassC

A) ClassA
B) ClassB
C) ClassC
D) both ClassB and ClassC are superclasses
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
Protected class members can be denoted in a UML diagram with the __________ symbol.

A) +
B) -
C) *
D) #
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
A protected member of a class may be directly accessed by

A) methods of the same class
B) methods of a subclass
C) methods in the same package
D) Any of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which key word indicates that a class inherits from another class?

A) final
B) super
C) implements
D) extends
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
31
In a class hierarchy

A) the more general classes are toward the right of the tree and the more specialized classes are toward the left
B) the more general classes are toward the top of the tree and the more specialized classes are toward the bottom
C) the more general classes are toward the left of the tree and the more specialized classes are toward the right
D) the more general classes are toward the bottom of the tree and the more specialized classes are toward the top
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the following statements declares Salaried as a subclass of PayType?

A) public class Salaried implements PayType
B) public class PayType derives Salaried
C) public class Salaried extends PayType
D) public class Salaried derivedFrom(PayType)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
33
When a class implements an interface, an inheritance relationship known as __________ inheritance is established.

A) implemented
B) interface
C) realized
D) abstract
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
34
If a method in a subclass has the same signature as a method in the superclass, the subclass method __________ the superclass method.

A) inherits
B) overloads
C) overrides
D) implements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
35
In the following statement, which is the subclass?
public class ClassA extends ClassB implements ClassC

A) ClassA
B) ClassB
C) ClassC
D) both ClassB and ClassC are subclasses
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
36
If you don't provide an access specifier for a class member, the class member is given __________ access by default.

A) private
B) public
C) protected
D) package
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
37
In __________, inheritance is shown with a line that has an open arrowhead at one end that points to the superclass.

A) pseudocode
B) a UML diagram
C) a CRC card
D) a hierarchy chart
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
In the following statement, which is the interface? public class ClassA extends ClassB implements ClassC

A) ClassA
B) ClassB
C) ClassC
D) all are interfaces
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following statements correctly specifies two interfaces?

A) public class ClassA implements [Interface1, Interface2]
B) public class ClassA implements (Interface1, Interface2)
C) public class ClassA implements Interface1, Interface2
D) public class ClassA implements Interface1 | Interface2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
40
When a method is declared with the __________ modifier, it cannot be overridden in a subclass.

A) final
B) super
C) void
D) public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.