1.Which of the following statements about representing inheritance relationship
ID: 3837348 • Letter: 1
Question
1.Which of the following statements about representing inheritance relationship between two classes in a UML class diagram are true?
a.The arrowhead must be a hollow triangle.
b. Draw an arrow from the child class to the parent class.
c. The arrowhead can be any type, e.g, -->, solid triangle.
d. Draw an arrow from the parent class to the child class.
2. Below is a class declaration:
public class JFrame extends Frame
Based on the declaration, we know the subclass is ______________the superclass is _______________
3. 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?
a.public JFrame(String title {super.Frame(title);
}
b. public JFrame(String title {this(title);
}
c. public JFrame(String title {super(title);
}
d. public JFrame(String title {Frame(title);
}
4. 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.
Frame window = new JFrame("Tax Calculator");
a. JFrame window = new JFrame("Tax Calculator");
b JFrame window = new JFrame("Tax Calculator");
c. JFrame window = new Frame("Tax Calculator");
d. String window = new JFrame("Tax Calculator");
5. 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.
a. The setter method for the name attribute is inherited by the Graduate class.
b .You must implement a getter method for the name attribute in the Graduate class.
c. A Graduate instance has two attributes: name and degreeProgram
d..A Graduate instance has only one attribute: degreeProgram
a.The arrowhead must be a hollow triangle.
b. Draw an arrow from the child class to the parent class.
c. The arrowhead can be any type, e.g, -->, solid triangle.
d. Draw an arrow from the parent class to the child class.
Explanation / Answer
1.Which of the following statements about representing inheritance relationship between two classes in a UML class diagram are true?
a. The arrowhead must be a hollow triangle.
b. Draw an arrow from the child class to the parent class.
2. Below is a class declaration:
public class JFrame extends Frame
Based on the declaration, we know the subclass is ______JFrame________the superclass is _______Frame________.
3. 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?
c. public JFrame(String title {super(title);
}
4. 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.
b JFrame window = new JFrame("Tax Calculator");
5. 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.
c. A Graduate instance has two attributes: name and degreeProgram
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.