Question

JAVA QUIZ Question 1 Which of the following is false about a "super" call in a...

JAVA QUIZ

Question 1

Which of the following is false about a "super" call in a sub class's constructor?

Select one:

a. It must be the first statement in the constructor

b. If you don't include it Java will

c. If you don't include it you must have a 0 parameter constructor coded in the super class or no constructors coded at all in the super class

d. The sub class constructor containing the super call and the called super class constructor must have matching parameter lists (i.e. same number and type of parameters)

e. If you think none of the above are false, select this option

Question 2

Which of the following components of a super class is not inherited by its sub classes?

Select one or more:

a. Private methods

b. Static methods

c. Accessors

d. Constructors

e. Mutators

f. Public methods

g. Instance variables

h. Non-static methods

Question 3

Which of the following is sufficient for 2 methods to overload?

Note: sub/super means the methods are in two classes that are in an inheritance relationship.

Select one:

a. Same signature, same class

b. Different signature but same name, same class

c. Different signature including different name, same class

d. Different signature but same name, sub/super class

e. If you think more than one of the above are sufficient for 2 methods to overload, select this option

Question 4

In the inheritance scenario involving coding a core class with multiple specialised sub classes which of the following is least likely to be used?

Select one:

a. Adding new instance variables to a sub class

b. Adding new methods to a sub class

c. Overriding inherited methods in a sub class

d. Use of an abstract class

e. If you think none of the above are clearly the least likely to be used, select this option

Question 5

Which of the following is necessary for a method to override another method?

Note: sub/super means the methods are in two classes that are in an inheritance relationship.

Select one:

a. Same signature, same class

b. Same signature, sub/super class

c. Different signature but same name, sub/super class

d. Different signature including different name, sub/super class

e. If you think none of the above are what is necessary for a method to override another method, select this option

Question 6

Which of the following components of a super class cannot be called in its sub classes?

Select one:

a. Overridden methods

b. Constructors

c. Mutators

d. Accessors

e. Public methods

f. Private methods

g. If you believe all of the above components of a super class can be called in its sub classes, select this option

Question 7

In the inheritance scenario involving the reuse of an existing class which of the following is least likely to be used?

Select one:

a. Adding new instance variables to a sub class

b. Adding new methods to a sub class

c. Overriding inherited methods in a sub class

d. Use of an abstract class

e. If you think none of the above are clearly the least likely to be used, select this option

Question 8

Which of the following cannot be added to a sub class?

Select one:

a. New public class level variables

b. New private class level variables

c. New public methods

d. New private methods

e. If you think all of the above can be added to a sub class, select this option

Question 9

Which of the following members of a super class are only indirectly accessible in its sub classes?

Select one:

a. Private class level variables

b. Public class level variables

c. Private methods

d. Public methods

e. If you believe more than one of the above are only indirectly accessible in a sub class, select this option

Question 10

Which of the following is false about an empty class you have just coded.

Select one:

a. It has a super class

b. It has a toString method

c. It has a constructor

d. A subclass of it could be coded

e. Select this option if you think none of the above are false

Homework Answers

Answer #1

Answers :

1. If you don't include it Java will

2. Private methods

3. If you think more than one of the above are sufficient for 2 methods to overload, select this option

4. Overriding inherited methods in a sub class

5. Different signature but same name, sub/super class

6. Private methods

7. Overriding inherited methods in a sub class

8. If you think all of the above can be added to a sub class, select this option

9. Public methods

