Starting Out with Java Early Objects 6th Edition Gaddis Test Bank pdf download
Starting Out with Java Early Objects 6th Edition Gaddis Test Bank pdf download
https://testbankfan.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-c-early-
objects-9th-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-c-early-
objects-7th-edition-gaddis-solutions-manual/
https://testbankfan.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://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/starting-out-with-java-from-
control-structures-through-objects-7th-edition-gaddis-test-bank/
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-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
To
Theodore Wiseman,
Capt. and A. A. Genl., 2nd Div., 14th A. C.
BRIGADE REPORT FROM ATLANTA, FLORENCE,
TO
SAVANNAH, GA.
Headquarters 3rd Brigade, 2nd Division,
14th Army Corps, Army of Georgia, near
Savannah, Ga., January 3rd, 1865.
Theo. Wiseman,
Capt. and A. A. G.
Second Division.
BRIGADE REPORT FROM BENTONVILLE TO
GOLDSBORO,
NORTH CAROLINA.
Headquarters 3rd Brigade, 2d Division, 14th A. C.
Goldsboro, N. C., March 30, 1865.
Captain: I have the honor to report herewith the operations of this
brigade from the hour I assumed command of the same up to its
arrival at this place.
A few minutes before 4 o'clock in the afternoon of the 19th, I was
informed by Capt. Swift, A. A. A. G. of the brigade, that Gen. Fearing
was wounded and disabled for further command, when I
immediately assumed command of the brigade. This was just as my
own regiment came out of the fight and began its formation on the
Goldsboro road, as described in my regimental report. Capt.
Snodgrass, commanding the 22d Indiana, had rallied about 100
men, mostly of his left wing, which had remained in better order
than his right. The 125th Illinois almost entire formed line to the left
and on the prolongation of the basis of alignment of the 22nd
Indiana. I immediately directed two staff officers to find the 52d
Ohio and 86th Illinois and put them in their order on the right of this
new line. While these officers were preparing to execute this order, I
directed so much of the line as was already formed to move forward
to a point by me designated, where the left should rest, and about
seventy-five yards in advance of the rallying point. I had at this time
but one entire regiment and so much of the 22d Indiana as above
mentioned. These I directed to carry rails and when arrived at the
point to which they were ordered, to advance. I then chose my
defensive line, nearly at right angles with the Goldsboro road, and
ordered works to be rapidly constructed. As soon as the work began,
a brigade of the 20th A. C., commanded by Gen. Robinson, joined
my left, and began the construction of a refused line. I then passed
towards the right and met Capt. James, commanding a portion of
the 52d Ohio, and directed him to form on the 22d Indiana. Very
soon thereafter Lieut. Col. Fahnestock reported with a part of the
86th Illinois, whom I directed to form on the right of the 52d Ohio,
refusing well his right. By this time I may safely say that not more
than one-half the command was present. I urged regimental
commanders to bring forward their men as rapidly as possible, and
waste no time in strengthening their works. Cartridge-boxes were
nearly empty, and I directed Captain Swift to find ammunition
wherever he could and distribute it to the regiments. This he
obtained from the 20th army corps, not being able to find
ammunition wagons of our own division. Men who had become
separated from their commands, were rapidly coming forward, so
that the line was now compelled to yield battalion front to the right.
My works were scarcely strong enough to protect men lying down,
when the enemy's skirmishers advanced to within shooting distance,
and commenced a lively fire. At this moment a staff officer of the
Major General commanding left wing, met Captain Burkhalter,
brigade inspector, and directed that the line should be thrown back
about seventy-five yards. This direction I could not obey, even if the
point, selected by him, had been more advisable, for the main line of
the enemy at this moment vigorously assaulted my works, and were
handsomely repulsed. My line having proved available once I
determined to strengthen and hold it; besides it was the nearest
position I could obtain to the lines of the 1st and 2nd brigades of the
division, which I knew were then isolated by the intervention of a
heavy rebel column. About half an hour before sundown, Gen.
Coggswell, commanding a brigade of the 20th army corps, moved in
past my right, and advanced swinging to the left past my front, until
his left rested about 150 yards to the front of my center. Here his
command became hotly engaged, but maintained firmly its position,
until darkness terminated all efforts of the rebels to dislodge it.
During the fight in front, my left was attacked by strong columns of
the enemy, but in every instance they failed to move it. As soon as
darkness came on, I directed my line of works to be made strong,
and obstructions placed in front. Though the troops of this command
had been driven back at an early period of the day, I can bear
witness to the total absence of anything like demoralization in the
ranks, in the engagement I have attempted to describe. Men were
cool and determined, and fought with the energy of heroes. During
the night I maintained a good picket line to my front. On the
morning of the 20th, at 9 o'clock, I was relieved by Gen. Carlin of
the 1st division, and directed to join the 1st and 2nd brigades. This I
did, and took position in reserve. At 9 p. m., by order of Gen.
Morgan, I placed two regiments in temporary works which had been
vacated by Gen. Baird's troops, and on the following morning I
moved the two remaining regiments of the brigade, and extended
the line across the Goldsboro road. This formation put the brigade in
single line with the left much advanced. Here I had constructed a
strong line of works. This new position placed me about one third of
a mile in advance of the 1st division of the corps, and with no
connection on my left, which fact I reported. About 10 a. m. Maj.
Gen. Slocum visited my line, and informed me that he would
immediately put in troops on my left. Soon after a division of the
20th army corps was formed, making the connection complete, but
did not remain more than half an hour, when it was withdrawn,
again leaving my left exposed. This involved the necessity of
refusing the center and left of my line so much, that it threw my
entire line on the south side of, and parallel to, the road. About 3 p.
m., the enemy opened on my skirmish line with artillery, and at the
same time advanced a line of battle and drove the skirmishers in.
The line of battle advanced to within shooting distance of my main
line, but hastily retired upon receiving our fire. The most of my line
was so close to that of the enemy, that lively picket firing was kept
up all day. At night the enemy retreated, and my skirmishers were
the first to enter his works at daybreak, which fact I reported to you
at once. On the 22nd instant the brigade marched as far as the
Neuse river, and encamped for the night. On the morning of the
23rd, it crossed the Neuse and marched as train guard to this place,
where it reached its present camp, on the north side of the city, at
dark. In order to show, to some extent, the damage done to the
enemy in the fight of the 19th instant, I have to report that on the
next day, details from this brigade, for that purpose, buried 112
dead rebels, including 8 commissioned officers, on our front alone.
Other duties were required of the troops before the dead were all
buried. The casualty list of the brigade, pursuant to orders, has been
forwarded. My grateful thanks are due to Captain Swift, A. A. A. G.,
Captain Burkhalter, A. A. I. G., and Lieut. Tanner, A. D. C., for the
efficient services they rendered me at the critical moment when I
assumed command of the brigade, and their subsequent conduct on
the field only added luster to their long acknowledged bravery; also
to Captain Stinson and Lieutenant Scroggs, of the division staff, who
were, during a portion of the engagement, cut off from their
commander, and served me to excellent purpose as volunteer aids,
until communication was opened to Gen. Morgan's quarters.
I have the honor to be Captain,
Very Respectfully,
Your Obedient Servant
JAS. W. LANGLEY,
Lieut. Col. Comdg. Brigade.
To
Theo. Wiseman,
Capt. and A. A. G.
Second Division.
TRANSCRIBER'S NOTES
1. Silently corrected simple spelling, grammar, and
typographical errors.
2. Retained anachronistic and non-standard
spellings as printed.
*** END OF THE PROJECT GUTENBERG EBOOK THE 125TH
REGIMENT, ILLINOIS VOLUNTEER INFANTRY: ATTENTION
BATALLION! ***