Deck 10: Introduction to Inheritance

ملء الشاشة (f)
exit full mode
سؤال
When a protected data field or method is created, it can be used within its own class or in any classes extended from that class; but it cannot be used by outside classes.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Arrows used in a ____ to show inheritance relationships extend from the descendant class and point to the original class.

A) method diagram
B) UML diagram
C) virtual method call
D) composition
سؤال
____ is a mechanism that enables one class to acquire all the behaviors and attributes of another class.

A) Inheritance
B) Polymorphism
C) Encapsulation
D) Overriding
سؤال
A nonstatic method cannot  override a static member  of a parent class.
سؤال
It is useful to override the parent class members when the superclass data fields and methods are not completely appropriate for the subclass objects.
سؤال
By convention, a class diagram contains the ____ following each attribute or method.

A) data field
B) argument
C) data type
D) class
سؤال
Subclasses are more specific than the superclass they extend.
سؤال
If a programming language does not support ____, the language is not considered object-oriented.

A) syntax
B) applets
C) loops
D) polymorphism
سؤال
The class used as a basis for inheritance is the ____ class.

A) child
B) extends
C) base
D) derived
سؤال
You cannot declare a class to be final .
سؤال
____ polymorphism is the ability of one method to work appropriately for subclasses of the same parent class.

A) Subtype
B) Name
C) Supertype
D) Override
سؤال
When you create any subclass object, the subclass constructor  must execute first, and then the superclass constructor  executes.
سؤال
An error is generated by the compiler when you attempt to override a static method with a nonstatic method.
سؤال
You use the keyword ____ to achieve inheritance in Java.

A) inherit
B) extends
C) super
D) public
سؤال
The ability to use inheritance in Java makes programs easier to write, ____, and more quickly understood.

A) faster
B) more secure
C) more robust
D) less error-prone
سؤال
A class diagram consists of a rectangle divided into three sections.
سؤال
Sometimes the superclass data fields and methods are not entirely appropriate for the subclass objects; in these cases, you want to ____ the parent class members.

A) negate
B) overrule
C) override
D) hide
سؤال
When you create a class by making it inherit from another class, the new class automatically contains the data fields and _____ of the original class.

A) fonts
B) methods
C) class names
D) arrays
سؤال
In a UML diagram, an inheritance relationship is indicated with an arrow that points from the original class  to the descendant class .
سؤال
When you use the method name with a child object, the parent's version of the method is used.
سؤال
An advantage to making a method ____ is that the compiler knows there will be only one version of the method.

A) inheritable
B) private
C) final
D) derived
سؤال
When you create parent and child classes of your own, the child classes use ____ constructors.

A) two
B) three
C) four
D) six
سؤال
Programmers and analysts sometimes use a graphical language to describe classes and object-oriented processes. This language is called ____.

A) pseudocode
B) GUI
C) UML
D) Java
سؤال
Which of the following statements depicts the valid format to call a superclass constructor from a subclass constructor?

A) superclass(name, score);
B) subclass(name, score);
C) extends(name, score);
D) super(name, score);
سؤال
When you create a class and do not provide a(n) ____, Java automatically supplies you with a default one.

A) constructor
B) argument
C) header
D) name
سؤال
Which statement correctly declares a sedan object of the Car class?

A) sedan Car = new sedan();
B) Car sedan = new sedan ();
C) Car sedan = new Car();
D) new sedan() =Car ();
سؤال
The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members of the parent class are not accessible within a child class's methods.

A) private
B) public
C) final
D) protected
سؤال
If a ____ method has the same name as a parent class method and you use the name with a child class object, the child method hides the original.

A) final
B) static
C) protected
D) private
سؤال
If jrStudent is an object of Student , which of the following statements will result in a value of true ?

A) Student = instanceof jrStudent
B) jrStudent instanceof Student
C) instanceof Student = jrStudent
D) Student instanceof jrStudent
سؤال
The term ____ means "many forms."

A) inheritance
B) polymorphism
C) UML
D) virtual
سؤال
When you employ ____, your data can be altered only by the methods you choose and only in ways that you can control.

A) virtual method calls
B) polymorphism
C) information hiding
D) inlining
سؤال
Usually, the subclass constructor only needs to initialize the ____ that are specific to the subclass.

A) objects
B) data fields
C) methods
D) constructors
سؤال
In Java, all instance method calls are ____ by default.

A) private
B) protected
C) virtual method calls
D) inherited
سؤال
The term ____ describes a "has a" relationship.

A) containment
B) owns
C) aggregation
D) superclass
سؤال
You can use the keyword ____ within a method in a derived class to access an overridden method in a base class.

A) sub
B) this
C) protected
D) super
سؤال
Using the keyword ____ provides you with an intermediate level of security between public and private access.

A) protected
B) this
C) super
D) secure
سؤال
You can use the ____ modifier with methods when you don't want the method to be overridden.

A) override
B) access
C) final
D) end
سؤال
Which of the following statements will create a class named Red that is based on the class Color ?

A) public class Red extends Color
B) public Red class extends Color
C) public Color class expands Red
D) public extend Red class Color
سؤال
You are never aware that ____ is taking place; the compiler chooses to use this procedure to save the overhead of calling a method.

A) information hiding
B) polymorphism
C) overriding
D) inlining
سؤال
In most Java classes, the keywo rd ____ precedes each data field, and the keyword ____ precedes each method.

A) public , public
B) private , private
C) public , private
D) private , public
سؤال
Match between columns
Graphical language used to describe classes and methods
information hiding
Graphical language used to describe classes and methods
inheritance
Graphical language used to describe classes and methods
super()
Graphical language used to describe classes and methods
superclass
Graphical language used to describe classes and methods
instanceof
Graphical language used to describe classes and methods
virtual method call
Graphical language used to describe classes and methods
inlining
Graphical language used to describe classes and methods
class diagram
Graphical language used to describe classes and methods
derived class
Graphical language used to describe classes and methods
UML
Graphical language used to describe classes and methods
fragile
Graphical language used to describe classes and methods
containment
Graphical language used to describe classes and methods
aggregation
Graphical language used to describe classes and methods
subtype polymorphism
Graphical language used to describe classes and methods
upcast
سؤال
Match between columns
Keeps data private
information hiding
Keeps data private
inheritance
Keeps data private
super()
Keeps data private
superclass
Keeps data private
instanceof
Keeps data private
virtual method call
Keeps data private
inlining
Keeps data private
class diagram
Keeps data private
derived class
Keeps data private
UML
Keeps data private
fragile
Keeps data private
containment
Keeps data private
aggregation
Keeps data private
subtype polymorphism
Keeps data private
upcast
سؤال
Match between columns
A base class
information hiding
A base class
inheritance
A base class
super()
A base class
superclass
A base class
instanceof
A base class
virtual method call
A base class
inlining
A base class
class diagram
A base class
derived class
A base class
UML
A base class
fragile
A base class
containment
A base class
aggregation
A base class
subtype polymorphism
A base class
upcast
سؤال
What is the difference between derived classes and base classes when considering two classes that inherit from each other?
سؤال
What does polymorphism mean in Java programming?
سؤال
How are real-life examples of inheritance similar to object-oriented programming inheritance?
سؤال
Match between columns
Determines whether an object is a member or descendant of a class
information hiding
Determines whether an object is a member or descendant of a class
inheritance
Determines whether an object is a member or descendant of a class
super()
Determines whether an object is a member or descendant of a class
superclass
Determines whether an object is a member or descendant of a class
instanceof
Determines whether an object is a member or descendant of a class
virtual method call
Determines whether an object is a member or descendant of a class
inlining
Determines whether an object is a member or descendant of a class
class diagram
Determines whether an object is a member or descendant of a class
derived class
Determines whether an object is a member or descendant of a class
UML
Determines whether an object is a member or descendant of a class
fragile
Determines whether an object is a member or descendant of a class
containment
Determines whether an object is a member or descendant of a class
aggregation
Determines whether an object is a member or descendant of a class
subtype polymorphism
Determines whether an object is a member or descendant of a class
upcast
سؤال
Match between columns
Casting to a supertype
information hiding
Casting to a supertype
inheritance
Casting to a supertype
super()
Casting to a supertype
superclass
Casting to a supertype
instanceof
Casting to a supertype
virtual method call
Casting to a supertype
inlining
Casting to a supertype
class diagram
Casting to a supertype
derived class
Casting to a supertype
UML
Casting to a supertype
fragile
Casting to a supertype
containment
Casting to a supertype
aggregation
Casting to a supertype
subtype polymorphism
Casting to a supertype
upcast
سؤال
Match between columns
Must be the first statement in the subclass constructor
information hiding
Must be the first statement in the subclass constructor
inheritance
Must be the first statement in the subclass constructor
super()
Must be the first statement in the subclass constructor
superclass
Must be the first statement in the subclass constructor
instanceof
Must be the first statement in the subclass constructor
virtual method call
Must be the first statement in the subclass constructor
inlining
Must be the first statement in the subclass constructor
class diagram
Must be the first statement in the subclass constructor
derived class
Must be the first statement in the subclass constructor
UML
Must be the first statement in the subclass constructor
fragile
Must be the first statement in the subclass constructor
containment
Must be the first statement in the subclass constructor
aggregation
Must be the first statement in the subclass constructor
subtype polymorphism
Must be the first statement in the subclass constructor
upcast
سؤال
Match between columns
Inherits from a base class
information hiding
Inherits from a base class
inheritance
Inherits from a base class
super()
Inherits from a base class
superclass
Inherits from a base class
instanceof
Inherits from a base class
virtual method call
Inherits from a base class
inlining
Inherits from a base class
class diagram
Inherits from a base class
derived class
Inherits from a base class
UML
Inherits from a base class
fragile
Inherits from a base class
containment
Inherits from a base class
aggregation
Inherits from a base class
subtype polymorphism
Inherits from a base class
upcast
سؤال
Match between columns
"has a"
information hiding
"has a"
inheritance
"has a"
super()
"has a"
superclass
"has a"
instanceof
"has a"
virtual method call
"has a"
inlining
"has a"
class diagram
"has a"
derived class
"has a"
UML
"has a"
fragile
"has a"
containment
"has a"
aggregation
"has a"
subtype polymorphism
"has a"
upcast
سؤال
What are the parts of a class diagram and how would you use them?
سؤال
Match between columns
Makes a program run faster
information hiding
Makes a program run faster
inheritance
Makes a program run faster
super()
Makes a program run faster
superclass
Makes a program run faster
instanceof
Makes a program run faster
virtual method call
Makes a program run faster
inlining
Makes a program run faster
class diagram
Makes a program run faster
derived class
Makes a program run faster
UML
Makes a program run faster
fragile
Makes a program run faster
containment
Makes a program run faster
aggregation
Makes a program run faster
subtype polymorphism
Makes a program run faster
upcast
سؤال
Match between columns
An instance method call
information hiding
An instance method call
inheritance
An instance method call
super()
An instance method call
superclass
An instance method call
instanceof
An instance method call
virtual method call
An instance method call
inlining
An instance method call
class diagram
An instance method call
derived class
An instance method call
UML
An instance method call
fragile
An instance method call
containment
An instance method call
aggregation
An instance method call
subtype polymorphism
An instance method call
upcast
سؤال
When you instantiate an object that is a member of a subclass, how many constructors are called?
سؤال
Match between columns
Specific type of containment
information hiding
Specific type of containment
inheritance
Specific type of containment
super()
Specific type of containment
superclass
Specific type of containment
instanceof
Specific type of containment
virtual method call
Specific type of containment
inlining
Specific type of containment
class diagram
Specific type of containment
derived class
Specific type of containment
UML
Specific type of containment
fragile
Specific type of containment
containment
Specific type of containment
aggregation
Specific type of containment
subtype polymorphism
Specific type of containment
upcast
سؤال
Match between columns
Methods that work appropriately for subclasses of the same parent class
information hiding
Methods that work appropriately for subclasses of the same parent class
inheritance
Methods that work appropriately for subclasses of the same parent class
super()
Methods that work appropriately for subclasses of the same parent class
superclass
Methods that work appropriately for subclasses of the same parent class
instanceof
Methods that work appropriately for subclasses of the same parent class
virtual method call
Methods that work appropriately for subclasses of the same parent class
inlining
Methods that work appropriately for subclasses of the same parent class
class diagram
Methods that work appropriately for subclasses of the same parent class
derived class
Methods that work appropriately for subclasses of the same parent class
UML
Methods that work appropriately for subclasses of the same parent class
fragile
Methods that work appropriately for subclasses of the same parent class
containment
Methods that work appropriately for subclasses of the same parent class
aggregation
Methods that work appropriately for subclasses of the same parent class
subtype polymorphism
Methods that work appropriately for subclasses of the same parent class
upcast
سؤال
Match between columns
A mechanism that enables one class to assume both the behavior and the attributes of another class
information hiding
A mechanism that enables one class to assume both the behavior and the attributes of another class
inheritance
A mechanism that enables one class to assume both the behavior and the attributes of another class
super()
A mechanism that enables one class to assume both the behavior and the attributes of another class
superclass
A mechanism that enables one class to assume both the behavior and the attributes of another class
instanceof
A mechanism that enables one class to assume both the behavior and the attributes of another class
virtual method call
A mechanism that enables one class to assume both the behavior and the attributes of another class
inlining
A mechanism that enables one class to assume both the behavior and the attributes of another class
class diagram
A mechanism that enables one class to assume both the behavior and the attributes of another class
derived class
A mechanism that enables one class to assume both the behavior and the attributes of another class
UML
A mechanism that enables one class to assume both the behavior and the attributes of another class
fragile
A mechanism that enables one class to assume both the behavior and the attributes of another class
containment
A mechanism that enables one class to assume both the behavior and the attributes of another class
aggregation
A mechanism that enables one class to assume both the behavior and the attributes of another class
subtype polymorphism
A mechanism that enables one class to assume both the behavior and the attributes of another class
upcast
سؤال
Match between columns
Classes that directly use fields from parent classes
information hiding
Classes that directly use fields from parent classes
inheritance
Classes that directly use fields from parent classes
super()
Classes that directly use fields from parent classes
superclass
Classes that directly use fields from parent classes
instanceof
Classes that directly use fields from parent classes
virtual method call
Classes that directly use fields from parent classes
inlining
Classes that directly use fields from parent classes
class diagram
Classes that directly use fields from parent classes
derived class
Classes that directly use fields from parent classes
UML
Classes that directly use fields from parent classes
fragile
Classes that directly use fields from parent classes
containment
Classes that directly use fields from parent classes
aggregation
Classes that directly use fields from parent classes
subtype polymorphism
Classes that directly use fields from parent classes
upcast
سؤال
Match between columns
A part of UML
information hiding
A part of UML
inheritance
A part of UML
super()
A part of UML
superclass
A part of UML
instanceof
A part of UML
virtual method call
A part of UML
inlining
A part of UML
class diagram
A part of UML
derived class
A part of UML
UML
A part of UML
fragile
A part of UML
containment
A part of UML
aggregation
A part of UML
subtype polymorphism
A part of UML
upcast
سؤال
What are the three types of methods that you cannot override in a subclass?
سؤال
  Use the above code and sections labeled 1, 2, and 3 to answer the following: Identify the labeled section that is the constructor for the Bicycle class, identify the section of fields of the Bicycle class, and identify the Bicycle class methods.<div style=padding-top: 35px> Use the above code and sections labeled 1, 2, and 3 to answer the following:
