Test Bank For Data Structures and Abstractions With Java 4th Edition by Carrano Henry ISBN 0133744051 9780133744057
Test Bank For Data Structures and Abstractions With Java 4th Edition by Carrano Henry ISBN 0133744051 9780133744057
com
http://testbankpack.com/download/test-bank-for-data-
structures-and-abstractions-with-java-4th-edition-by-
carrano-henry-isbn-0133744051-9780133744057/
OR CLICK HERE
DOWLOAD NOW
Visit now to discover comprehensive test banks for all subjects at testbankpack.com
Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.
http://testbankpack.com/download/test-bank-for-sports-in-society-12th-
edition-coakley-0073523542-9780073523545/
testbankpack.com
Solution Manual for Commercial Drafting and Detailing 4th
Edition by Jefferis and Smith ISBN 9781285097398
http://testbankpack.com/download/solution-manual-for-commercial-
drafting-and-detailing-4th-edition-by-jefferis-and-smith-
isbn-9781285097398/
testbankpack.com
http://testbankpack.com/download/test-bank-for-mis-essentials-4th-
edition-kroenke-9780133546590/
testbankpack.com
http://testbankpack.com/download/test-bank-for-mathematics-with-early-
integers-3rd-edition-by-bittinger-and-penna-
isbn-0321922344-9780321922342/
testbankpack.com
http://testbankpack.com/download/test-bank-for-leadership-
experience-6th-edition-daft-1435462858-9781435462854/
testbankpack.com
Test Bank for Data Structures and Abstractions with Java 4th Edition by
Carrano Henry ISBN 0133744051 9780133744057
Full link download:
Test Bank:
https://testbankpack.com/p/test-bank-for-data-structures-and-abstractions-with-
java-4th-edition-by-carrano-henry-isbn-0133744051-9780133744057/
Solution Manual:
https://testbankpack.com/p/solution-manual-for-data-structures-and-abstractions-
with-java-4th-edition-by-carrano-henry-isbn-0133744051-9780133744057/
True/False (10)
1. Any methods that a core method might call are part of the core group.
Answer: true
2. You should implement all methods of an ADT implementation before testing to make testing
easier.
4. When defining the bag class, you should implement the isArrayFull and remove operations first.
Answer: false
5. When defining the bag class write methods that have simple implementation first to get them
out of the way.
Answer: true
9. When testing a method, you only need to check for arguments that lie within the legal range of
their corresponding parameter.
10. When comparing objects in a bag, we assume that the class to which the objects belong
defines its own version of equals.
Answer: true
Short Answer (7)
1. It is a good practice to identify a group of core methods to implement and test before
continuing with the rest of the class definition. What type of methods should you begin with?
Answer: You should begin with methods that add to the collection or methods that have complex
implementations.
2. Why is it better to implement the add operation in a collection before implementing the
remove operation?
Answer: You cannot test remove functionality until you have written and tested add functionality.
3. What is the difference between the numberOfEntries data field in the ArrayBag implementation
and the DEFAULT_CAPACITY field?
Answer: If the client does not specify the size of the bag, the numberOfEntries field will be set to the
DEFAULT_CAPACITY value in the constructor. Otherwise, the numberOfEntries field will be set to the
size specified by the client.
4. Why is it a safer practice for the toArray method to return a copy of the array instead of
a reference to the array?
Answer: A client would then have direct access to the private data and could either inadvertently or
maliciously alter the data without using the public methods of the class.
7. Why doesn’t the contains method return the index of a located entry?
Answer: Returning the index implies an explicit position in the array. A client should be shielded
from this level of detail.
Multiple Choice (30) WARNING: CORRECT ANSWERS ARE IN THE SAME POSITION AND TAGGED
WITH **. YOU SHOULD RANDOMIZE THE LOCATION OF THE CORRECT ANSWERS IN YOUR EXAM.
3. Which one of the following Java statements allocates an array in the bag constructor causing a
compiler warning for an unchecked operation? Assume capacity is an integer.
a. bag = (T[ ]) new Object[capacity]; **
b. bag = new T[capacity];
c. bag = new Object[capacity];
d. bag = new (T[ ]) Object[capacity];
5. What are the consequences of returning a reference to the bag array in the toArray method?
a. the return variable is an alias for the private instance array variable
b. the client will have direct access to the private instance array variable
c. the client could change the contents of the private instance array variable without
using the public access methods
d. all of the above **
6. Which one of the following is considered a safe and secure programming practice?
a. validating input data and arguments to a method **
b. identifying a group of core methods to implement first
c. using generic data types
d. none of the above
7. Which one of the following is considered a safe and secure programming practice?
a. making no assumptions about the actions of clients and users **
b. using @SupressWarning (“unchecked”)
c. adding the comments and headers of the public methods to the class by copying
them from the interface
d. all of the above
8. When implementing the bag ADT, which scenario could result in a security problem?
a. a constructor throw an exception or error before completing its initialization **
b. the programmer validates input data to a method
c. generics are used to restrict data types of the entries in the collection
d. a group of core methods is not defined
9. When implementing the bag ADT, which scenario could result in a security problem?
a. a client attempts to create a bag whose capacity exceeds a given limit **
b. a SecurityException is thrown in the constructor
c. an IllegalStateException is thrown in the constructor
d. the delete method is implemented before the add method
13. A test driver for the bad add method should check for which one of the following
a. an over capacity condition **
b. printing elements of the bag
c. adding elements of the correct type
d. an empty bag condition
14. The method remove that has no parameter in the bag implementation
a. removes the last entry in the array **
b. removes the first entry in the array
c. removes a random entry in the array
d. none of the above
17. In the remove method, setting the last entry of the array to null
a. flags the removed object for garbage collection
b. prevents malicious code from accessing it
c. is a good security practice
d. all of the above **
18. The remove method replaces the removed entry with null because
a. the entry could potentially be scheduled for garbage collection **
b. the client expects a null return value
c. it is a fail-safe programming practice
d. otherwise it could be considered a duplicate value
19. When calling the remove method with an argument if there are multiple entries
a. exactly which occurrence removed is unspecified
b. only one occurrence is removed
c. the first occurrence is removed
d. all of the above **
20. The most efficient approach to dealing with a gap left in an array after removing an entry from a
bag is to
a. replace the entry being removed with the last entry in the array and replace the
last entry with null **
b. replace the entry being removed with the first entry in the array and replace the first
entry with null
c. shift subsequent entries and replace the duplicate reference to the last entry with null
d. replace the entry being removed with null
21. If an array bag contains the entries “lions”, “elephants”, “otters”, “bears”, “tigers”, “lemurs” and
a call to the remove method with the entry “bears” is made, what does the array look like after
remove?
a. ““lions”, “elephants”, “otters”, “lemurs”, “tigers”, null **
b. “lions”, “elephants”, “otters”, null, “tigers”, “lemurs”
c. “lions”, “elephants”, “otters”, “tigers”, “lemurs”, null
d. “lions”, “elephants”, “otters”, “tigers”, “lemurs”
25. When the need to expand the size of a bag occurs, the common practice is to
a. double the size of the array **
b. increase the size of the array by one to accommodate the new entry
c. use the Fibonacci sequence to determine the incremental size of the new array
d. prompt the user for how much larger the bag will need to be
27. When resizing an array to increase the bag size, if the copy exceeds the maximum memory
specified for the computer, the checkCapacity method should
a. throw an IllegalStateException **
Visit https://testbankpack.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
b. throw a MaxSizeExceededException
c. throw a MaxMemoryExceededException
d. return false
28. In a ResizableArrayBag class, why does the add method always return true?
a. to conform to the bag interface **
b. because the array will always double in size
c. returning void is not a fail-safe programming practice
d. all of the above
29. Which of the following is an advantage of using an array to implement the ADT bag?
a. adding an entry to a bag is fast **
b. removing a particular entry requires time to locate the entry
c. increasing the size of the array requires time to copy its entries
d. the client has control over the size of the bag
30. Which of the following is a disadvantage of using an array to implement the ADT bag?
a. increasing the size of the array requires time to copy its entries **
b. adding an entry to a bag is fast
c. removing an unspecified entry from the array is fast
d. all of the above
Another Random Document on
Scribd Without Any Related Topics
seem idle; but when a portion of the leaf has been folded backward,
out of sight, the folded part may very likely escape notice, and, to
insert it, many pages of matter may afterward require to be overrun:
we have known such cases.
Abbreviate those words only, which you wish the printer to
abbreviate.
Never erase with a lead pencil; for an erasure with lead leaves it
questionable whether or not the marked {p29} word is to go in. Use
ink, drawing the pen horizontally through the words or lines to be
omitted; and be careful that the marking leave off on exactly the
right word. If you afterward regret the cancellation, you may write
“stet” in the margin, and place dots under the canceled words; but
as “stet” may not be noticed, in the presence of obvious erasures,
the better way will be to re-write the passage, and paste it in the
place you wish it to occupy.
Take time to write plainly and legibly. In writing for the press, the
old adage holds good,—“The more haste, the worse speed”; and for
every hour you save by writing hurriedly, you will be called upon to
pay for several hours’ labor in making corrections. Write joinhand:
mistakes often arise from a long word being broken up, as it were,
into two or three words.
I and J are often mistaken for each other. Either imitate the
printed letters, or uniformly carry the loop of the J below the line.
It is often impossible to distinguish Jan. from June, in
manuscript, unless the context furnishes a clew.
Whatever may be the divisions of your work (as books, chapters,
sections, cantos, and the like), let your entire manuscript be paged
in the order of the natural series of numbers from 1 upward. If you
commence each division with 1,—as is sometimes done,—and two or
three divisions are given out as “takes” to compositors, it is obvious
that portions of one division may exchange places with those of
another; and, further, if leaves happen to become transposed, they
can readily be restored to their right {p30} places if no duplicate
numbers have been used in indicating the pages.
Make sure that the books, chapters, etc., are numbered
consecutively. The best proof-reader must confess to some
unguarded moments; and it would be very awkward, after having
had two hundred and forty chapters stereotyped, to find that two
chapter V.’s have been cast, that every subsequent chapter is
numbered one less than it should have been, and that compositor
and proof-reader have exactly followed copy.
Examine your manuscript carefully with reference to the points.
Avoid the dash when any other point will answer your purpose. A
manuscript that is over-punctuated occasions more perplexity than
one that is scarcely pointed at all.
Before sending it to press, get your manuscript into a shape you
can abide by. Alterations made on the proof-sheet must be paid for;
and, further, matter that has undergone alterations seldom makes a
handsome page: some lines will appear crowded, others too widely
spaced.
In writing a footnote¹ let it immediately follow
¹ In many works the footnotes, by a slight change of arrangement, might
advantageously become a portion of the text.
the line of text which contains the asterisk, or other reference-mark;
just as you see in the above example, and do not write it at the
bottom of the manuscript page. The person who makes up the
matter will transfer such note to its proper place.
If you feel obliged to strike out a word from the {p31} proof,
endeavor to insert another, in the same sentence, and in the same
line if possible, to fill the space. So, if you insert a word or words,
see whether you can strike out, nearly at the same place, as much
as you insert.
When writing for the press, never use a lead pencil. Let your
copy be made with black ink on good white paper. We have been
pained to see the checkered pages of a report to an extensive
religious association, which report had been in the first place wholly
written with a lead pencil: then words canceled, words interlined,
various changes made,—and all these alterations done with pen and
ink. Of course, sleeve and hand rubbing over the plumbago gave the
whole a dingy and blurred appearance. The effect of the ink
sprinkled among the faded pencilings was so much like that of
mending an old garment with new cloth, that the manuscript had an
unchristian, nay, even heathenish aspect. However, from this copy
the report was printed,—let us charitably hope that it did much good
in the world.
If proof-sheets present peculiarities of spelling and language,
such for instance as appear in ancient works, and which are affected
or indulged in by some moderns, every word whose correctness he
doubts and is unable to verify, should be referred by the proof-
reader to author or editor. The latter, familiar with the terms used,
may consider some queries frivolous or puerile; but an author should
appreciate conscientiousness in the reader, and be glad to have {p32}
all doubts settled before his work reaches the eyes of reviewers.
That Dr. Johnson was guilty of harshness toward a proof-reader
is not to be wondered at; but it is a matter of wonder that his
conduct appears to have been approved by other editors. In J. T.
Buckingham’s edition of Shakspeare (1814) is, at page 915, a
remarkable note, apologizing for a few “trifling errors,” and adopting
as an excuse a quotation from an advertisement “from the first
edition of Reed, 1793”:
He, whose business it is to offer this unusual apology, very well remembers to
have been sitting with Dr. Johnson, when an agent from a neighboring press
brought in a proof sheet of a republication, requesting to know whether a
particular word in it was not corrupted. “So far from it, sir,” (replied the Doctor
with some harshness,) “that the word you suspect, and would displace, is
conspicuously beautiful where it stands, and is the only one that could do the
duty expected from it by Mr. Pope.”
Dr. Johnson’s assumption that the agent would displace the word,
seems to have been wholly gratuitous. The employees of the
neighboring press did precisely what they should have done,—what
every conscientious proof-reader often feels obliged to do. If
suspected words were passed without questioning, there would be
many errors of the press which would justify some show of
“harshness” toward the neglectful “agent.”
CHAPTER II.
PROOF-READING.
Engineer work:
Make footnotes of the “Remarks” column.
For “D. D.” in copy, spell “dry-dock.”
Use figures in all cases, for weights, distances, etc.
Weather Reports:
The “upper Missouri valley” [small v].
The “Mississippi river” [small r].
Geological Survey:
The “Missouri Valley” [cap. V].
The “Missouri River” [cap. R].
The above is very bad, even for a first proof,—but we have seen
worse, and have, perhaps, ourself been responsible for some not
much better. While the copy-holder is reading aloud the copy from
which {p45} the above was set up, the reader is busy marking errors,
and making such characters in the margin as will inform the
compositors what is to be done to make their work correct. At the
conclusion of the reading, the proof will present an appearance
somewhat like this corrected—
SPECIMEN OF FIRST PROOF.
If the work extend beyond a single galley, the slips of proof are
marked in regular sequence, A, B, C, etc., or 1, 2, 3, etc. Each slip is
marked at top “First Proof”: the names of the compositors, which
have been inscribed on their “takes,” are duly transferred to the
printed proof, which, with the errors plainly noted thereon, is then
given for correction to the same persons who set up the matter.
Their duty having been attended to, a “second proof” is taken: {p47}
this the reader compares carefully with the first, to ascertain
whether the requisite changes of type have been properly made;
whether “doublets” have been taken out, and “outs” put in. If any
mark has escaped the notice of the compositors, it is transferred to
the second proof. Close attention should be given to this process of
“revising”; it is not enough to see that a wrong letter has been taken
out, and a right one put in; in the line where a change has been
made, all the words should be compared, and also the line above
and the line below a correction,—since in correcting an error among
movable types, some of the types may move when they ought not,
and get misplaced.
As what escapes the notice of one observer may be perceived by
another, this second proof is again “read by copy” by another proof-
reader and assistant, and a second time corrected and revised. The
“third proof” is now sent to the author, editor, or publisher, with so
much copy as may cover it, the copy-holder being careful, however,
to retain the “mark-off”; i. e., the sheet on which is marked off the
place where the next “first proof” is to begin. But when the work is
of such sort as not to require extraordinary care, the second proof is
sent out, a single reading by copy being deemed sufficient. If the
work is read twice by copy, only one reader should attend to the
punctuation.
If, now, the copy have been hastily or carelessly prepared, or if
the author have gained new light since he prepared it, the outside
party having charge {p48} of the work (whom, for convenience, we
will designate as the “author”) will return his proofs, full of erasures,
additions, alterations, interlineations, and transpositions. With these
the original compositors have no concern; the changes required are
made by “the office,” and the time is charged to the person who
contracted for the printing of the work.
A second, third, or even more consecutive revises of the same
slip are sometimes sent to the author, to the intent that he may see
for himself that his corrections have been duly made, and to allow
him further opportunity to introduce such alterations as to him may
seem desirable. Usually, however, the work, after the correction of
the author’s first proof, is made up into pages; and when there are
enough of these for a “signature” or form of octavo, duodecimo, or
whatever the number of pages on the sheet may be, the proof-
reader revises these pages by the author’s latest returned proof, cuts
off the slip at the line where the last page ends, and sends the
folded leaves, labeled “Second,” “Third,” or “Fourth” proof, as the
case may be, together with the corresponding slips of the next
previous proof, to the author, as before. The portion of slip proof
remaining—termed the “make-up”—should be inscribed with the
proper page, and the letter or figure which is to be the signature of
the next sheet, and given, for his guidance, to the person who
makes up the work; to be returned again to the proof-reader, with
the other slip proofs of the next sheet of made-up pages, when that
is ready for revision. {p49}
The author may be desirous of seeing a fifth, sixth, or, as the
algebraists say, any number, n, of proofs. When he expresses himself
as satisfied with his share of the correcting, the last author’s proof is
corrected, a “revise” taken, and the proof-reader gives this last
revise a final reading for the press. As any errors which escape
detection now, will show themselves in the book, this last reading
should be careful, deliberate, and painstaking. See to it, my young
beginner, that the “signature” is the letter or number next in
sequence to that on your previous press-proof. See to it, that the
first page of the sheet in hand connects in reading with the last page
of the previous one, and that the figures denoting the page form the
next cardinal number to that which you last sent to press. Having
done this, examine the “folios” (the “pagination,” as some say)
throughout; read the running titles; if there be a new chapter
commenced, look back in your previous proofs to make sure that
said new chapter is “XIX. ,” and not “XVIII. ”; see that the head-lines of
the chapter are of the right size, and in the right font of type; for, if
the “minion” case happened to be covered up, the compositor may
have forgotten himself, and set them up in “brevier”; if there is rule-
work, see that the rules come together properly, and are right side
up; if there is Federal money, see that the “$” is put at the beginning
of the number following a rule,[5] and of the number in the top line
of every page; if points are {p50} used as “leaders,” see that there are
no commas or hyphens among them. If the style require a comma
before leaders, see that none have been left out; if the style reject a
comma, see that none have been left in; in short, see to everything,
—and then, on the corner of the sheet, write the word “Press” as
boldly as you can, but with the moral certainty that some skulking
blunder of author, compositor, or corrector has eluded all your
watchfulness.
5 In the Government Printing Office the style omits the “$” in this case,—the
sign at top of table or page being considered sufficient.
Ε is read, “cap. short e”; ε, “short e”; Η is read, “cap. long e”; η,
“long e.”
Ο is read, “cap. short o”; ο, “short o”; Ω is read, “cap. long o”; ω,
“long o.” {p55}
There are three accents,—the acute ( ΄ ), the grave ( ), and the
circumflex ( ).
ύ is read, “acute u”; ὶ is read, “grave i”; ᾶ is read, “circumflex a.”
Over every vowel or diphthong beginning a word is placed one of
two characters, called breathings, which, for the purpose of reading,
we may designate as the smooth ( ᾿ ) and the rough ( ῾ ).
ἀ is read, “smooth a”; ἱ is read, “rough i.”
In Greek, only four points or stops are used: the comma (,); the
note of interrogation (;); the colon, or point at top (·); and the full
stop (.). These should be mentioned as they occur. {p56}
WORDS TO GO IN ITALICS.
ante ad captandum ad libitum ad quod damnum aliunde
alma mater amende honorable amicus curiæ artiste avant
coureur beau monde coram non judice corpus delicti coup
d’état coup de grâce coup de main de bonis non de facto de
jure del credere de novo dilettante dilettanti dramatis
personæ {p58} duces tecum en route entrée et al. ex officio
ex parte ex post facto ex rel. falsi crimen feme covert feme
sole femme couverte femme sole fleur de lis functus officio
garçon ignes fatui ignis fatuus in extenso infra in statu quo
inter alia in toto in transitu juste milieu malum in se malum
prohibitum matériel nem. con. n’importe non constat non
obstante nous verrons passim peculium personnel postea
postliminium post mortem prima facie procès-verbal pro
forma projet pro tempore rationale res adjudicata sans-
culotte sine die soi disant sotto voce sub judice supra
tabula rasa terra incognita tout ensemble ultima ratio ultima
Thule vide vice versa viva voce vraisemblance
WORDS TO GO IN ROMAN.
addenda addendum ad interim ad valorem alias alibi
alumnus alumnæ alumni animus assumpsit bagatelle
belles-lettres bijou billet-doux bivouac bizarre bona fide
canaille canard capias chargé d’ affaires coterie crevasse
data datum débris dedimus détour devoir diluvion
diluvium éclat emeute ennui entrepot exequatur exuviæ
fasces faubourg feuilleton fiacre fieri facias habeas corpus
hacienda hauteur in banc in situ literati literatim Magna
Charta mandamus menu mittimus nisi prius nolle prosequi
oyer and terminer papier-mache per capita per diem posse
comitatus pro rata protégé quasi régime résumé rôle
savant seriatim sobriquet status supersedeas via venire
venire facias verbatim
CHAPTER III.
STYLE.