Question
JAVA 1. Which of the following are good candidates for instance variables for a class that you would define? A. Variables (like loop counters or
JAVA
1.
Which of the following are good candidates for instance variables for a class that you would define?
A. | Variables (like loop counters or temporary variables) used by most or all of your instance methods (in an attempt to avoid redeclaring these variables multiple times as locals for each instance method). |
B. | Private data whose values could be different for different objects of the class. |
C. | Constants used by the class and the client. |
D. | Variables whose values are shared by all class objects. 2. A linear search algorithm is written (as in the modules, for example) which searches an array for some user-defined value, clientData. If clientData is stored in the array, it returns its array position, and if not found, it returns -1 (again, just like in the modules). Assume the array to be searched has 100 data elements in it. (Check all that apply): [NOTE: due to common off-by-one interpretations when counting such things, if your predicted answer is within one (+1 or -1) of a posted option below, you can assume your prediction and the choice you are looking at are equivalent and check that option.]
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started