Question

In: Computer Science

In Java 1. Which term best describes a "A uses B" class relationship? word answer: 2....

In Java
1. Which term best describes a "A uses B" class relationship? word answer:

2. choose correct one:

What are some of the ways a class can exhibit dependency?

A. A class can invoke the methods of another class.

B. A method within a class can accept an object of the same class.

C. A class can rely on a constant defined in another class.

D. All of the above.

Which if the following statements is FALSE regarding arrays of objects?

A. Objects stored in an array are automatically instantiated when the array is created.

B. Attempting to print out an empty array of objects will generate a NullPointerException.

C. An array of objects initially holds null references.

D. An array of objects is actually an array of references to the objects.

What symbol changes a typical parameter to a variable parameter list?

A :

B *

C ...

D ?

Which of the following rules is TRUE regarding variable parameter lists?

A. A variable parameter list can appear in any order in a list of formal arguments.

B. A method can only have one variable parameter list in its list of formal parameters.

C. A variable parameter list can be the only formal argument in a method.

D. You cannot use a variable parameter list in a constructor.

3. Fill in the Blanks

The keyword [_____] is used to establish an inheritance relationship.

The existing class is also known as the [_____] class.

4. When should the protected modifier be used?

A. When you want all classes to access variables or methods from any other classes.

B. When you want a derived class to access a variable or method from the (originally) existing class.

C. When you don't want any variable or method to be accessible outside the class.

D. When you want a single method or variable to be shared among all objects.

5. The super reference is typically used by the child class to call which type of method? Word Answer:

6. Fill in the Blanks

A new method must have the same [_____] as the existing method in order to perform overriding..

Solutions

Expert Solution

thanks for the question, here are the answers

=======================================================================

1. extends, example: Class A extends B

2. Option A is not correct, if a class can invoke the methods of another class then there is no dependency
   Option B: is correct, by accepting an object of the same class we are exhibiting dependency
   Option C: constants defined in another class is not achieving dependency


3. A. Objects stored in an array are automatically instantiated when the array is created. is FALSE
when we create an array we are creating null references and not actual objects


What symbol changes a typical parameter to a variable parameter list? Answer : ...


B. A method can only have one variable parameter list in its list of formal parameters. is the only true statement


3.
Answer extends, by using the keyword extends we establish an inheritance relationship


4.

B. When you want a derived class to access a variable or method from the (originally) existing class.
protected access specifier is used only when a class extends another class, and we want the child
class to access the parent member variables.


5. Answer: constructor, we used super keyword to invoke parent constructors

6. Answer: name and signature ( argument list)


Related Solutions

1) Consider the following Java method. Which term best describes what this method computes? static int...
1) Consider the following Java method. Which term best describes what this method computes? static int doSomething(int[] a) {     int b = a[0];     for (int c : a) if (b > c) b = c;     return b; } a. average b. maximum c. minimum d. sum e. transpose 2) Consider the following Java program, what starts on line 2? 1 public class HelloWorld { 2     // My first program! 3     public static void main(String[] args) { 4        ...
1. Which best describes interest? a. Interest is another word for the cash and rewards you...
1. Which best describes interest? a. Interest is another word for the cash and rewards you get from using certain credit cards. b. Interest is a method by which you can compare the cost of comparable purchases. c. Interest is the cost associated with using credit and it ultimately makes any purchase made using credit more expensive than the same purchase made with cash. d. Interest is the fee associated with using more credit than the limit on your credit...
Which term best describes the practice of nursing 1. the hand-on care, such as giving a...
Which term best describes the practice of nursing 1. the hand-on care, such as giving a bath 2. the hand-on application of knowledge 3.the scientific basis for care 3. respect for each individual partient
1- Which of the following best describes the idea of when an individual constructs human relationship...
1- Which of the following best describes the idea of when an individual constructs human relationship and establishes trust through exchanges of favors? Select one: Social Exchange Framing 2- Which of the following sequences accurately describes the order of the stages of team development? Select one: Launch, growth, leveling-off, maturing, and decline Introduction, orientation, settling in, establishment Forming, storming, norming, performing, and adjourning Startup growth, leveling-off, maturing, and decline Law of inclusion Exchange of ideas 3- Disruptive behaviors that can...
Which of the following best describes the relationship between imports and exports? Import spending is ___________...
Which of the following best describes the relationship between imports and exports? Import spending is ___________ GDP and export spending is __________ GDP. A) subtracted from; subtracted from B) added to; subtracted from C) subtracted from; added to D) added to; added to
1. Which of the following best describes a success scenario? - A statement that describes how...
1. Which of the following best describes a success scenario? - A statement that describes how certain decisions lead to success -A statement that defines what it means for the system to perform as intended   -A statement of what could go wrong within a system -A statement of who, what, when, where and how a system would fail 2. Which of the following variable types represent measurable properties of a system itself? -Input Variables -Output Variables -Exogenous Variables    -State Variables...
5). Which of the following best describes the relationship between supply curve and the marginal cost...
5). Which of the following best describes the relationship between supply curve and the marginal cost curve for the purely competitive firm in the short run? a. The supply curve is the same as the marginal cost curve throughout its upward sloping part. b. The marginal cost curve and supply curve are the same above the average total cost curve. c. The supply curve is the same as the marginal cost curve above the average variable cost curve. d. The...
Which of the following statements best describes the relationship of structure to higher leadership performance? Correct...
Which of the following statements best describes the relationship of structure to higher leadership performance? Correct Answer To attain higher effectiveness, you must reach higher performance. Correct Answer To perform more masterfully, your Inner Operating System (IOS) must evolve to a higher order mental-emotional structure. Correct Answer Since performance determines structure, if you want to evolve to a higher order structure, you must reach higher performance. Correct Answer When we see extraordinary leadership, we see well-honed capability arising on a...
Which of the following best describes the demographic situation in the United States? Group of answer...
Which of the following best describes the demographic situation in the United States? Group of answer choices A)The overall population is expected to decrease in the future, while the number of those older than 65 years is expected to increase. B)The number of those older than 85 years is expected to exceed the number aged 65 and 85 years by 2040. C)The number of those older than 65 years is expected to peak by 2040 and then gradually decline. D)The...
Which of the following best describes the tRNA binding sites of the ribosome? Group of answer...
Which of the following best describes the tRNA binding sites of the ribosome? Group of answer choices A. The P site contains the tRNA molecule covalently bound to the growing chain of amino acids. B. All tRNAs leave the ribosome through the A site. C. Only one of the three sites can be occupied by a tRNA molecule at any given time. D. Each tRNA that associates with the ribosome must first bind in the P site and then moved...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT