subject

1,

Part of the Throttle implementation from Chapter 2 is shown below. Match each method with the correct classification.
public class Throttle
{
public Throttle(int size)...
public double getFlow( )...
public boolean isOn( )...
public void shift(int amount)...
public void shutOff( )...
}
Answer

-A. B.C.
public Throttle(int size)...
-A. B.C.
public double getFlow( )...
-A. B.C.
public boolean isOn( )...
-A. B.C.
public void shift(int amount)...
-A. B.C.
public void shutOff( )...

2.
What is the common pattern of class definitions that is used in Chapter 2?
Answer
A.
Methods and instance variables are both private.
B.
Methods are private, and instance variables are public.
C.
Methods are public, and instance variables are private.
D.
Methods and instance variables are both public.
3.Here is part of the Throttle declaration

public class Throttle
{
public Throttle(int size) ...
public double getFlow() ...
public void shift(int amount) ...
}

Write several lines of Java code to create a Throttle called quiz with 100 positions, activate the method that shifts quiz's flow to the halfway
point, and then print the current flow from quiz.

Answer
A.
Accessor method
B.
Constructor
C.
Modification method
4,

Suppose that the Foo class does not have a clone method. What happens when an assignment x=y; is given for two Foo objects?
Answer

A.
x is set to refer to a copy of y's object
B.
x is set to refer to the same object that y refers to
C.
Compiler error
D.
Run-time error
5.
Suppose I create two Throttles using the class from Chapter 2:
Throttle mower = new Throttle(...);
Throttle copter = new Throttle(...);

Which statement best describes the instance variable called top for these two Throttles?
Answer
A.
mower. top and copter. top will always be two separate instance variables.
B.
mower. top and copter. top will only be separate if the two throttles are created with a different number of positions.
C.
mower. top and copter. top will never be two separate instance variables.
6.
Here is a small function that uses the Bag class from Chapter 3:

public static void quiz( )
{
int i; // Line 1
IntArrayBag b = new IntArrayBag( ); // Line 2
b. add(42); // Line 3
i = b. size( ); // Line 4
System. out. println(i); // Line 5
}
When is the Bag's array created?
Answer
A.
During the execution of Line 2.

B.
During the execution of Line 3.

C.
Just after Line 4 and before line 5.

D.
After Line 5.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
What do the principles of notice, choice, onward transfer, and access closely apply to? a. privacyb. identificationc. retentiond. classification
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
The most common battery cable terminal is a that provides a large surface contact area with the ability to tighten the terminal onto the battery post using a nut and bolt.
Answers: 2
question
Computers and Technology, 22.06.2019 19:10
10. when you create a pivottable, you need to specify where to find the data for the pivottable. is it true
Answers: 2
question
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
You know the right answer?
1,

Part of the Throttle implementation from Chapter 2 is shown below. Match each method...
Questions
question
Mathematics, 22.04.2021 17:20
question
Mathematics, 22.04.2021 17:20
question
Mathematics, 22.04.2021 17:20
question
Mathematics, 22.04.2021 17:20
Questions on the website: 13722360