10. Select this option if you think none of the above are false

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
IN JAVA Inheritance Using super in the constructor Using super in the method Method overriding Write...
IN JAVA Inheritance Using super in the constructor Using super in the method Method overriding Write an application with five classes Vehicle, Car, Bus, Truck, and Tester class with main method in it. The following characteristics should be used: make, weight, height, length, maxSpeed, numberDoors, maxPassenges, isConvertable, numberSeats, maxWeightLoad, and numberAxels. Characteristics that are applicable to all vehicles should be instance variables in the Vehicle class. The others should be in the class(s) where they belong. Class vehicle should have...
The following is for a Java Program Create UML Class Diagram for these 4 java classes....
The following is for a Java Program Create UML Class Diagram for these 4 java classes. The diagram should include: 1) All instance variables, including type and access specifier (+, -); 2) All methods, including parameter list, return type and access specifier (+, -); 3) Include Generalization and Aggregation where appropriate. Java Classes description: 1. User Class 1.1 Subclass of Account class. 1.2 Instance variables __ 1.2.1 username – String __ 1.2.2 fullName – String __ 1.2.3 deptCode – int...
(Please use Java Eclipse) QUESTION 1: For the question below, assume the following implementation of LinkedQueue:...
(Please use Java Eclipse) QUESTION 1: For the question below, assume the following implementation of LinkedQueue: public static final class LinkedQueue<T> implements QueueInterface<T> {     private Node<T> firstNode;     private Node<T> lastNode;     public LinkedQueue() {         firstNode = null;         lastNode = null;     }     @Override     public T getFront() {         if (isEmpty()) {             return null;         }         return firstNode.getData();     }     @Override     public boolean isEmpty() {         return firstNode == null;    ...
What is the output of the following Java program? public class Food {     static int...
What is the output of the following Java program? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { s = flavor; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         pepper.setFlavor("spicy");         System.out.println(pepper.getFlavor());     } } Select one: a. sweet b. 1 c. The program does not compile. d. 2 e. spicy...
JAVA Learning Objectives: To be able to code a class structure with appropriate attributes and methods....
JAVA Learning Objectives: To be able to code a class structure with appropriate attributes and methods. To demonstrate the concept of inheritance. To be able to create different objects and use both default and overloaded constructors. Practice using encapsulation (setters and getters) and the toString method. Create a set of classes for various types of video content (TvShows, Movies, MiniSeries). Write a super or parent class that contains common attributes and subclasses with unique attributes for each class. Make sure...
Design a class with the following requirements: 1- give the class a name from your choice....
Design a class with the following requirements: 1- give the class a name from your choice. 2- write some code that creates three instance variables, choose a name and type for each one of them. (must have two private and one public variables) 3- Initialize the variables using two different constructors. 4- Use mutator and accessor methods (set and get) for the private data members. 5- Display the value of each member variable using a method. 6- In the main,...
Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute....
Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An hourly employee has an hourly pay rate attribute, an hours worked attribute, and an earnings attribute. An hourly employee that works more than 40 hours gets paid at 1.5 times their hourly pay rate. You will decide how to implement constructors, getters, setters, and any other methods that might be necessary. 1. 2. (20 points) Draw a UML diagram for the classes. (80...
Classes/ Objects(programming language java ) in software (ATOM) Write a Dice class with three data fields...
Classes/ Objects(programming language java ) in software (ATOM) Write a Dice class with three data fields and appropriate types and permissions diceType numSides sideUp The class should have A 0 argument (default) constructor default values are diceType: d6, numSides: 6, sideUp: randomValue 1 argument constructor for the number of sides default values are diceType: d{numSides}, sideUp: randomValue 2 argument constructor for the number of sides and the diceType appropriate accessors and mutators *theoretical question: can you change the number of...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { flavor = s; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         System.out.println(pepper.getFlavor());     } } a. a class variable b. a constructor c. a local object variable d....
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*;...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*; import javax.swing.*; public class Clicker extends JFrame implements ActionListener {     int count;     JButton button;     Clicker() {         super("Click Me");         button = new JButton(String.valueOf(count));         add(button);         button.addActionListener(this);         setSize(200,100);         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         setVisible(true);     }     public void actionPerformed(ActionEvent e) {         count++;         button.setText(String.valueOf(count));     }     public static void main(String[] args) { new Clicker(); } } a. add(button);...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT