Professional Documents
Culture Documents
Full Starting Out With Java Early Objects 6Th Edition Gaddis Test Bank Online PDF All Chapter
Full Starting Out With Java Early Objects 6Th Edition Gaddis Test Bank Online PDF All Chapter
https://testbankdeal.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-solutions-manual/
https://testbankdeal.com/product/starting-out-with-c-early-
objects-9th-edition-gaddis-test-bank/
https://testbankdeal.com/product/starting-out-with-c-early-
objects-7th-edition-gaddis-solutions-manual/
https://testbankdeal.com/product/starting-out-with-c-early-
objects-8th-edition-gaddis-solutions-manual/
Starting Out with Java From Control Structures through
Objects 6th Edition Gaddis Test Bank
https://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-6th-edition-gaddis-test-bank/
https://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-6th-edition-gaddis-solutions-
manual/
https://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-7th-edition-gaddis-test-bank/
https://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-7th-edition-gaddis-solutions-
manual/
https://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-5th-edition-tony-gaddis-test-
bank/
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
Language: English
ADDRESS
OF
AT BOSTON, MASS.
SATURDAY, APRIL 27, 1912
WASHINGTON
GOVERNMENT PRINTING OFFICE
1912
ADDRESS OF HON. THEODORE
ROOSEVELT.
PRINCIPLES, NOT PERSONALITIES, AT STAKE.
My friends and fellow citizens, men and women of Massachusetts,
men and women of Boston, I am glad indeed to be in your old
historic State, your old historic city, this evening to plead for a cause
which is preeminently the cause for which Massachusetts has stood
throughout her existence as a colony and as a Commonwealth.
[Cheers.] And friends—friends, I shall make my appeal to you in the
name of every man and every principle for whom and for which
Massachusetts has stood in the heroic days of the past. [Applause
and cheers.]
Now, friends, last night I felt obliged to answer at length the
attacks made upon me by Mr. Taft, but I do not wish this contest to
be put upon the basis of a contest of personalities [Good! good! and
cheers] between myself and Mr. Taft, and to-night I shall only allude
to Mr. Taft just as far as it is necessary for me in order to illustrate the
principles for which he and I respectively stand. [Applause.]
Now that was written by Abraham Lincoln 54 years ago, and it has
just happened in your own city, and in mine, and in the country
generally at the present moment.
In consequence, friends, we have against us the money; we have
against us the politicians; we have against us every newspaper that
can be reached or controlled [hisses] by the money power [cries of
“right,” and applause]; we have against us the timid silk-stocking
element—understand, not the silk-stocking man who feels
competent to hold his own in the turmoil of actual life, not the silk-
stocking man who is content to go out into the world and take his
chances as any other man takes his.
We have got that man with us. We have got that man with us.
[Applause.] We have against us only the silk-stocking man who is
not quite confident enough in himself to believe in himself, who is not
quite confident enough in himself to believe that he can hold his own
with the rest of his fellow-Americans without advantage on his part.
[Applause.]
We have these men that I have spoken of against us, and we have
not got anybody with us except the people. [Great applause.] And on
next Tuesday I want the people—I want you—to go to the polls and
vote the same way you shout. [Cries of “you bet, you,” and
applause.]
In Massachusetts, as in Illinois, and as in most other States this
year, it is such a contest in the civic field as you saw in the military
field in 1775 and 1776.
It is a contest between the Minute Men and the mercenaries.
[Applause]. And I want to show that in civic life you are competent to
do the work that your forefathers have done; done with honor in the
past. [Applause.]
LOWELL’S PROPHECY.
Now, friends, there has been an element of comedy to me in being
held up in Massachusetts as an anarchistic agitator, when all that I
have been doing has been to try to reduce to practice in the present
day what the greatest men of Massachusetts have preached in past
time. [Applause.]
I have got here, and I am going to read to you, just a few lines
from Lowell and then two lines from Emerson—Lowell’s being written
nearly 60 years ago and Emerson’s 50 years ago. Lowell’s run:
New times demand new measures and new men;
The old advances and in time outgrows
The laws that in our fathers’ day were best.
And doubtless after us some purer scheme will be
Shaped out by wiser men than we,
Made wiser by the steady growth of truth.
My soul is not a palace of the past,
Where outworn creeds like Rome’s great Senate
quake,
Hearing afar the vandals’ trumpet hoarse
That shakes old systems with a thunder fit.
The time is ripe and rotten ripe for
change. [Applause.]
Then let it come; I have no dread
Of what is called for by the instinct of mankind.
[Cries of “Good!”]
Friends, that is what Lowell wrote in 1856. It is what we could put
on our banners now in 1912.
And I appeal to the Massachusetts of Lowell’s time, to the
Massachusetts that believed in the Bigelow papers, to the
Massachusetts that sent young Lowell and Shaw, that sent Hallowell
and so many of your people to the front in the Civil War.
I appeal to that Massachusetts to stand loyal now to the memories
of Massachusetts’ great past.
And now just wait—only two more lines of poetry. One of the
curious traits of many of our good friends who are at the moment our
opponents is that they are entirely willing to pay heed to the loftiest
democratic sentiments if you will only keep them as sentiments and
not try to reduce them to prose.
BELIEVES IN JUSTICE.
I am not a sentimentalist. If there is one quality I dislike as much
as hardness of heart it is softness of head.
But I do believe in justice just as you believe in justice, and I am
trying to get justice, and I am trying to get it for those who are less
fortunate just as for those who are more fortunate. [Applause.]
Just wait. I want to give you just four or five cases of laws which
the courts of Illinois and New York have declared unconstitutional.
When I went into the legislature 30 years ago in New York, I was put
on a committee to investigate the manufacture of cigars in tenement
houses.
LIFE IN DESPAIR.
I remember well of one of them coming upon a room about 14 feet
—16 feet, perhaps—square, in which two families lived, one of them
with a boarder. Those two families, men, women, and children,
worked and lived, day in and day out, night in and night out, there, at
the manufacture of tobacco into cigars.