Identify the labeled section that is the constructor for the Bicycle class, identify the section of fields of the Bicycle class, and identify the Bicycle class methods.
سؤال
​ public class ASuperClass
{
   public ASuperClass()
   {
      System.out.println("In superclass constructor");
   }
}
public class ASubClass extends ASuperClass
{
   public ASubClass()
   {
      System.out.println("In subclass constructor");
   }
}
public class DemoConstructors
{
   public static void main(String[] args)
   {
      ASubClass child = new ASubClass();
   }
}

Given the above code, what will the output be when DemoConstructors executes?
سؤال
Create a class named Student that contains methods getGPA() , setIDNum() , and setGPA() . Be sure to declare variables and methods appropriately as public or private.
سؤال
What is the process of inlining and how is it accomplished in Java?
سؤال
You have a Student class with a constructor that requires two arguments: a character "F" for Freshman and an integer "2020" for the year. Create a Freshman class that is a subclass of Student with a constructor for Freshman . Include the initial super() statement and include a comment that reads "//Other statements go here".
سؤال
What is information hiding and how is it used?
سؤال
class InstanceofDemo
{
    public static void main(String[] args)
   {
        Parent object1 = new Parent();
        Parent object2 = new Child();
        System.out.println("object1 instanceof Parent: "
            + (obj1 instanceof Parent));
        System.out.println("object1 instanceof Child: "
            + (obj1 instanceof Child));
        System.out.println("object1 instanceof MyInterface: "
            + (obj1 instanceof MyInterface));
        System.out.println("object2 instanceof Parent: "
            + (obj2 instanceof Parent));
        System.out.println("object2 instanceof Child: "
            + (obj2 instanceof Child));
        System.out.println("object2 instanceof MyInterface: "
            + (obj2 instanceof MyInterface));
     }
}
The above code defines a parent class (named Parent ), a simple interface (named MyInterface ), and a child class (named Child ) that inherits from the parent and implements the interface.
Following program execution, what will be the output of the six println statements?
سؤال
class Vehicle {}
public class Car extends Vehicle
{
   public static void main(String args[])
   {
      Vehicle myCar = new Car();
      boolean result =  myCar instanceof Car;
      System.out.println(result);
   }
}
The above code uses the instanceof operator to determine whether an object is a member of a class. What will be the output following execution?
سؤال
How is the keyword protected used?
سؤال
Using a class named Student , write the statement to create a yearOne object of the Student class.
سؤال
What are virtual method calls?
سؤال
  The UML diagram above derives a subclass called EmployeeWithTerritory from the superclass Employee . Describe what variables and methods the class EmployeeWithTerritory  inherits from the superclass Employee. Also, describe any variables and public methods defined by the subclass EmployeeWithTerritory .<div style=padding-top: 35px> The UML diagram above derives a subclass called EmployeeWithTerritory from the superclass Employee . Describe what variables and methods the class EmployeeWithTerritory  inherits from the superclass Employee. Also, describe any variables and public methods defined by the subclass EmployeeWithTerritory .
