Professional Documents
Culture Documents
Starting Out With Visual C 4th Edition Gaddis Test Bank 1
Starting Out With Visual C 4th Edition Gaddis Test Bank 1
Starting Out With Visual C 4th Edition Gaddis Test Bank 1
Multiple Choice
1. To add an item to a ListBox control with code, you call the control’s
____________method.
a. Add.Items
b. Items.Add
c. Items.Append
d. Items.Insert
ANS: B
2. ListBox controls have an ____________ property that reports the number of items
stored in the ListBox.
a. Items.Count
b. Items.Size
c. Items.List
d. Items.Contains
ANS: A
3. ListBox controls have an ____________ method that erases all the items in the Items
property.
a. Items.Erase
b. Items.Remove
c. Items.Clear
d. Items.Reset
ANS: C
4. Each time a loop executes its statement or statements, we say the loop is performing
a(n) ____________.
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
a. cycle
b. pass
c. execution
d. iteration
ANS: D
5. The ____________ begins with the word while, followed by a Boolean expression that
is enclosed in parentheses.
a. conditional statement
b. logic mark
c. while clause
d. loop parameter
ANS: C
6. The statement or block of statements following the while clause is known as the
____________ of the loop.
a. assembly
b. body
c. definition
d. sequence structure
ANS: B
7. The while loop is known as a ____________, which means it tests its condition before
performing each iteration.
a. posttest loop
b. pretest loop
c. proactive loop
d. preemptive loop
ANS: B
8. ____________ are commonly used to control the number of times a loop iterates.
a. Boolean variables
b. Sentinel variables
c. Counter variables
d. Named constants
ANS: C
b. game loop
c. infinite loop
d. expressionless loop
ANS: C
ANS: D
ANS: C
ANS: B
ANS: B
14. When the ++ and -- operators are written after their operands it is called
____________.
a. prefix mode
b. suffix mode
c. appendix mode
d. postfix mode
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
ANS: D
15. The ++ and -- operators can be written before their operands, which is called
____________.
a. preface mode
b. postfix mode
c. prefix mode
d. superscript mode
ANS: C
16. The ____________ is specifically designed for situations requiring a counter variable to
control the number of times a loop iterates.
a. while loop
b. if-else statement
c. for loop
d. switch statement
ANS: C
17. The first expression appearing in the header of a for loop is the ____________, which
usually assigns a starting value to a counter variable.
a. update expression
b. test expression
c. Boolean expression
d. initialization expression
ANS: D
18. The second expression appearing in the header of a for loop is the _____________,
which is a Boolean expression that determines whether the loop will repeat.
a. test expression
b. update expression
c. initialization expression
d. control expression
ANS: A
19. The third expression appearing in the header of a for loop is the ____________, which
executes at the end of each iteration. It usually increments the loop’s counter variable.
a. test expression
b. update expression
c. initialization expression
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
d. increment expression
ANS: B
20. Because the for loop tests its Boolean expression before it performs an iteration, it is a
____________.
a. pretest loop
b. pseudo loop
c. posttest loop
d. infinite loop
ANS: A
21. Be careful not to place a statement that modifies the counter variable inside the body of
a ____________.
a. while loop
b. if statement
c. for loop
d. switch statement
ANS: C
22. In the header of a for loop, which expression should not end with a semicolon?
a. initialization expression
b. test expression
c. update expression
d. none of these
ANS: C
23. The ____________ is a posttest loop, which means it performs an iteration before
testing its Boolean expression.
a. for loop
b. while loop
c. do-while loop
d. do-before loop
ANS: C
24. The term ____________ is used to describe a file to which data is written.
a. input file
b. output file
c. record file
Another document from Scribd.com that is
random and unrelated content:
dilatable expansion of the throat. In comparison with the above most
characteristic features, the rest of the structure of the bird is to the
ornithologist of secondary importance; it is, however, very peculiar. The
body is large and cylindrical, the neck long and slender; the feet are
small, toes long, and connected by a broad web. In the large broad wing,
the third quill exceeds the rest in length; the tail, which is short, broad,
and rounded, consists of twenty or twenty-four feathers. The plumage is
thick, but remarkably hard and stiff; besides the almost naked sac
beneath the throat, there is a considerable space around the eye
completely denuded of feathers. The two sexes resemble each other very
closely, but considerable differences serve to distinguish the old birds
from the young.
Pelicans inhabit the torrid regions of the earth, but are also found to a
considerable distance within the limits of the temperate zone. In their
habits and mode of life, the different groups nearly resemble each other,
and we shall therefore confine ourselves to a description of two species
met with in Europe.
None but those who have travelled in Egypt and North Africa can
form any idea of the vast numbers of fish-eating birds that there crowd
the shores of every lake and river. Upon all the Egyptian lakes along the
course of the Nile, during the period of its inundation, and still further to
the south, along the banks of the Blue and White Nile, as well as on the
shores of the Red Sea, Pelicans occur in such immense flocks that the
eye is unable even to estimate their extent. Over a considerable surface
of country they literally cover the quarter, or the half, of every square
mile. When they are swimming out upon the lakes, they look like
immense beds of water-lilies. When they come out of the water to sit
upon the shore, more especially if it be upon one of the islands, and sit in
the sunshine preening their feathers, they look at a distance like a vast
white wall, and when they retire to sleep, all the trees upon the island are
so thickly covered with them that they have the appearance of blossoms
without a single green leaf. To meet a small flock of about ten or a dozen
is an unusual occurrence, but to see hundreds or thousands together is a
very ordinary spectacle. As the spring approaches, these enormous hosts
are in some measure broken up. Many which during the winter season
congregated together make their way to Southern Europe, where they
breed, but numbers of them are left behind. In selecting the place of their
sojourn, these birds seem to make no difference between salt water and
fresh; they frequent both in almost equal numbers, but the depth of the
water is to them a matter of considerable importance.
Only a single American species obtains its food by diving, the others
are altogether too lightly built to render such a mode of fishing
practicable. They lie upon the surface of the water as if they were made
of cork, and it is only in shallow water, to the bottom of which they can
reach with their long neck and hooked bill, that they usually fish for
food. For this purpose they assemble together in some place where water
is of the proper depth, arranging themselves with considerable regularity,
so as to enclose a large space, which as they advance forward is
gradually diminished. In large lakes and shallows by the sea-shore they
arrange themselves in a semicircle, and row themselves gradually
towards the beach, or else they form a complete circle, the diameter of
which diminishes as they advance towards each other. In narrow rivers or
canals they divide into two parties, and arrange themselves in close ranks
facing each other, thus enclosing a space in which their prey is to be
procured, as the two lines swim in opposite directions until they meet. In
general these birds feed only on fishes, but not unfrequently they catch
other vertebrate animals. Young birds, for example, that happen to
approach them too closely are seized and swallowed, and even half-
grown Ducks occasionally disappear down their capacious throats in an
equally unceremonious manner. When on dry land the gait of these birds
is slow and waddling, nevertheless they can scarcely be said to walk
badly, and notwithstanding their webbed feet, they readily perch upon
trees; they swim well, and their powers of flight are excellent. The daily
life of the Pelicans is conducted in a very regular manner; the early hours
of morning are employed in catching food, and they may then be seen
hastening from all quarters to their fishing-ground, in small or large
parties, the former flying in single file, the latter in the well-known V-
shape adopted by many birds of passage. Some parties may soon be seen
returning from the water, satisfied with their meal, while others are
making their way towards the shallow bay from which their breakfast
has to be procured. Towards ten o'clock a.m. they begin to congregate
upon their favourite sandbank, or an inland group of trees, and here they
repose after their toil, some lazily digesting their food, and others more
actively employed in oiling and preening their feathers, a proceeding in
which they are occupied for a considerable length of time, their long
unmanageable bill being but little adapted to the work. When this is
accomplished, they take a kind of siesta, some perched on trees, others
on the ground, the former generally sitting bolt upright upon the
branches, with their necks thrown back, and their beak resting on their
breasts, while the latter generally lie flat on their bellies, and doze away
the noontide hours. Between three and four o'clock the whole assembly
begins to wake up and prepare for another fishing excursion, in which
they are engaged till sunset, after which they at once set off to their
sleeping-places, situated on a lonely sandbank, or some island covered
with trees, upon the branches of which they pass the night. As to the
breeding of these birds, we have been able to collect little from personal
observation; it appears, however, by no means unlikely that in the
interior of Africa some of them may build their nests in the trees, to
which they so frequently resort. In Southern Europe, as Von der Muhle
informs us, they select morasses and lakes for their breeding-places. In
some of these lakes, says our informant, floating islands are to be met
with, which are only approachable with great difficulty, and upon these
they build their rudely-constructed nests, as close to each as other they
can well be placed. The nests themselves are constructed of reeds and
sedges, trodden together into a mass, and are generally damp or even
wet. The whole neighbourhood is covered with their filth, the stench of
which, added to that of the putrid fishes, which are everywhere strewn
about, is at this hot season of the year, absolutely unbearable. Strangely
enough they do not all breed at the same time, for brooding females are
often sitting in the immediate vicinity of fledged young birds; indeed,
Freyberg, who has often visited these breeding-places, informs us that in
the same nest he has seen a nearly-fledged young one, and another as yet
only covered with down, a circumstance only to be explained by
supposing that two females had laid their eggs in the same nest. The
usual number of eggs, as we are told by Bädecker, is from three to five.
Those that have been observed in a state of captivity have only laid two.
In proportion to the bird the eggs are of small size, being not so large as
those of a Swan; their shape is more or less elongated, with both ends of
equal size, their colour is blueish white, but their external surface
remains for some time soft and pasty, and a layer of dirt, which sticks to
them after they have been sat upon, renders it impossible to clean the
shell. The young present nothing particular in their appearance, save that
they are disgustingly filthy, nevertheless, their parents seem
affectionately attached to them, and will suffer themselves to be captured
rather than desert their charge.
(Pelecanus onocrotalus). - .
The TRUE GUILLEMOTS (Uria) are larger than the above birds,
but very similar in structure; their beak is elongated, of moderate length,
straight and sharply-pointed, slightly vaulted above, and decidedly
angular beneath; its sides are compressed, and edges somewhat drawn in
the foot resembles that of Cephus grylle, but the toes are proportionately
longer; the wings are also smaller and more pointed, and the tail,
composed of twelve feathers, shorter; the general plumage is thick and
compact; the under surface is usually white and almost fur-like, whilst
the upper parts of the body are more or less dark brown. The Guillemots
principally inhabit northern latitudes, at certain seasons appearing in
more temperate climates; except during the period of incubation they
seldom visit the land, but pass their whole time upon the ocean. They are
excellent swimmers, and dive well, using both feet and wings for their
propulsion, so that their movements beneath the water are performed
with admirable rapidity and precision; their flight is rapid but hurried,
and, owing to the shortness of their wings, whirring and noisy. So
numerous are these birds in the neighbourhood of their breeding-places,
that (more especially if it be a rock of a pyramidal form) they resemble at
a distance a great swarm of bees. When descending into the water to fish
for food, their wings are kept quite straight and motionless. Except
during the breeding season these flights are not often attempted, at other
times they seldom leave the water, or if induced to take a short
excursion, by way of exercising their wings, they soon drop down again
into the friendly shelter of the waves. They are almost unable to progress
upon dry land; occasionally, however, they may be seen upon the beach,
half walking and half flying, with a very peculiar gait, somewhat
resembling dancing. Anyone who has visited the breeding-places of
these birds will no longer wonder that they have in all languages
received names expressive of foolishness and stupidity. When in the
water they will often let a boat come close to them without showing the
slightest distrust of its dangerous occupants, and on dry land, such is
their unconsciousness of harm, that they will allow a man to come within
a few steps of them without stirring from the spot. This so-called
stupidity or indolence is, however, easily explicable. Of man, who
seldom visits their wild resorts, they have no experience, and
consequently have not learned to fear him; but should a Falcon or an
Eagle make its appearance, even in the remote distance, thousands of
them at once take wing, and hastily retreat to some place of safety. The
cliffs on which they build present a remarkable spectacle; rocks
abounding in rifts, cracks, shelves, and ledges, stretching along the shore
or rising abruptly from the sea, afford them the situations they prefer; if
isolated, solitary, and accessible to none but winged creatures, so much
the more eligible. There, about the end of March or beginning of April,
they may be seen to congregate, their numbers gradually increasing until
countless multitudes throng every available situation. Thousands and
hundreds of thousands swarm upon the ledges, shelves, and projections,
wherever these are to be found, and range themselves in rows like a
regiment of soldiers, all with their white breasts turned towards the sea,
hundreds of thousands more may be seen flying off from the ledges of
the cliffs down to the water below, while multitudes, equally
innumerable, are as constantly flying upwards from the sea to the cliff,
and whole fleets are swimming and diving in the waves beneath. Strange
to say, although every place affording foothold is crowded to excess, the
utmost order and decorum everywhere prevail; each seems desirous of
assisting and accommodating the other, so that disputes or battles seldom
occur. The countless pairs of which this vast assembly consists exhibit
the utmost constancy and attachment, and may be seen before the eggs
are laid, keeping constantly together, caressing each other with their
beaks, and evincing the greatest affection. They fly off together to the
sea, fish together for a supply of food, and then return to their nesting-
place, where they subsequently share the duties connected with the
incubation of the eggs, and the procuration of food for their progeny. The
female lays but a single very large egg, which is shaped like a pegtop,
and thus, by a simple but beautiful contrivance, is prevented from rolling
off the narrow ledge on which, without any other protection, it safely
rests. The egg is provided with a coarse shell, spotted and streaked with
dark markings upon a light ground, but so variable are the colours, that
out of a hundred scarcely two will be found exactly alike. The period of
incubation extends over from thirty to thirty-five days. When the young
makes its appearance it rather resembles a ball of greyish black wool
than a bird; its coat of down soon disappears; its growth is rapid; and in
about a month it is completely fledged.