Starting Out with Java From Control Structures through Data Structures 3rd Edition Gaddis Test Bank instant download
Starting Out with Java From Control Structures through Data Structures 3rd Edition Gaddis Test Bank instant download
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-3rd-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-3rd-edition-gaddis-solutions-
manual/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-2nd-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-2nd-edition-gaddis-solutions-
manual/
https://testbankfan.com/product/college-algebra-7th-edition-blitzer-
solutions-manual/
Payroll Accounting 2015 1st Edition Landin Solutions
Manual
https://testbankfan.com/product/payroll-accounting-2015-1st-edition-
landin-solutions-manual/
https://testbankfan.com/product/chemistry-6th-edition-mcmurry-test-
bank/
https://testbankfan.com/product/principles-of-animal-physiology-3rd-
edition-moyes-test-bank/
https://testbankfan.com/product/general-organic-and-biochemistry-an-
applied-approach-2nd-edition-james-armstrong-solutions-manual/
https://testbankfan.com/product/psychology-a-framework-for-everyday-
thinking-1st-edition-lilienfeld-test-bank/
Social Animal 11th Edition Aronson Test Bank
https://testbankfan.com/product/social-animal-11th-edition-aronson-
test-bank/
Starting Out with Java: From Control Structures through Data Structures 3e (Gaddis and Muganda)
Chapter 6 A First Look at Classes
2) Class objects normally have ________ that perform useful operations on their data, but primitive
variables do not.
A) fields
B) instances
C) methods
D) relationships
Answer: C
3) In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the cookies.
A) object; classes
B) class; objects
C) class; fields
D) attribute; methods
Answer: B
5) When you are working with a ________, you are using a storage location that holds a piece of data.
A) primitive variable
B) reference variable
C) numeric literal
D) binary number
Answer: A
1
Copyright © 2016 Pearson Education, Inc.
7) Most programming languages that are in use today are:
A) procedural
B) logic
C) object-oriented
D) functional
Answer: C
8) Java allows you to create objects of this class in the same way you would create primitive variables.
A) Random
B) String
C) PrintWriter
D) Scanner
Answer: B
10) Data hiding, which means that critical data stored inside the object is protected from code outside the
object, is accomplished in Java by:
A) using the public access specifier on the class methods
B) using the private access specifier on the class methods
C) using the private access specifier on the class definition
D) using the private access specifier on the class fields
Answer: D
2
Copyright © 2016 Pearson Education, Inc.
12) You should not define a class field that is dependent upon the values of other class fields:
A) in order to avoid having stale data
B) because it is redundant
C) because it should be defined in another class
D) in order to keep it current
Answer: A
16) A constructor:
A) always accepts two arguments
B) has return type of void
C) has the same name as the class
D) always has an access specifier of private
Answer: C
17) Which of the following statements will create a reference, str, to the String, "Hello, World"?
A) String str = "Hello, World";
B) string str = "Hello, World";
C) String str = new "Hello, World";
D) str = "Hello, World";
Answer: A
3
Copyright © 2016 Pearson Education, Inc.
18) Two or more methods in a class may have the same name as long as:
A) they have different return types
B) they have different parameter lists
C) they have different return types, but the same parameter list
D) you cannot have two methods with the same name
Answer: B
19) Given the following code, what will be the value of finalAmount when it is displayed?
4
Copyright © 2016 Pearson Education, Inc.
20) A class specifies the ________ and ________ that a particular type of object has.
A) relationships; methods
B) fields; object names
C) fields; methods
D) relationships; object names
Answer: C
21) This refers to the combining of data and code into a single object.
A) Data hiding
B) Abstraction
C) Object
D) Encapsulation
Answer: D
23) In your textbook the general layout of a UML diagram is a box that is divided into three sections. The
top section has the ________; the middle section holds ________; the bottom section holds ________.
A) class name; attributes or fields; methods
B) class name; object name; methods
C) object name; attributes or fields; methods
D) object name; methods; attributes or fields
Answer: A
5
Copyright © 2016 Pearson Education, Inc.
26) After the header, the body of the method appears inside a set of:
A) brackets, []
B) parentheses, ()
C) braces, {}
D) double quotes, ""
Answer: C
30) When an object is created, the attributes associated with the object are called:
A) instance fields
B) instance methods
C) fixed attributes
D) class instances
Answer: A
31) When an object is passed as an argument to a method, what is passed into the method's parameter
variable?
A) the class name
B) the object's memory address
C) the values for each field
D) the method names
Answer: B
6
Copyright © 2016 Pearson Education, Inc.
32) A constructor is a method that:
A) returns an object of the class.
B) never receives any arguments.
C) with the name ClassName.constructor.
D) performs initialization or setup operations.
Answer: D
34) Which of the following statements will create a reference, str, to the string, "Hello, world"?
7
Copyright © 2016 Pearson Education, Inc.
36) Given the following code, what will be the value of finalAmount when it is displayed?
8
Copyright © 2016 Pearson Education, Inc.
38) Instance methods do not have this key word in their headers:
A) public
B) static
C) private
D) protected
Answer: B
39) Which of the following is NOT involved in finding the classes when developing an object-oriented
application?
A) Describe the problem domain.
B) Identify all the nouns.
C) Write the code.
D) Refine the list of nouns to include only those that are relevant to the problem.
Answer: C
41) Quite often you have to use this statement to make a group of classes available to a program.
A) import
B) use
C) link
D) assume
Answer: A
import java.util.Scanner;
This is an example of
A) a wildcard import
B) an explicit import
C) unconditional import
D) conditional import
Answer: B
9
Copyright © 2016 Pearson Education, Inc.
43) Look at the following statement.
import java.util.*;
44) The following package is automatically imported into all Java programs.
A) java.java
B) java.default
C) java.util
D) java.lang
Answer: D
4) A method that stores a value in a class's field or in some other way changes the value of a field is
known as a mutator method.
Answer: TRUE
7) Shadowing is the term used to describe where the field name is hidden by the name of a local or
parameter variable.
Answer: TRUE
8) The public access specifier for a field indicates that the attribute may not be accessed by statements
outside the class.
Answer: FALSE
9) A method that gets a value from a class's field but does not change it is known as a mutator method.
Answer: FALSE
10
Copyright © 2016 Pearson Education, Inc.
10) Instance methods do not have the key word static in their headers.
Answer: TRUE
11) The term "default constructor" is applied to the first constructor written by the author of a class.
Answer: FALSE
12) When a local variable in an instance method has the same name as an instance field, the instance field
hides the local variable.
Answer: FALSE
13) The term "no-arg constructor" is applied to any constructor that does not accept arguments.
Answer: TRUE
14) The java.lang package is automatically imported into all Java programs.
Answer: TRUE
11
Copyright © 2016 Pearson Education, Inc.
Exploring the Variety of Random
Documents with Different Content
in Icelandic and Danish—of the management and teaching of
our College, for the year 1852, ’53.
FOOTNOTES:
46. “Efterretninger.”
And we sailed, and we flew, and went near the Maelstrom bay,
And we danced, and we frolicked, and we fiddled all the way.
OLD SONG.
A FINE morning in August found our little schooner dancing over the
waves of the Greenland strait. Towering up on our right, was the
lofty Snæfell Jokull, one of the highest mountains in Iceland. It has
the regular conical shape of most volcanoes. It is six thousand feet
high, being one-third higher than Vesuvius. At this season about
two-thirds of its height is black, and the rest is covered with
perpetual snow. When more than fifty miles to the south, I took a
drawing of it. It is near the end of a long peninsula, south of
Breithifiorth, and very nearly the westernmost point of Iceland. The
sharp outline of the mountain is distinctly visible in the clear
atmosphere here for more than a hundred miles. This volcano has
not had an eruption for several centuries. Two or three parties of
modern travelers have been to the summit. They have described the
ascent, after reaching the snow-line, as extremely dangerous. Wide
and deep cracks in the everlasting ice, and treacherous bridges of
snow, made the danger so great that they tied themselves in a
string, to a long rope, and walked about six feet apart. Then, if one
man fell through into a chasm, the rest pulled him out. No lives were
lost, however, in these excursions; the toil sweetened the pleasure,
the danger spiced it, and they were much gratified with their lofty
journey. To the east of Snæfell Jokull, we sailed by Stapi, a small
town near some famous basaltic cliffs, on the coast. Immense
perpendicular columns, and many thrown down, give the coast much
the appearance of the vicinity of the Giant’s Causeway, and the
island of Staffa. The coast here is more varied, and the scenery
more magnificent, than the north of Ireland; but there is no cave yet
discovered that will vie with the famed one of Fingal’s. Some of the
pillars here at Stapi are near eight feet in diameter, and all of them
of the regular geometrical shape so often seen in basaltic rocks.
They are like the cells in honeycombs, but solid, and generally
hexagonal, but sometimes heptagons and pentagons. Though the
time when these basalts were in a state of fusion is very remote, yet
there is no doubt of their volcanic character. If geologists and
mineralogists wish to see volcanic matter in every variety of form, let
them come to Iceland.
We passed by the Meal Sack and the Grenadier Islands, the first day,
and rounded the long nose of Cape Reykjanes, and the second
found us driving before a southwest wind; due east, along the south
coast of Iceland. We sailed near the Westmann Islands, and plainly
in sight of the lofty summits of Hekla, Torfa, Eyjafjalla, and Tindfjalla
Jokulls. The most singular curiosity on the south coast of Iceland,
that can be seen from the sea, is a group of rocks that I should call
The Needles, from their great resemblance to the “Needles” of the
Isle of Wight. They are near a little fishing village called Dyarholar, or
“Portland.” The rocks are shaped a little more like bodkins than
needles, and some of them rear their pointed heads near a hundred
feet high. They all stand in the ocean, some of them over a mile
from land. As we sailed east, the craggy summit of the Oræfa Jokull
showed his lofty and chilly head. The sides, too, were visible as well
as the summit, and perpendicular rocks and dark-looking caverns
showed the foot-prints of mighty convulsions of nature. The Oræfa
Jokull, forming part of that immense mountain known as Skaptar
Jokull, is, as I have mentioned before, the highest in Iceland. By
trigonometrical measurement, it is 6,760 feet high. Snæfell Jokull is
6,000 feet; Eyjafjalla Jokull, 5,900; and Hekla, 5,700. The Thiorsá
river, a stream larger than the Hudson or the Rhine, rises high up on
the side of Skaptar Jokull, 3,000 feet above the level of the sea, and
in a deep cañon in the lava, pours its resistless torrent down into the
ocean. Its rapid and turbulent current may be imagined. These
mountains in the interior of the country, the volcanic islands out at
sea, the rapid and powerful rivers, the Geysers, and innumerable hot
springs, along with the magnificent coast scenery, form the most
prominent physical features of Iceland.
For two days we were skirting the island on the south coast. This,
and the eastern part of Iceland, has few harbors. The coast is, much
of it, low and sandy, and difficult of approach. Some years since, a
French vessel was wrecked here in the winter season, and the crew
cast ashore, perfectly destitute. A few poor Icelanders that lived in
the vicinity, carried them to their huts, fed and took care of them,
and gave them shelter till spring. The next summer, on the annual
return of the French war-vessel that visits Iceland, the sailors were
taken home; and king Louis Philippe ordered a handsome
compensation and reward in money, to the Icelanders who had so
hospitably protected his shipwrecked sailors. They, however, did not
wish it; said they had only done their duty, and neither wanted nor
deserved compensation; and steadily refused to accept a single
penny. Determined to do something in return for their kindness,
Louis Philippe ordered his representative in Iceland to state that he
would educate at the University of France, four young Icelanders;
and the Governor, the Bishop, and the President of the College,
made choice of the young men who were to be recipients of the
favor. At the end of their term—four years—as many more were
selected; and thus the French government undertook the constant
care and expense of the education of four Iceland boys, who were
appointed for their ability, diligence, and good conduct, to receive
the bounty of the French government; and all for an act of humanity
towards a crew of shipwrecked sailors. The whole transaction
reflects the highest honor on all concerned. One of the young
gentlemen who was a recipient of this privilege, was a son of my
friend Mr. Sivertsen. After the French war-vessel, the unfortunate
LILLOISE, was lost, or failed to return from the Arctic sea, in connection
with one of the expeditions that went in search of her, there was a
scientific corps—a “Scandinavian Commission”—organized, of
learned men from France, Denmark, and Iceland, to gather
information, make drawings of landscapes, and collect specimens of
mineralogy, botany, and the various branches of natural history. The
commission was headed by M. Paul Geimar, and our young Icelander
was one of the party. The results of the expedition, in a scientific
point of view, were of the highest value. A work was published,
containing several folio volumes of plates, many of them colored,
and the Journal of the Expedition, in six octavos; and altogether it
forms the most valuable work of the kind extant. It comprises
Iceland, Greenland, Lapland, and Spitzbergen; and nothing, either of
a geographical, scientific, or historical nature has been omitted.
Along with portraits of Geimar and others of the Commission, is a
“counterfeit presentment” of young Sivertsen; and his is one of the
finest faces ever delineated. It has the lively, intelligent
countenance, lofty brow, and beaming eye of the Anglo-Saxons, and
equal to the finest specimens of the Caucasian race in any part of
the world. This promising young man died in France, a few years
after his return from the North, universally esteemed by all, and by
none more than by Louis Philippe himself.
But the winds are drifting us lazily to the eastward. We sailed north
of Faroe, and saw the cliffs of the lofty Stromoe towering upwards
like the ruins of some gigantic temple. The return voyage was all
beautiful September weather. Our passengers—except the bachelor
of the present writing—consisted of twelve young Iceland ladies, and
a small lad; and we had a regular “jolly” time. Several of the young
ladies were singers, and two of them had guitars. Nearly every
afternoon we had a dance. The young ladies made fast progress in
English—and Yankee—manners, customs, language, and dancing. I
also got well posted up in Icelandic, particularly in the sentimental,—
or, as Sam Weller would say, in the more “tenderer vords.” Guitar
music, Iceland hymns, the violin, and “threading the dance” on a
rocking deck, were all matters of every-day occurrence. Did I say
every day? Not with me. But the master of the Sölöven, Captain
Heinrich Stilhoff, was certainly the most reckless, irreligious man for
a sea-captain, that ever I saw in my life. Had a sober traveler come
alongside of us on Sunday, he would have been bothered to have
found out what kind of worship we had aboard. His reflections would
probably have been like old Lambro’s, when he returned, from his
piratical cruise, to his island and his daughter. Suppose such a one in
his yacht had come up with us:
A Christian he, and as our ship he nears,
He looks aboard, and finds no signs of idling,
He hears—alas! no music of the spheres,
But an unhallowed, earthly sound of fiddling!
A melody which makes him doubt his ears,
The cause being past his guessing or unriddling:
But, lo! it is the sailors all a prancing,
The women, too, and Captain Stilhoff, dancing!
It does not speak well for the Danish people and nation, that their
mail-ship, the only government vessel running between Denmark
and Iceland, is commanded by a man of the character of Captain
Stilhoff; and I cannot think it will long continue so. Commanding a
vessel carrying the Government dispatches, and having the most
popular and direct passenger traffic between the two countries, a
profligate who openly boasts of debauching his female passengers,
defenseless women, the sisters and daughters of the citizens of both
countries; a state of things that certainly does not reflect any honor
on the proprietors of the vessel, or show much sagacity in their
choice of a commander.
On, on, goes our little bark; the northern shore
“Fades o’er the waters blue;
The night winds sigh, the breakers roar,
And shrieks the wild sea-mew.”
Old Norway’s coast appears, and we are several days in sight of the
brown and snowy mountains, and little villages of wooden houses.
The thirteenth day, we passed Cape Lindesness, and Christiansand.
We were then within two hundred and fifty miles of Copenhagen—
only a few hours’ voyage for a steamship; but we had no steam a-
board, except what might be found in certain kettles and casks, and
these did not aid our progress much. I thought two days, at farthest
would suffice for the rest of our voyage; but Boreas was not in the
ascendant, nor any of his brethren either, much, for we had very
little wind from any quarter. The current in the Skager Rack took us
outwardly about two miles an hour, and the wind was southeasterly,
and we were bound in. One tack would throw us near the coast of
Norway, and the next brought us along the low, flat sands of
Jutland. We progressed from twenty-five to fifty miles a day. Several
huge steamers boomed past us, with their black sides, and volumes
of smoke, and swift progress. Some of them were bound into the
Baltic, and some out, and some to Norwegian ports. At last we
rounded the Skagen Horn, and entered the Cattegat. Finally, the
towers of Elsinore Castle appeared; and, a breeze springing up from
the north, we dropped anchor before Copenhagen, the twentieth
day after leaving Iceland; and, in a most terrible rain—so anxious
were we to tread the land again—all the passengers were set on the
quay, and found lodgings amid the turmoil of a great city.
GENERAL INDEX.
Kirkubær, 139.
Krisuvik, 200.
Petrifactions, 191.
Pfeiffer, Madam, 95, 123, 161.
Philmore, Mr., an English traveler, 210.
Plum-pudding Stone, 199.
Pope’s Essay on Man, in Icelandic, 53.
Quotation from, 285.
Portland, or Dyarholar, 315.
Postal arrangements in Iceland, 56.
Post-ship, time of sailing, 56.
Products of Iceland, 55, 56, 295, 298.
TO THE
Scandinavian Mythology.
testbankfan.com