سؤال
public HourlyEmployee(char dept, double rate, int hours)
{

     ---- code here ----

}
​Given the overloaded constructor above, write the appropriate statement that calls the superclass constructor  and passes the indicated arguments to the superclass constructor.
سؤال
    Will the above code compile correctly? Why or why not? Explain your answer.<div style=padding-top: 35px>     Will the above code compile correctly? Why or why not? Explain your answer.<div style=padding-top: 35px> Will the above code compile correctly? Why or why not? Explain your answer.
سؤال
Write the statement to create a class header with a superclass-subclass relationship, with Vehicle as the superclass and Subaru as the subclass.
سؤال
What happens when you write your own constructor in Java and what must you pay attention to?
سؤال
  The above code will generate an error message when compiling. Explain the error message and why it occurs.<div style=padding-top: 35px> The above code will generate an error message when compiling. Explain the error message and why it occurs.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/78
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: Introduction to Inheritance
1
When a protected data field or method is created, it can be used within its own class or in any classes extended from that class; but it cannot be used by outside classes.
True
2
Arrows used in a ____ to show inheritance relationships extend from the descendant class and point to the original class.

A) method diagram
B) UML diagram
C) virtual method call
D) composition
B
3
____ is a mechanism that enables one class to acquire all the behaviors and attributes of another class.

