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
(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;    ...
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,...
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);...
Goal:   Manage the inventory of objects sold in an online or brick and mortar store. If...
Goal:   Manage the inventory of objects sold in an online or brick and mortar store. If you can't implement all of the features of Project described in this document, implement what you can. Start by implementing the StockItem class, and its derived classes. Then add in the InventoryManager class later. In each case, the test files must be in separate classes. UML Diagram: Use Violet or other drawing software to draw the UML diagrams of each class that you use...
Which statement about Matlab handle class is true? Select one: a. Each handle class inherits from...
Which statement about Matlab handle class is true? Select one: a. Each handle class inherits from a value class. b. It is not possible to derive subclasses from handle classes. c. A handle class constructor returns a handle object that is a reference to the object created. d. If you reassign handle class variable Matlab creates an independent copy of the original object. e. The handle class is a superclass for all Matlab classes.
Compile and execute the application. You will discover that is has a bug in it -...
Compile and execute the application. You will discover that is has a bug in it - the filled checkbox has no effect - filled shapes are not drawn. Your first task is to debug the starter application so that it correctly draws filled shapes. The bug can be corrected with three characters at one location in the code. Java 2D introduces many new capabilities for creating unique and impressive graphics. We’ll add a small subset of these features to the...
11. Which of the following is false about Private Equity? A) Private Equity is an alternative...
11. Which of the following is false about Private Equity? A) Private Equity is an alternative investment class consisting of capital that is not traded on a public exchange B) Private Equity firms played a key role in funding the Silicon Valley Boom. C) During the Great Recession default rate for Private Equity firms was higher than for other Financial Intermediaries. D) Private Equity firms love to collect on medical bills. E) All the above are true