Starting Out with Java Early Objects 6th Edition Gaddis Test Bank - Download PDF
Starting Out with Java Early Objects 6th Edition Gaddis Test Bank - Download PDF
com
https://testbankfan.com/product/starting-out-with-java-
early-objects-6th-edition-gaddis-test-bank/
OR CLICK BUTTON
DOWLOAD NOW
https://testbankfan.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-solutions-manual/
testbankfan.com
https://testbankfan.com/product/starting-out-with-c-early-objects-9th-
edition-gaddis-test-bank/
testbankfan.com
https://testbankfan.com/product/starting-out-with-c-early-objects-7th-
edition-gaddis-solutions-manual/
testbankfan.com
https://testbankfan.com/product/international-financial-
management-7th-edition-eun-solutions-manual/
testbankfan.com
Organizational Behavior A Critical Thinking Approach 1st
Edition Neck Solutions Manual
https://testbankfan.com/product/organizational-behavior-a-critical-
thinking-approach-1st-edition-neck-solutions-manual/
testbankfan.com
https://testbankfan.com/product/quantitative-analysis-for-
management-13th-edition-render-test-bank/
testbankfan.com
https://testbankfan.com/product/physical-chemistry-2nd-edition-ball-
solutions-manual/
testbankfan.com
https://testbankfan.com/product/business-math-using-excel-2nd-edition-
burton-solutions-manual/
testbankfan.com
https://testbankfan.com/product/assessing-learners-with-special-needs-
an-applied-approach-7th-edition-overton-test-bank/
testbankfan.com
Microsoft Visual Basic 2017 for Windows Web and Database
Applications Comprehensive 1st Edition Hoisington
Solutions Manual
https://testbankfan.com/product/microsoft-visual-basic-2017-for-
windows-web-and-database-applications-comprehensive-1st-edition-
hoisington-solutions-manual/
testbankfan.com
Starting Out with Java Early Objects 6e (Gaddis)
Chapter 7 Arrays and the ArrayList Class
TRUE/FALSE
1. An ArrayList object automatically expands in size to accommodate the items stored in it.
ANS: T
2. Java does not limit the number of dimensions an array may have.
ANS: T
3. The String[] args parameter in the main method header allows the program to receive
arguments from the operating system command-line.
ANS: T
4. When an array of objects is declared but not initialized, the array values are set to 0.
ANS: F
5. To determine if two arrays are equal you must compare each of the elements of the two arrays.
ANS: T
6. A sorting algorithm is a technique for scanning through an array and rearranging its contents in some
specific order.
ANS: T
7. Objects in an array are accessed with subscripts, just like any other data type in an array.
ANS: T
8. Any items typed on the command-line, separated by space, after the name of the class, are considered
to be one or more arguments that are to be passed into the main method.
ANS: T
ANS: F
10. The Java compiler will display an error message when it processes a statement that uses an invalid
subscript.
ANS: F
MULTIPLE CHOICE
1. A search algorithm
a. arranges elements in ascending order
b. arranges elements in descending order
c. is used to locate a specific item in a collection of data
d. is rarely used with arrays
ANS: C
2. A ragged array is
a. a two-dimensional array where the rows have different numbers of columns
b. a one-dimensional array for which the number of elements is unknown
c. a two-dimensional array for which the number of rows is unknown
d. a partially initialized two-dimensional array of ranged values
ANS: A
5. Java provides a mechanism known as a __________ which makes it possible to write a method that
takes a variable number of arguments.
a. variable-length argument list
b. dynamic parameter list
c. unary-signature template
d. polymorphic byte code
ANS: A
11. You can use the __________ method to replace an item at a specific location in an ArrayList.
a. set
b. remove
c. replace
d. add
ANS: A
12. Which of the following is a correct method header for receiving a two-dimensional array as an
argument?
a. public static void passMyArray(int[]myArray1, int[]myArray2)
b. public static void passMyArray(int[][] myArray)
c. public static void passMyArray[][](int myArray)
d. public static void passMyArray(array myArray)
ANS: B
13. Which of the following import statements is required in order to use the ArrayList class?
a. import java.util.Tools;
b. import java.util.ArrayList;
c. import java.util.Containers;
d. import java.util.API;
ANS: B
14. Which method is used to determine the number of items stored in an ArrayList object?
a. items
b. listLength
c. size
d. volume
ANS: C
15. The __________ method removes an item from an ArrayList at a specific index.
a. remove
b. pop
c. deleteAt
d. clear
ANS: A
16. Which of the following methods returns a string representing all of the items stored in an ArrayList
object?
a. show
b. toString
c. print
d. getList
ANS: B
17. Which of the following ArrayList class methods is used to insert an item at a specific location in an
ArrayList?
a. set
b. store
c. add
d. insert
ANS: C
18. To return an array of long values from a method, which return type should be used for the method?
a. long[ARRAY_SIZE]
b. array
c. long[]
d. long
ANS: C
19. Which of the following is a valid declaration for a ragged array with five rows but no columns?
a. int[][] ragged = new int[5];
b. int[][] ragged = new int[][5];
c. int[][] ragged = new int[5][];
d. int[] ragged = new int[5];
ANS: C
20. If numbers is a two-dimensional array, which of the following would give the number of columns in
row r?
a. numbers.length
b. numbers.length[r]
c. numbers[r].length
d. numbers[r].length[r]
ANS: C
22. Given the following two-dimensional array declaration, which statement is true?
int[][] numbers = new int[6][9];
a. The numbers array has 54 rows.
b. The numbers array has 15 rows.
c. The numbers array has 6 rows and 9 columns.
d. The numbers array has 6 columns and 9 rows.
ANS: C
23. What will be the result after the following code is executed?
final int ARRAY_SIZE = 5;
float[] x = float[ARRAY_SIZE];
for (i = 1; i <= ARRAY_SIZE; i++)
{
x[i] = 10.0;
}
a. A runtime error will occur.
b. All the values in the array will be initialized to 10.0.
c. All the values in the array except the first will be set to 10.0.
d. The code contains a syntax error and will not compile.
ANS: D
24. For the following code, what would be the value of str[2]?
String[] str = {"abc", "def", "ghi", "jkl"};
a. a reference to the String object containing "ghi"
b. "ghi"
c. a reference to the String object containing "def"
d. "def"
ANS: A
25. What would be the result after the following code is executed?
int[] numbers = {40, 3, 5, 7, 8, 12, 10};
int value = numbers[0];
for (int i = 1; i < numbers.length; i++)
{
if (numbers[i] < value)
value = numbers[i];
}
a. The value variable will contain the average of all the values in the numbers array.
b. The value variable will contain the sum of all the values in the numbers array.
c. The value variable will contain the lowest value in the numbers array.
d. The value variable will contain the highest value in the numbers array.
ANS: C
26. What would be the result after the following code is executed?
int[] numbers = {50, 10, 15, 20, 25, 100, 30};
int value = 0;
for (int i = 1; i < numbers.length; i++)
value += numbers[i];
a. The value variable will contain the average of all the values in the numbers array.
b. The value variable will contain the sum of all the values in the numbers array.
c. The value variable will contain the lowest value in the numbers array.
d. The value variable will contain the highest value in the numbers array.
ANS: B
29. Which of the following statements is(are) true about this code?
final int ARRAY_SIZE = 10;
long[] array1 = new long[ARRAY_SIZE];
a. It declares array1 to be a reference to an array of long values.
b. It will allow valid subscripts in the range of 0 through 9.
c. It creates an instance of an array of ten long values.
d. All of these are true.
ANS: D
Plato will always be an object of admiration and reverence to men who would
rather see vast images of uncertain objects reflected from illuminated clouds, than
representations of things in their just proportions, measurable, tangible, and
convertible to household use.—Walter Savage Landor in Imaginary Conversations,
Vol. 2.
Cultivation will breed in any man a certainty of the uncertainty of his most assured
convictions.—Samuel Butler in Life and Habit.
Now can you suppose that is Wells’s own reasoning that he puts into
the mouth of his unfortunate hero? Talk about Edith Wharton being
thin-lipped in the pursuit of her heroines—that’s a great deal better
than being loose-lipped; don’t you agree with me? It may be true,
and I rather think to some extent it is true, that a man cannot have
an absorbing friendship with a woman and not run the risk of falling
in love. But what does that prove? That he should be allowed free
rein and carry on as many liaisons veiled under the name of
friendship as he chooses? Or unveiled, rather, for Wells seems to
want everything in the open. He’s like a child who says: Here’s a
very dangerous beast in a flimsy, inadequate cage. Frequently he
escapes from it and has to be put back in. Let’s abolish the cage and
let the beast run about openly, doing what it wants. And the good
old-fashioned word for that beast is lust, and it should be caged; if
the cage is getting more and more inadequate it’s only a piece with
what Agnes Repplier calls our loss of nerve. How I liked that article
of hers! What in the name of sense are we in this world for if not to
build up a character? That’s all that amounts to anything, and it
comes from countless denials and countless responses to duty. And
what Goethe said, some time ago, is still everlastingly true:
“Entbehren sollst Du, sollst entbehren!” (Deny yourself, deny, deny.)
He ought to know, too, because he tried indulgence, goodness
knows, and knew the dregs at the bottom of that cup. And I can’t
forgive Wells. He knows better than to let people make all manner of
experiment with such things. They wouldn’t even be happy; for
happiness is built of stability, loyalty, character, and again character.
My husband said, after reading that passage in The Passionate
Friends, “The trouble with him and the class he writes of is that they
aren’t busy enough. Let ’em work for a living, be interested in
something vitally for ten hours out of the twenty-four, and they’ll
forget all about their neighbors’ wives and be content with good
men friends and casual women friends.”
The trouble lies with poor old human nature, I guess, and the way
it wants what it cannot and ought not to have. But Wells says all
unreality is hateful to him. Let’s tear down the barriers, let’s show up
for what we are. Poor Smith wants something his neighbor has—
well, let’s give it to him, whether it’s his neighbor’s success or his
wife or his happiness. Nature is still unbearably ugly in lots of ways.
When we can train it to be unselfish and disinterested then it will be
time to tear down barriers.
Lady Mary in The Passionate Friends is an unconvincing character,
too. I can conceive of a woman who will take all of a man’s
possessions, giving him nothing in return, not even fidelity, but I
cannot conceive of her justifying herself unless she is an utter moral
degenerate. The danger of such writers as Wells is that they are
plausible enough till you look below the surface. He tries to
represent Lady Mary as charming, but she, it seems to me, even
more than modern society which he arraigns, is “honeycombed and
rotten with evil.”
“M. M.”
You road I enter upon and look around! I believe that you are not all that is here;
I believe that much unseen is also here.
Beside this, doesn’t the Menelaus and Helen seem like an orchid?—a
very beautiful, rich orchid, to be sure, but not of the Whitman family.
George Soule.
More About the “New Note”
The idea of “the new note” might be worked out more fully, but after
all little or nothing would be gained by elaboration. Given this note
of craft love all the rest must follow, as the spirit of self-revelation,
which is also a part of the new note, will follow any true present-day
love of craft. You will remember we once discussed Coningsby
Dawson’s The Garden Without Walls. What I quarreled with in that
book was that the writer looked outside of himself for his material.
Even realists have done this—as, for example, Howells; and to that
extent have failed. The master Zola failed here. Why do we so prize
the work of Whitman, Tolstoy, Dostoevsky, Twain, and Fielding? Is it
not because as we read we are constantly saying to ourselves, “This
book is true. A man of flesh and blood like myself has lived the
substance of it. In the love of his craft he has done the most difficult
of all things: revealed the workings of his own soul and mind”?
To get near to the social advance for which all moderns hunger, is
it not necessary to have first of all understanding? How can I love
my neighbor if I do not understand him? And it is just in the wider
diffusion of this understanding that the work of a great writer helps
the advance of mankind. I would like to have you think much of this
in your attitude toward all present-day writers. It is so easy for them
to bluff us from our position, and I know from my own experience
how baffling it is constantly to be coming upon good, well-done
work that is false.
In this connection I am tempted to give you the substance of a
formula I have just worked out. It lies here before me, and if you
will accept it in the comradely spirit in which it is offered I shall be
glad. It is the most delicate and the most unbelievably difficult task
to catch, understand, and record your own mood. The thing must be
done simply and without pretense or windiness, for the moment
these creep in your record is no longer a record, but a mere mass of
words meaning nothing. The value of such a record is not in the
facts caught and recorded but in the fact of your having been able
truthfully to make the record—something within yourself will tell you
when you have not done it truthfully. I myself believe that when a
man can thus stand aside from himself, recording simply and
truthfully the inner workings of his own mind, he will be prepared to
record truthfully the workings of other minds. In every man or
woman dwell dozens of men and women, and the highly imaginative
individual will lead fifty lives. Surely this can be said if it can be said
that the unimaginative individual has led one life.
The practice of constantly and persistently making such a record
as this will prove invaluable to the person who wishes to become a
true critic of writing in the new spirit. Whenever he finds himself
baffled in drawing a character or in judging one drawn by another,
let him turn thus in upon himself, trusting with child-like simplicity
and honesty the truth that lives in his own mind. Indeed, one of the
great rewards of living with small children is to watch their faith in
themselves and to try to emulate them in this art.
If the practice spoken of above is followed diligently, a kind of
partnership will in time spring up between the hand and the brain of
the writer. He will find himself becoming in truth a cattle herder, a
drug clerk, a murderer, for the benefit of the hand that is writing of
these, or the brain that is judging the work of another who has
written of these.
To be sure this result will not always follow, and even after long
and patient following of the system one will run into barren periods
when the brain and the hand do not co-ordinate. In such a period it
seems to me the part of wisdom to drop your work and begin again
patiently making a record of the workings of your own mind, trying
to put down truthfully those workings during the period of failure. I
would like to scold every one who writes, or who has to do with
writing, into adopting this practice, which has been such a help and
such a delight to me.
Sherwood Anderson.
To E
Sara Teasdale
testbankfan.com