A) Inheritance
B) Polymorphism
C) Encapsulation
D) Overriding
A
4
A nonstatic method cannot  override a static member  of a parent class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
5
It is useful to override the parent class members when the superclass data fields and methods are not completely appropriate for the subclass objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
6
By convention, a class diagram contains the ____ following each attribute or method.

A) data field
B) argument
C) data type
D) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
7
Subclasses are more specific than the superclass they extend.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
8
If a programming language does not support ____, the language is not considered object-oriented.

A) syntax
B) applets
C) loops
D) polymorphism
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
9
The class used as a basis for inheritance is the ____ class.

A) child
B) extends
C) base
D) derived
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
10
You cannot declare a class to be final .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
11
____ polymorphism is the ability of one method to work appropriately for subclasses of the same parent class.

A) Subtype
B) Name
C) Supertype
D) Override
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
12
When you create any subclass object, the subclass constructor  must execute first, and then the superclass constructor  executes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
13
An error is generated by the compiler when you attempt to override a static method with a nonstatic method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
14
You use the keyword ____ to achieve inheritance in Java.

A) inherit
B) extends
C) super
D) public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
15
The ability to use inheritance in Java makes programs easier to write, ____, and more quickly understood.

A) faster
B) more secure
C) more robust
D) less error-prone
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
16
A class diagram consists of a rectangle divided into three sections.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
17
Sometimes the superclass data fields and methods are not entirely appropriate for the subclass objects; in these cases, you want to ____ the parent class members.

A) negate
B) overrule
C) override
D) hide
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
18
When you create a class by making it inherit from another class, the new class automatically contains the data fields and _____ of the original class.

A) fonts
B) methods
C) class names
D) arrays
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
19
In a UML diagram, an inheritance relationship is indicated with an arrow that points from the original class  to the descendant class .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
20
When you use the method name with a child object, the parent's version of the method is used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
21
An advantage to making a method ____ is that the compiler knows there will be only one version of the method.

A) inheritable
B) private
C) final
D) derived
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
22
When you create parent and child classes of your own, the child classes use ____ constructors.

A) two
B) three
C) four
D) six
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
23
Programmers and analysts sometimes use a graphical language to describe classes and object-oriented processes. This language is called ____.

A) pseudocode
B) GUI
C) UML
D) Java
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following statements depicts the valid format to call a superclass constructor from a subclass constructor?

A) superclass(name, score);
B) subclass(name, score);
C) extends(name, score);
D) super(name, score);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
25
When you create a class and do not provide a(n) ____, Java automatically supplies you with a default one.

A) constructor
B) argument
C) header
D) name
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which statement correctly declares a sedan object of the Car class?

A) sedan Car = new sedan();
B) Car sedan = new sedan ();
C) Car sedan = new Car();
D) new sedan() =Car ();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
27
The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members of the parent class are not accessible within a child class's methods.

A) private
B) public
C) final
D) protected
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
28
If a ____ method has the same name as a parent class method and you use the name with a child class object, the child method hides the original.

A) final
B) static
C) protected
D) private
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
29
If jrStudent is an object of Student , which of the following statements will result in a value of true ?

A) Student = instanceof jrStudent
B) jrStudent instanceof Student
C) instanceof Student = jrStudent
D) Student instanceof jrStudent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
30
The term ____ means "many forms."

A) inheritance
B) polymorphism
C) UML
D) virtual
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
31
When you employ ____, your data can be altered only by the methods you choose and only in ways that you can control.

A) virtual method calls
B) polymorphism
C) information hiding
D) inlining
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
32
Usually, the subclass constructor only needs to initialize the ____ that are specific to the subclass.

A) objects
B) data fields
C) methods
D) constructors
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
33
In Java, all instance method calls are ____ by default.

A) private
B) protected
C) virtual method calls
D) inherited
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
34
The term ____ describes a "has a" relationship.

A) containment
B) owns
C) aggregation
D) superclass
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
35
You can use the keyword ____ within a method in a derived class to access an overridden method in a base class.

A) sub
B) this
C) protected
D) super
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
36
Using the keyword ____ provides you with an intermediate level of security between public and private access.

