Question: QUESTION 1 In OOP, a parent class is also called a 1. base class 2. superclass 3. derived class 4. ruling class 5. subclass QUESTION

QUESTION 1

In OOP, a parent class is also called a

1. base class

2. superclass

3. derived class

4. ruling class

5. subclass

QUESTION 2

Which of the following statements about representing inheritance relationship between two classes in a UML class diagram are true?

1. Draw an arrow from the child class to the parent class.

2. The arrowhead can be any type, e.g, -->, solid triangle.

3. Draw an arrow from the parent class to the child class.

4. The arrowhead must be a hollow triangle.

QUESTION 3

Below is a class declaration:

public class JFrame extends Frame

Based on the declaration, we know the subclass is ____, the superclass is ______.

QUESTION 4

Given the following class declaration:

public class JFrame extends Frame

and given that each class appearing in the above declaration has a one-argument constructor that has a String argument; and given that JFrame's constructor calls Frame's constructor.

Which of the following code implements the JFrame's constructor correctly?

1.public JFrame(String title) {

this(title);

}

2. public JFrame(String title) {

Frame(title);

}

3. public JFrame(String title) {

super.Frame(title);

}

4. public JFrame(String title) {

super(title);

}

QUESTION 5

Given the following class declaration

public class JFrame extends Frame

Each of the class in the declaration has a constructor with a String type argument.

Among the following statements, indicate the ones that correctly use the class or classes appearing in the above declaration.

1. String window = new JFrame("Tax Calculator");

2. JFrame window = new Frame("Tax Calculator");

3. JFrame window = new JFrame("Tax Calculator");

4. Frame window = new JFrame("Tax Calculator");

QUESTION 6

Suppose that the Student class has a name attribute with private visibility. Its 1-argument constructor and the getter and the setter for the attribute have public visibility.

Suppose the Graduate class is declared like the following:

public class Graduate extends Student

The Graduate students also has a degreeProgram attribute. Indicate which of the following statements are correct.

1. You must implement a getter method for the name attribute in the Graduate class.

2. The setter method for the name attribute is inherited by the Graduate class.

3. A Graduate instance has only one attribute: degreeProgram

4. A Graduate instance has two attributes: name and degreeProgram

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!