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:30
The blank is type of decision-maker who over analyzes information
Answers: 3
question
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Which of the following is not a way in which trees benefit the environment? a. they remove a significant amount of carbon dioxide from the atmosphere. b. they remove a significant amount of oxygen from the atmosphere. c. their roots hold soil in place, reducing rates of erosion. d. they remove ozone and particulates from the atmosphere. select the best answer from the choices provided a b c d
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
You know the right answer?
1,

Part of the Throttle implementation from Chapter 2 is shown below. Match each method...
Questions
Questions on the website: 13722362