A) protected
B) this
C) super
D) secure
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
37
You can use the ____ modifier with methods when you don't want the method to be overridden.

A) override
B) access
C) final
D) end
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the following statements will create a class named Red that is based on the class Color ?

A) public class Red extends Color
B) public Red class extends Color
C) public Color class expands Red
D) public extend Red class Color
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
39
You are never aware that ____ is taking place; the compiler chooses to use this procedure to save the overhead of calling a method.

A) information hiding
B) polymorphism
C) overriding
D) inlining
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
40
In most Java classes, the keywo rd ____ precedes each data field, and the keyword ____ precedes each method.

A) public , public
B) private , private
C) public , private
D) private , public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
Graphical language used to describe classes and methods
information hiding
Graphical language used to describe classes and methods
inheritance
Graphical language used to describe classes and methods
super()
Graphical language used to describe classes and methods
superclass
Graphical language used to describe classes and methods
instanceof
Graphical language used to describe classes and methods
virtual method call
Graphical language used to describe classes and methods
inlining
Graphical language used to describe classes and methods
class diagram
Graphical language used to describe classes and methods
derived class
Graphical language used to describe classes and methods
UML
Graphical language used to describe classes and methods
fragile
Graphical language used to describe classes and methods
containment
Graphical language used to describe classes and methods
aggregation
Graphical language used to describe classes and methods
subtype polymorphism
Graphical language used to describe classes and methods
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
42
Match between columns
Keeps data private
information hiding
Keeps data private
inheritance
Keeps data private
super()
Keeps data private
superclass
Keeps data private
instanceof
Keeps data private
virtual method call
Keeps data private
inlining
Keeps data private
class diagram
Keeps data private
derived class
Keeps data private
UML
Keeps data private
fragile
Keeps data private
containment
Keeps data private
aggregation
Keeps data private
subtype polymorphism
Keeps data private
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
43
Match between columns
A base class
information hiding
A base class
inheritance
A base class
super()
A base class
superclass
A base class
instanceof
A base class
virtual method call
A base class
inlining
A base class
class diagram
A base class
derived class
A base class
UML
A base class
fragile
A base class
containment
A base class
aggregation
A base class
subtype polymorphism
A base class
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
44
What is the difference between derived classes and base classes when considering two classes that inherit from each other?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
45
What does polymorphism mean in Java programming?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
46
How are real-life examples of inheritance similar to object-oriented programming inheritance?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
47
Match between columns
Determines whether an object is a member or descendant of a class
information hiding
Determines whether an object is a member or descendant of a class
inheritance
Determines whether an object is a member or descendant of a class
super()
Determines whether an object is a member or descendant of a class
superclass
Determines whether an object is a member or descendant of a class
instanceof
Determines whether an object is a member or descendant of a class
virtual method call
Determines whether an object is a member or descendant of a class
inlining
Determines whether an object is a member or descendant of a class
class diagram
Determines whether an object is a member or descendant of a class
derived class
Determines whether an object is a member or descendant of a class
UML
Determines whether an object is a member or descendant of a class
fragile
Determines whether an object is a member or descendant of a class
containment
Determines whether an object is a member or descendant of a class
aggregation
Determines whether an object is a member or descendant of a class
subtype polymorphism
Determines whether an object is a member or descendant of a class
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match between columns
Casting to a supertype
information hiding
Casting to a supertype
inheritance
Casting to a supertype
super()
Casting to a supertype
superclass
Casting to a supertype
instanceof
Casting to a supertype
virtual method call
Casting to a supertype
inlining
Casting to a supertype
class diagram
Casting to a supertype
derived class
Casting to a supertype
UML
Casting to a supertype
fragile
Casting to a supertype
containment
Casting to a supertype
aggregation
Casting to a supertype
subtype polymorphism
Casting to a supertype
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
49
Match between columns
Must be the first statement in the subclass constructor
information hiding
Must be the first statement in the subclass constructor
inheritance
Must be the first statement in the subclass constructor
super()
Must be the first statement in the subclass constructor
superclass
Must be the first statement in the subclass constructor
instanceof
Must be the first statement in the subclass constructor
virtual method call
Must be the first statement in the subclass constructor
inlining
Must be the first statement in the subclass constructor
class diagram
Must be the first statement in the subclass constructor
derived class
Must be the first statement in the subclass constructor
UML
Must be the first statement in the subclass constructor
fragile
Must be the first statement in the subclass constructor
containment
Must be the first statement in the subclass constructor
aggregation
Must be the first statement in the subclass constructor
subtype polymorphism
Must be the first statement in the subclass constructor
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
50
Match between columns
Inherits from a base class
information hiding
Inherits from a base class
inheritance
Inherits from a base class
super()
Inherits from a base class
superclass
Inherits from a base class
instanceof
Inherits from a base class
virtual method call
Inherits from a base class
inlining
Inherits from a base class
class diagram
Inherits from a base class
derived class
Inherits from a base class
UML
Inherits from a base class
fragile
Inherits from a base class
containment
Inherits from a base class
aggregation
Inherits from a base class
subtype polymorphism
Inherits from a base class
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
51
Match between columns
"has a"
information hiding
"has a"
inheritance
"has a"
super()
"has a"
superclass
"has a"
instanceof
"has a"
virtual method call
"has a"
inlining
"has a"
class diagram
"has a"
derived class
"has a"
UML
"has a"
fragile
"has a"
containment
"has a"
aggregation
"has a"
subtype polymorphism
"has a"
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
52
What are the parts of a class diagram and how would you use them?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
53
Match between columns
Makes a program run faster
information hiding
Makes a program run faster
inheritance
Makes a program run faster
super()
Makes a program run faster
superclass
Makes a program run faster
instanceof
Makes a program run faster
virtual method call
Makes a program run faster
inlining
Makes a program run faster
class diagram
Makes a program run faster
derived class
Makes a program run faster
UML
Makes a program run faster
fragile
Makes a program run faster
containment
Makes a program run faster
aggregation
Makes a program run faster
subtype polymorphism
Makes a program run faster
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
54
Match between columns
An instance method call
information hiding
An instance method call
inheritance
An instance method call
super()
An instance method call
superclass
An instance method call
instanceof
An instance method call
virtual method call
An instance method call
inlining
An instance method call
class diagram
An instance method call
derived class
An instance method call
UML
An instance method call
fragile
An instance method call
containment
An instance method call
aggregation
An instance method call
subtype polymorphism
An instance method call
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
55
When you instantiate an object that is a member of a subclass, how many constructors are called?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
56
Match between columns
Specific type of containment
information hiding
Specific type of containment
inheritance
Specific type of containment
super()
Specific type of containment
superclass
Specific type of containment
instanceof
Specific type of containment
virtual method call
Specific type of containment
inlining
Specific type of containment
class diagram
Specific type of containment
derived class
Specific type of containment
UML
Specific type of containment
fragile
Specific type of containment
containment
Specific type of containment
aggregation
Specific type of containment
subtype polymorphism
Specific type of containment
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
57
Match between columns
Methods that work appropriately for subclasses of the same parent class
information hiding
Methods that work appropriately for subclasses of the same parent class
inheritance
Methods that work appropriately for subclasses of the same parent class
super()
Methods that work appropriately for subclasses of the same parent class
superclass
Methods that work appropriately for subclasses of the same parent class
instanceof
Methods that work appropriately for subclasses of the same parent class
virtual method call
Methods that work appropriately for subclasses of the same parent class
inlining
Methods that work appropriately for subclasses of the same parent class
class diagram
Methods that work appropriately for subclasses of the same parent class
derived class
Methods that work appropriately for subclasses of the same parent class
UML
Methods that work appropriately for subclasses of the same parent class
fragile
Methods that work appropriately for subclasses of the same parent class
containment
Methods that work appropriately for subclasses of the same parent class
aggregation
Methods that work appropriately for subclasses of the same parent class
subtype polymorphism
Methods that work appropriately for subclasses of the same parent class
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
58
Match between columns
A mechanism that enables one class to assume both the behavior and the attributes of another class
information hiding
A mechanism that enables one class to assume both the behavior and the attributes of another class
inheritance
A mechanism that enables one class to assume both the behavior and the attributes of another class
super()
A mechanism that enables one class to assume both the behavior and the attributes of another class
superclass
A mechanism that enables one class to assume both the behavior and the attributes of another class
instanceof
A mechanism that enables one class to assume both the behavior and the attributes of another class
virtual method call
A mechanism that enables one class to assume both the behavior and the attributes of another class
inlining
A mechanism that enables one class to assume both the behavior and the attributes of another class
class diagram
A mechanism that enables one class to assume both the behavior and the attributes of another class
derived class
A mechanism that enables one class to assume both the behavior and the attributes of another class
UML
A mechanism that enables one class to assume both the behavior and the attributes of another class
fragile
A mechanism that enables one class to assume both the behavior and the attributes of another class
containment
A mechanism that enables one class to assume both the behavior and the attributes of another class
aggregation
A mechanism that enables one class to assume both the behavior and the attributes of another class
subtype polymorphism
A mechanism that enables one class to assume both the behavior and the attributes of another class
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
59
Match between columns
Classes that directly use fields from parent classes
information hiding
Classes that directly use fields from parent classes
inheritance
Classes that directly use fields from parent classes
super()
Classes that directly use fields from parent classes
superclass
Classes that directly use fields from parent classes
instanceof
Classes that directly use fields from parent classes
virtual method call
Classes that directly use fields from parent classes
inlining
Classes that directly use fields from parent classes
class diagram
Classes that directly use fields from parent classes
derived class
Classes that directly use fields from parent classes
UML
Classes that directly use fields from parent classes
fragile
Classes that directly use fields from parent classes
containment
Classes that directly use fields from parent classes
aggregation
Classes that directly use fields from parent classes
subtype polymorphism
Classes that directly use fields from parent classes
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
60
Match between columns
A part of UML
information hiding
A part of UML
inheritance
A part of UML
super()
A part of UML
superclass
A part of UML
instanceof
A part of UML
virtual method call
A part of UML
inlining
A part of UML
class diagram
A part of UML
derived class
A part of UML
UML
A part of UML
fragile
A part of UML
containment
A part of UML
aggregation
A part of UML
subtype polymorphism
A part of UML
upcast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
61
What are the three types of methods that you cannot override in a subclass?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
62
  Use the above code and sections labeled 1, 2, and 3 to answer the following: Identify the labeled section that is the constructor for the Bicycle class, identify the section of fields of the Bicycle class, and identify the Bicycle class methods. Use the above code and sections labeled 1, 2, and 3 to answer the following:
