Starting Out with Java From Control Structures through Objects 7th Edition Gaddis Test Bankpdf download
Starting Out with Java From Control Structures through Objects 7th Edition Gaddis Test Bankpdf download
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-objects-7th-edition-gaddis-test-bank/
We believe these products will be a great fit for you. Click
the link to download now, or visit testbankfan.com
to discover even more!
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-objects-7th-edition-gaddis-solutions-
manual/
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-objects-6th-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-objects-6th-edition-gaddis-solutions-
manual/
https://testbankfan.com/product/laser-fundamentals-2nd-edition-
silfvast-solutions-manual/
Retailing Management 9th Edition Michael Levy Solutions
Manual
https://testbankfan.com/product/retailing-management-9th-edition-
michael-levy-solutions-manual/
https://testbankfan.com/product/mosbys-comprehensive-review-of-
dental-hygiene-7th-edition-darby-test-bank/
https://testbankfan.com/product/financial-accounting-the-impact-
on-decision-makers-9th-edition-porter-solutions-manual/
https://testbankfan.com/product/organizational-behaviour-
concepts-controversies-applications-sixth-canadian-edition-
canadian-6th-edition-langton-solutions-manual/
https://testbankfan.com/product/business-law-texts-and-
cases-14th-edition-clarkson-test-bank/
HR 2 2nd Edition DeNisi Test Bank
https://testbankfan.com/product/hr-2-0-2nd-edition-denisi-test-
bank/
Starting Out with Java: From Control Structures through Objects 7e (Gaddis)
Chapter 8 A Second Look at Classes and Objects
TRUE/FALSE
1. The key word this is the name of a reference variable that an object can use to refer to itself.
ANS: T
2. The key word this is the name of a reference variable that is available to all static methods.
ANS: F
3. The names of the enum constants in an enumerated data type must be enclosed in quotation marks.
ANS: F
ANS: T
ANS: T
6. An instance of a class does not have to exist in order for values to be stored in a class's static fields.
ANS: T
7. A class's static methods do not operate on the fields that belong to any instance of the class.
ANS: T
ANS: F
9. If a class has a method named finalize, it is called automatically just before an instance of the class
is destroyed by the garbage collector.
ANS: T
10. If a class has a method named finalize, it is called automatically just before a data member that has
been identified as final of the class is destroyed by the garbage collector.
ANS: F
11. If you write a toString method for a class, Java will automatically call the method any time you
concatenate an object of the class with a string.
ANS: T
12. When an object is passed as an argument, it is actually a reference to the object that is passed.
ANS: T
13. Both instance fields and instance methods are associated with a specific instance of a class, and they
cannot be used until an instance of the class is created.
ANS: T
14. A single copy of a class's static field is shared by all instances of the class.
ANS: T
15. When an object reference is passed to a method, the method may change the values in the object.
ANS: T
16. If you write a toString method to display the contents of an object, object1, for a class,
Class1, then the following two statements are equivalent:
System.out.println(object1);
System.out.println(object1.toString());
ANS: T
MULTIPLE CHOICE
5. When you make a copy of the aggregate object and of the objects that it references, __________.
a. you are performing a shallow copy
b. you are performing a nested copy
c. you are performing a deep copy
d. a compiler error will occur
ANS: C
8. The "has a" relationship is sometimes called a(n) __________ because one object is part of a greater
whole.
a. enterprise c. mutual relationship
b. possession d. whole-part relationship
ANS: D
9. The whole-part relationship created by object aggregation is more often called a(n) __________
relationship.
a. "has a" c. extra class
b. inner class d. inside class
ANS: A
10. The JVM periodically performs the __________ process to remove unreferenced objects from
memory.
a. memory shuffling c. garbage collection
b. system restore d. memory sweeping
ANS: C
11. CRC stands for __________.
a. Class, Recyclability, Collaborations c. Class, Responsibilities, Collaborations
b. Class, Redundancy, Collections d. Code, Reuse, Constancy
ANS: C
12. Enumerated types have the __________ method which returns the position of an enum constant in the
declaration list.
a. position c. ordinal
b. location d. index
ANS: C
13. Java automatically stores a __________ value in all uninitialized static member variables.
a. 0 b. -1 c. null d. false
ANS: A
14. You cannot use the fully-qualified name of an enum constant for ___________.
a. a case expression c. a boolean expression
b. an argument to a method d. Any of these
ANS: A
17. When a method's return type is a class, what is actually returned to the calling program?
a. an object of that class
b. a reference to an object of that class
c. the values in the object that the method accessed
d. nothing - the return type is simply for documentation in this situation
ANS: B
19. You cannot use the == operator to compare the contents of __________.
a. objects c. integers
b. strings d. Boolean values
ANS: A
20. An object's __________ is simply the data that is stored in the object's fields at any given moment.
a. value c. record
b. assessment d. state
ANS: D
21. A static field is created by placing the key word static __________.
a. after the access specifier and the field's data type
b. after the access specifier and before the field's data type
c. after the field name
d. in brackets, before the field's data type
ANS: B
22. A declaration for an enumerated type begins with the __________ key word.
a. enumerated c. ENUM
b. enum type d. enum
ANS: D
27. If you attempt to perform an operation with a null reference variable __________.
a. the resulting operation will always be zero
b. the results will be unpredictable
c. the program will terminate
d. Java will create an object to reference the variable
ANS: C
28. If object1 and object2 are objects of the same class, to make object2 a copy of object1
__________.
a. write a method for the class that will make a field by field copy of object1 data
members into object2 data members
b. use the copy method that is a part of the Java language
c. use the default constructor to create object2 with object1 data members
d. use an assignment statement to make object2 a copy of object1
ANS: A
29. If you have defined a class, SavingsAccount, with a public static method,
getNumberOfAccounts, and created a SavingsAccount object referenced by the variable
account20, which of the following will call the getNumberOfAccounts method?
a. account20.getNumberOfAccounts();
b. SavingsAccount.getNumberOfAccounts();
c. getNumberOfAccounts();
d. SavingsAccount.account20.getNumberOfAccounts();
ANS: B
30. If you have defined a class, SavingsAccount, with a public static data member named
numberOfAccounts, and created a SavingsAccount object referenced by the variable
account20, which of the following will assign numberOfAccounts to numAccounts?
a. numAccounts = account20.numAccounts;
b. numAccounts = numOfAccounts;
c. numAccounts = SavingsAccount.numberOfAccounts;
d. numAccounts = account20;
ANS: C
31. Assume the class BankAccount has been created and the following statement correctly creates an
instance of the class.
BankAccount account = new BankAccount(5000.00);
What is true about the following statement?
System.out.println(account);
a. A runtime error will occur.
b. The method will display unreadable binary data on the screen.
c. The account object's toString method will be implicitly called.
d. A compiler error will occur.
ANS: C
34. If the following is from the method section of a UML diagram, which of the statements below is true?
+ equals(object2:Stock) : boolean
a. This is a public method that accepts a Stock object as its argument and returns a
boolean value.
b. This is a public method that returns a reference to a String object.
c. This is a private method that receives two objects from the Stock class and returns a
boolean value.
d. This is a private method that returns a boolean value.
ANS: A
35. If the following is from the method section of a UML diagram, which of the statements below is true?
+ add(object2:Stock) : Stock
a. This is a private method named add that accepts and returns objects of the Stock class.
b. This is a private method named Stock that adds two objects.
c. This is a public method named add that accepts and returns references to objects in the
Stock class.
d. This is a public method named Stock that adds two objects.
ANS: C
36. Given the following method header, what will be returned from the method?
public Rectangle getRectangle()
a. the address of an object of the Rectangle class
b. the values stored in the data members of the Rectangle object
c. a graph of a rectangle
d. an object of the class Rectangle
ANS: A
Random documents with unrelated
content Scribd suggests to you:
Selection.—In order to intelligently select a machine so that it will properly
harmonize with the conditions under which it is to operate, there are several
things to be considered.
1. Type;
2. Capacity;
3. Efficiency;
4. Construction.
The general type of machine to be used is, of course, dependent on the
system employed, that is, whether it be direct or alternating, single or
polyphase.
Thus, the voltage in most cases is fixed except on transformer systems where a
choice of voltage may be had by selecting a transformer to suit.
In alternating circuits the standard frequencies are 25, and 60 cycles. These
frequencies are already in extensive use and it is recommended to adhere to
them as closely as possible.
Fig. 2,784.—Diagram of connections for testing to obtain the saturation curve of an alternator. The
saturation curve shows the relation between the volts generated in the armature and the amperes of
field current (or ampere turns of the field) for a constant armature current. The armature current may
be zero, in which case the curve is called no load saturation curve, or sometimes the open circuit
characteristic curve. A saturation curve may be taken with full load current in the armature; but this is
rarely done, except in alternators of comparatively small output. If a full load saturation curve be
desired, it can be approximately calculated from the no load saturation curve. The figure shows the
connections. If the voltage generated is greater than the capacity of the voltmeter, a multiplying coil or
a step down pressure transformer may be used, as shown. A series of observations of the voltage
between the terminals of one of the phases, is made for different values of the field current. Eight or
nine points along the curve are usually sufficient, the series extending from zero to about fifty per cent.
above normal rated voltage. The points should be taken more closely together in the vicinity of normal
voltage than at other portions of the curve. Care must be taken that the alternator is run at its rated
speed, and this speed must be kept constant. Deviations from constant speed may be most easily
detected by the use of a tachometer. If the machine be two phase or three phase, the voltmeter may be
connected to any one phase throughout a complete series of observations. The voltage of all the phases
should be observed for normal full load excitation by connecting the voltmeter to each phase
successively, keeping the field current constant at normal voltage. This is done in order to see how
closely the voltage of the different phases agree.
In fixing the capacity of a machine, careful consideration should be given to the
conditions of operation both present and future in order that the resultant
efficiency may be maximum.
Most machines show the best efficiency at or near full load. If the load be
always constant, as for instance, a pump forcing water to a given head, it would be
a simple matter to specify the proper size of machine, but in nearly all cases, and
especially in electrical plants, the load varies widely, not only the daily and hourly
fluctuations, but the varying demands depending on the season of the year and
growth of the plant's business. All of these conditions tend to complicate the
matter, so that intelligent selection of capacity of a machine requires not only
calculation but mature judgment, which is only obtained by long experience.
Fig. 2,785.—Saturation curve taken from a 2,000 kw., three phase alternator of the revolving field type,
having 16 poles, and generating 2,000 volts, and 576 amperes per phase when run at 300 R.P.M.
In selecting a machine, or in fact any item connected with the plant its
construction should be carefully considered.
Standard construction should be insisted upon so that in the event of damage a
new part can be obtained with the least possible delay.
The parts of most machines are interchangeable, that is to say, with the refined
methods of machinery a duplicate part (usually carried in stock) may be obtained
at once to replace a defective or broken part, and made with such precision that
little or no fitting will be required.
Figs. 2,786 and 2,787.—Wheel and roller pipe cutters illustrating range. The illustrations show the
comparative movements necessary with the two types of cutter to perform their function. The wheel
cutter requiring only a small arc of movement will cut a pipe in an inaccessible place as shown, which
with a roller cutter would be impossible. Accordingly, the wheel cutter is said to have a greater range
than the roller cutter.
Figs. 2,789 to 2,794.—Self oiling self aligning bearing open. Views showing oil grooves, rings, bolts etc.
Fig. 2,795.—Rotor of Westinghouse type T turbine dynamo set. The dynamo is of the commutating pole
type either shunt or compound wound. The turbine is of the single wheel impulse type. The wheel is
mounted directly on the end of the shaft as shown. Steam is used two or more times on the wheel to
secure efficiency. A fly ball governor is provided with weights hung on hardened steel knife edges. In
case of over speeding, an automatic safety stop throttle valve is tapped shutting off the steam supply.
This type of turbine dynamo set is especially applicable for exciter service in modern, superheated
steam generating stations where the steam pressure exceeds 125 pounds. Westinghouse Type T
turbines operate directly (that is, without a reducing valve) on pressures up to 200 pounds per square
inch with steam superheated to 150 degrees Fahrenheit.
Fig. 2,798.—View of armature in transit showing use of a wooden spreader as a protection. If a chain be
used in place of the rope, a padding of cloth should be placed around the armature shaft and special
care taken that the chain does not scratch the commutator.
Fig. 2,799.—Plan of belt drive machine showing V ways and adjusting screws for moving the machine
forward from the engine or counter shaft to take up slack in the belt.
Figs. 2,800 to 2,802.—Starrett's improved speed indicator. In construction, the working parts are
enclosed like a watch. The graduations show every revolution, and with two rows of figures read both
right and left as the shaft may run. While looking at the watch, each hundred revolutions may be
counted by allowing the oval headed pin on the revolving disc to pass under the thumb as the
instrument is pressed to its work. A late improvement in this indicator consists in the rotating disc,
which, being carried by friction may be moved to the starting point where the raised knobs coincide.
When the spindle is placed in connection with the revolving shaft, pressing the raised knob with the
thumb will prevent the disc rotating, while the hand of the watch gets to the right position to take the
time. By releasing the pressure the disc is liberated for counting the revolutions of the shaft when every
100 may be noted by feeling the knob pass under the thumb lightly pressed against it, thus relieving the
eye, which has only to look on the watch to note the time.
Example.—If a steam engine, running 300 revolutions per minute, have a belt
wheel 48 inches in diameter, and be belted to a dynamo having a pulley 12 inches
in diameter, how many revolutions per minute will the dynamo make?
The speed of dynamo will be 300 × (48 ÷ 12) = 1,200 rev. per min.
Rule.—When the speed of the driving pulley and its diameter are known, and
the diameter of the driven pulley is known, the speed of the driven pulley is found
by multiplying the speed of the driver by its diameter in inches and dividing the
product by the diameter of the driven pulley.
Example.—What will be the required speed of an engine having a belt wheel
46 inches in diameter to run a dynamo 1,500 revolutions per minute, the dynamo
pulley being 11 inches in diameter?
The speed of the engine is 1,500 × (11 ÷ 46) = 359 rev. per min. nearly.
Fig. 2,806.—Wiring diagram and directions for operating Holzer-Cabot single phase self-starting motor.
Location: The motor should be placed in as clear and dry a location as possible, away from acid or
other fumes which would attack the metal parts or insulation, and should be located where it is easily
accessible for cleaning and oiling. Erection: The motor should be set so that the shaft is level and
parallel with the shaft it is to drive so that the belt will run in the middle of the pulleys. Do not use a
belt which is too heavy or too tight for the work it has to do, as it will materially reduce the output of
the motor. The belt should be from one-half to one inch narrower than the pulley. Rotation: In order to
reverse the direction of rotation, interchange leads A and B. Suspended Motors: Motors with ring oil
bearings may be used on the wall or ceiling by taking off end caps and revolving 90 or 180 degrees until
the oil wells come directly below the bearings. Starting: Motors are provided with link across two
terminals on the upper right hand bracket at the front of the motor and with this connection should
start considerable overloads. If the starting current be too great with this connection, it may be reduced
by removing the link. Temperatures: At full load the motor will feel hot to the hand, but this is far
below the danger point. If too hot for touch, measure temperature with a thermometer by placing bulb
against field winding for 10 minutes, covering thermometer with cloth or waste. The temperature should
not exceed 75 degrees Fahr. above the surrounding air. Oiling: Fill the oil wells to the overflow before
starting and keep them full. See that the oil rings turn freely with shaft. Care: The motor must be kept
clean. Smooth collector rings with sandpaper and see that the brushes make good contact. When
brushes become worn they may be reversed. When fitting new brushes or changing them always
sandpaper them down until they make good contact with the collector rings, by passing a strip of
sandpaper beneath the brush.
Rule.—To find the speed of engine when diameter of both pulleys, and speed
of dynamo are given, multiply the dynamo speed by the diameter of its pulley and
divide by the diameter of engine pulley.
Ques. How are the diameters and speeds of gear wheels figured?
Ans. The same as belted wheels, using either the pitch circle diameters or
number of teeth in each gear wheel.
Figs. 2,807 to 2,809.—Wiring diagrams and directions for operating Holzer-Cabot slow speed alternating
current motors. Erecting: In installing the motor, be sure the transformer and wiring to the motor are
large enough to permit the proper voltage at the terminals. If too small, the voltage will drop and
reduce the capacity of the motor. Oiling: Maintain oil in wells to the overflow. Starting: Single phase
motors are started by first throwing the starting switch down into the starting position, and when the
motor is up to speed, throwing it up into the running position. Do not hold the switch in starting
position over 10 seconds. Starter for single phase motors above ½ H.P. are arranged with an adjusting
link at the bottom of the panel. The link is shown in the position of least starting torque and current.
Connect from W to 2 or W to 3 for starting heavier loads. Two or three phase motors are started simply
by closing the switch. These motors start full load without starters. The motor should start promptly on
closing the switch. It should be started the first time without being coupled to the line shaft. If the
motor start free, but will not start loaded, it shows either that the load upon the motor is too great, the
line voltage too low, or the frequency too high. The voltage and frequency with the motor running
should be within 5% of the name plate rating and the voltage with 10 to 15% while starting. If the
motor do not start free, either it is getting no current or something is wrong with the motor. In either
case an electrician should be consulted. Solution: To reverse the direction of rotation interchange the
leads marked "XX" in the diagrams. Temperature: At full load the motor should not heat over 75
degrees Fahr. above the temperature of the surrounding air; if run in a small enclosed space with no
ventilation, the temperature will be somewhat higher.
Fig. 2,810.—Tandem drive for economizing floor space with belt transmission. Belts of different lengths
are used, as shown, each of which passes over the driving wheel d of the engine, and then over the
pulley wheel of one of the generators. In such an arrangement the belts would be run lengthwise
through the room in which the machines are placed, and it is obvious that since the width of the room
would be governed by the width of the machines thus installed, this method is a very efficient one for
accomplishing the end in view.
Fig. 2,811.—Double pulley drive for economizing floor space with belt transmission. Where a center
crank engine is used both pulleys may be employed by belting a machine to each as shown. Although
considerable floor space would be saved by the use of this scheme if the generators thus belted were
placed at M and G yet still more floor space would be saved by having them occupy the positions
indicated at M and S.
Fig. 2,812.—Separately excited belt driven alternator showing approved location of exciter. In an
electrical station where alternating current is generated, the alternators for producing the current
generally require separate excitation for their field windings; that is, it is usually necessary to install in
conjunction with an alternator a small dynamo for supplying current to the alternator field. The exciter
is a comparatively small machine; in fact, it requires only about 1 per cent. of the capacity of the
alternator which it excites, and so being small is often belted to an auxiliary pulley mounted on the
alternator shaft. Considerable floor space would be occupied by an installation of this nature if the
exciter be placed at M, and belted to the alternator as indicated by the dotted lines. By locating the
exciter at S, between the alternator and the engine, much floor space will be saved and the general
appearance of the installation improved.
If the belt be well selected and properly handled, it should do service for
twenty years, and even then if the worn part be cut off, the remaining portion
may be remade and used again as a narrower and shorter belt.
Besides leather belts, there are those made of rubber which withstand moisture
much better than leather belts, and which also possess an excellent grip on the
pulley; they are, however, more costly and much less durable under normal
conditions.
In addition to leather and rubber belts, there are belts composed of cotton, of a
combination of cotton and leather, and of rope. The leather belt, however, is the
standard and is to be recommended.
Equally important with the quality of a belt is its size in order to transmit the
necessary power.
The average strain under which leather will break has been found by many
experiments to be 3,200 pounds per square inch of cross section. A good quality of
leather will sustain a somewhat greater strain. In use on the pulleys, belts should
not be subjected to a greater strain than one eleventh their tensile strength, or
about 290 pounds to the square inch or cross section. This will be about 55 pounds
average strain for every inch in width of single belt three-sixteenths inch thick. The
strain allowed for all widths of belting—single, light double, and heavy double—is in
direct proportion to the thickness of the belt.
Fig. 2,813.—One horse power transmitted by belt to illustrate the rule given above. A pulley is driven by
a belt by means of the friction between the surfaces in contact. Let T be the tension on the driving side
of the belt, and T', the tension on the loose side; then the driving force = T-T'. In the figure T is taken
at 34 lbs. and T' at 1 lb.; hence driving force = 34-1 = 33 lbs. Since the belt is travelling at a velocity of
1,000 feet per minute the power transmitted = 33 lbs. × 1,000 ft. = 33,000 ft. lbs. per minute = 1
horse power.
( 1 × 3,000 / 1,000 ) × 2 = 6,
hence the width of belt required to transmit 50 horse power is
50 ÷ 6 = 8.33, say 8 inches.
Ques. At what velocity should a belt be run?
Ans. At from 3,000 to 5,000 feet per minute.
Ques. How may the greatest amount of power transmitting capacity
be obtained from belts?
Ans. By covering the pulleys with leather.
Ques. How should belts be run?
Ans. With the tight side underneath as in fig. 2,814.
Figs. 2,814 and 2,815.—Right and wrong way to run a belt. The tight side should be underneath so as
to increase the arc of contact and consequently the adhesion, that is to say, a better grip, is in this way
obtained.
Ques. Under what conditions does a belt drive give the best results?
Ans. When the two pulleys are at the same level.
If the belt must occupy an inclined position it should not form a greater angle
than 45 degrees with the horizontal.