Exam 10: Introduction to Inheritance

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

If jrStudent is an object of Student , which of the following statements will result in a value of true ?

Free
(Multiple Choice)
4.8/5
(31)
Correct Answer:
Verified

B

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.

Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
Verified

A

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.

Free
(Multiple Choice)
4.7/5
(30)
Correct Answer:
Verified

B

You can use the keyword _______ within a method in a derived class to access an overridden method in a base class.

(Multiple Choice)
4.8/5
(39)

By convention, a class diagram contains the ____ following each attribute or method.

(Multiple Choice)
4.7/5
(46)

When you employ ____, your data can be altered only by the methods you choose and only in ways that you can control.

(Multiple Choice)
4.8/5
(37)

What is information hiding and how is it used?

(Essay)
4.9/5
(30)

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?

(Essay)
4.8/5
(35)

What happens when you write your own constructor in Java and what must you pay attention to?

(Essay)
4.9/5
(39)

Subclasses are more specific than the superclass they extend.

(True/False)
4.8/5
(39)

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.

(Short Answer)
4.8/5
(39)

What is the process of inlining and how is it accomplished in Java?

(Essay)
4.8/5
(35)

What are the three types of methods that you cannot override in a subclass?

(Essay)
4.8/5
(38)

If a programming language does not support ____, the language is not considered object-oriented.

(Multiple Choice)
4.8/5
(41)

          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.

(Essay)
4.8/5
(41)

When you create any subclass object, the subclass constructor  must execute first, and then the superclass constructor  executes.

(True/False)
4.9/5
(33)

In most Java classes, the keyword private precedes each data field, and the keyword ____________________ precedes each method.

(Short Answer)
4.9/5
(34)

The classes you create in ____________________ programming languages can inherit data and methods from existing classes.

(Short Answer)
5.0/5
(31)
Match each term with the correct statement below.
Must be the first statement in the subclass constructor
inheritance
Keeps data private
inlining
A part of UML
virtual method call
Correct Answer:
Verified
Premises:
Responses:
Must be the first statement in the subclass constructor
inheritance
Keeps data private
inlining
A part of UML
virtual method call
Inherits from a base class
information hiding
A base class
derived class
Determines whether an object is a member or descendant of a class
super()
Makes a program run faster
superclass
A mechanism that enables one class to assume both the behavior and the attributes of another class
instanceof
An instance method call
class diagram
(Matching)
4.9/5
(38)

How are real-life examples of inheritance similar to object-oriented programming inheritance?

(Essay)
4.9/5
(39)
Showing 1 - 20 of 66
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)