Identify the labeled section that is the constructor for the Bicycle class, identify the section of fields of the Bicycle class, and identify the Bicycle class methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
63
​ public class ASuperClass
{
   public ASuperClass()
   {
      System.out.println("In superclass constructor");
   }
}
public class ASubClass extends ASuperClass
{
   public ASubClass()
   {
      System.out.println("In subclass constructor");
   }
}
public class DemoConstructors
{
   public static void main(String[] args)
   {
      ASubClass child = new ASubClass();
   }
}

Given the above code, what will the output be when DemoConstructors executes?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
64
Create a class named Student that contains methods getGPA() , setIDNum() , and setGPA() . Be sure to declare variables and methods appropriately as public or private.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
65
What is the process of inlining and how is it accomplished in Java?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
66
You have a Student class with a constructor that requires two arguments: a character "F" for Freshman and an integer "2020" for the year. Create a Freshman class that is a subclass of Student with a constructor for Freshman . Include the initial super() statement and include a comment that reads "//Other statements go here".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
67
What is information hiding and how is it used?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
68
class InstanceofDemo
{
    public static void main(String[] args)
   {
        Parent object1 = new Parent();
        Parent object2 = new Child();
        System.out.println("object1 instanceof Parent: "
            + (obj1 instanceof Parent));
        System.out.println("object1 instanceof Child: "
            + (obj1 instanceof Child));
        System.out.println("object1 instanceof MyInterface: "
            + (obj1 instanceof MyInterface));
        System.out.println("object2 instanceof Parent: "
            + (obj2 instanceof Parent));
        System.out.println("object2 instanceof Child: "
            + (obj2 instanceof Child));
        System.out.println("object2 instanceof MyInterface: "
            + (obj2 instanceof MyInterface));
     }
}
The above code defines a parent class (named Parent ), a simple interface (named MyInterface ), and a child class (named Child ) that inherits from the parent and implements the interface.
Following program execution, what will be the output of the six println statements?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
69
class Vehicle {}
public class Car extends Vehicle
{
   public static void main(String args[])
   {
      Vehicle myCar = new Car();
      boolean result =  myCar instanceof Car;
      System.out.println(result);
   }
}
The above code uses the instanceof operator to determine whether an object is a member of a class. What will be the output following execution?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
70
How is the keyword protected used?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
71
Using a class named Student , write the statement to create a yearOne object of the Student class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
72
What are virtual method calls?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
73
  The UML diagram above derives a subclass called EmployeeWithTerritory from the superclass Employee . Describe what variables and methods the class EmployeeWithTerritory  inherits from the superclass Employee. Also, describe any variables and public methods defined by the subclass EmployeeWithTerritory . The UML diagram above derives a subclass called EmployeeWithTerritory from the superclass Employee . Describe what variables and methods the class EmployeeWithTerritory  inherits from the superclass Employee. Also, describe any variables and public methods defined by the subclass EmployeeWithTerritory .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
74
public HourlyEmployee(char dept, double rate, int hours)
{

     ---- code here ----

}
​Given the overloaded constructor above, write the appropriate statement that calls the superclass constructor  and passes the indicated arguments to the superclass constructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
75
    Will the above code compile correctly? Why or why not? Explain your answer.     Will the above code compile correctly? Why or why not? Explain your answer. Will the above code compile correctly? Why or why not? Explain your answer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
76
Write the statement to create a class header with a superclass-subclass relationship, with Vehicle as the superclass and Subaru as the subclass.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
77
What happens when you write your own constructor in Java and what must you pay attention to?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
78
  The above code will generate an error message when compiling. Explain the error message and why it occurs. The above code will generate an error message when compiling. Explain the error message and why it occurs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 78 في هذه المجموعة.