Free Access to Introduction to Programming with C++ 3rd Edition Liang Test Bank Chapter Answers
Free Access to Introduction to Programming with C++ 3rd Edition Liang Test Bank Chapter Answers
https://testbankfan.com/product/introduction-to-c-programming-and-
data-structures-4th-edition-liang-solutions-manual/
https://testbankfan.com/product/introduction-to-programming-
with-c-4th-edition-diane-zak-test-bank/
https://testbankfan.com/product/introduction-to-programming-
with-c-4th-edition-diane-zak-solutions-manual/
https://testbankfan.com/product/macroeconomics-3rd-edition-hubbard-
solutions-manual/
Calculus Concepts An Informal Approach to the Mathematics
of Change 5th Edition LaTorre Test Bank
https://testbankfan.com/product/calculus-concepts-an-informal-
approach-to-the-mathematics-of-change-5th-edition-latorre-test-bank/
https://testbankfan.com/product/principles-of-organizational-behavior-
realities-and-challenges-6th-edition-quick-solutions-manual/
https://testbankfan.com/product/aircraft-structures-for-engineering-
students-5th-edition-megson-solutions-manual/
https://testbankfan.com/product/applied-mathematics-for-the-
managerial-life-and-social-sciences-7th-edition-tan-solutions-manual/
https://testbankfan.com/product/calculus-several-variables-
canadian-9th-edition-adams-solutions-manual/
Sales Force Management 10th Edition Johnston Test Bank
https://testbankfan.com/product/sales-force-management-10th-edition-
johnston-test-bank/
Name:_______________________ CSCI 2490 C++ Programming
Armstrong Atlantic State University
(50 minutes) Instructor: Dr. Y. Daniel Liang
1
12 quizzes for Chapter 7
1 If you declare an array double list[] = {3.4, 2.0, 3.5, 5.5}, list[1] is ________.
A. 3.4
B. undefined
C. 2.0
D. 5.5
E. 3.4
2 Are the following two declarations the same
A. no
B. yes
3 Given the following two arrays:
1
A. yes
B. no
6 Suppose char city[7] = "Dallas"; what is the output of the following statement?
A. Dallas0
B. nothing printed
C. D
D. Dallas
7 Which of the following is incorrect?
A. int a(2);
B. int a[];
C. int a = new int[2];
D. int a() = new int[2];
E. int a[2];
8 Analyze the following code:
#include <iostream>
using namespace std;
int main()
{
int list[] = {1, 2, 3, 4, 5};
int newList[5];
reverse(list, 5, newList);
for (int i = 0; i < 5; i++)
cout << newList[i] << " ";
}
#include <iostream>
using namespace std;
2
int main()
{
int x[] = {120, 200, 16};
for (int i = 0; i < 3; i++)
cout << x[i] << " ";
}
A. 200 120 16
B. 16 120 200
C. 120 200 16
D. 16 200 120
10 Which of the following statements is valid?
A. int i(30);
B. int i[4] = {3, 4, 3, 2};
C. int i[] = {3, 4, 3, 2};
D. double d[30];
E. int[] i = {3, 4, 3, 2};
11 Which of the following statements are true?
A. 5
B. 6
C. 0
D. 4
#include <iostream>
using namespace std;
3
int main()
{
int matrix[4][4] =
{{1, 2, 3, 4},
{4, 5, 6, 7},
{8, 9, 10, 11},
{12, 13, 14, 15}};
int sum = 0;
return 0;
}
A. 3 6 10 14
B. 1 3 8 12
C. 1 2 3 4
D. 4 5 6 7
E. 2 5 9 13
15
Which of the following statements are correct?
a. (2 pts)
#include <iostream>
using namespace std;
int main()
{
int a[] = {1, 2};
swap(a[0], a[1]);
cout << "a[0] = " << a[0] << " a[1] = " << a[1] << endl;
return 0;
}
4
b. (2 pts)
#include <iostream>
using namespace std;
int main()
{
int a[] = {1, 2};
swap(a);
cout << "a[0] = " << a[0] << " a[1] = " << a[1] << endl;
return 0;
}
c. (4 pts) Given the following program, show the values of the array
in the following figure:
#include <iostream>
using namespace std;
int main()
{
int values[5];
for (int i = 1; i < 5; i++)
{
values[i] = i;
}
return 0;
}
5
After the last statement
After the array is After the first iteration After the loop is in the main method is
created in the loop is done completed executed
0 0 0 0
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
Part III:
Part III:
<Output>
<End Output>
6
Write a test program that reads a C-string and displays the number of
letters in the string. Here is a sample run of the program:
<Output>
7
Discovering Diverse Content Through
Random Scribd Documents
about without even a patch to hide the holes in their shoes, seems
to be more than most mothers can bear. And the saddest part of the
business is they are sacrificing themselves quite uselessly, to a mere
fetish. For very few of them have any thought of hygiene in their
heads, when they toil and moil, pinch and save, that their children
may have shoes: their thought is all of respectability. They are firmly
convinced that to let them go barefoot would be to rob them of all
claim to rank with the respectable, would be to dub them little
ragamuffins in fact, and thus render them pariahs. And better than
that work all night, no matter what it may lead to.
If these mothers were forced to let their children go barefoot,
things would of course be otherwise; and they would be forced,
practically, were they called upon to do so for patriotism’s sake, for
the sake of saving leather that the soldiers might have plenty of
good shoes. There would be no loss of caste then in banishing shoes
and stockings; on the contrary, it would be the correct thing to do,
the ‘just so’; and they would do it right gladly, thankful that they
could do it without exciting comment. And by doing it, they would
both lighten immeasurably the heavy burden they themselves bear,
and add to their children’s chance of developing into sturdy men and
women, men and women able to do good work for their country,
securing for themselves a fair share of life’s comfort and pleasure
the while. For there is proof and to spare that boys and girls alike
are better off all round, stronger, more vigorous, more active,
without shoes than with them, unless the shoes be of better quality
than those most of the respectable poor can afford to buy. Never
would the Strassburg Committee have ventured to call upon parents
to let their offspring go barefoot had they not known that, even so
far as health was concerned, quite apart from the saving of leather,
good, not harm, would result. For in Germany, whoever else may go
on short commons, children, the Fatherland’s future defenders, are
always well cared for. One of the reasons, indeed, that the
Committee give for issuing their notice is that going barefoot is not
only economical, and therefore, as things are, patriotic, but also
hygienic. And that it is, most of us can see for ourselves.
There are districts both in Scotland and Ireland, to say nothing of
Norway, Sweden, and Switzerland, where there is hardly a shoe to
be found. Yet the people there are more stalwart than in any district
in England where every foot has its shoe. The finest lads I have ever
come across are certainly the Montenegrin; and not one in twenty of
them has either a shoe or a stocking. The only reformatory I have
known where the little inmates are physically quite on a par with
other children, as strong, alert, and light-hearted as other children,
is the Eggenburg Reformatory, in Lower Austria, where both boys
and girls all go barefoot, in winter as well as in summer.
Eggenburg is the one public institution, so far as I know, where
the going-barefoot experiment has been tried, on a large scale, for
the express purpose of benefiting the health of the inmates. And it
was tried there under conditions that were just about as
unfavourable as any conditions the wit of man could have devised.
For the Eggenburg children are for the most part of the poorest of
the poor class, the most demoralised, the criminal or semi-criminal
class; and such children almost always start life heavily handicapped
physically, as well as morally. Everyone who goes to this Reformatory
must have given proof, before he—or she—goes, that his natural
bent is to do what is wrong; that he turns to the left rather than the
right instinctively; that he takes to evil ways, in fact, just as a
duckling takes to water. There were nearly 400 inmates the first time
I was there; and among them, although the eldest was under
sixteen, there were sixty convicted thieves, nine incendiaries, and a
murderer. One boy had been forty times in the hands of the police
before he went to Eggenburg; another, a tiny little fellow, was
suffering from alcoholism when he arrived there. Nor was that all:
very many of the children were being cruelly ill-treated, beaten,
tortured, or starved, when the police took possession of them. Thus
to try this experiment with such material as they were was to invite
failure. And to try it in the Eggenburg district was certainly not to
invite success. For the climate there is bitterly cold in winter. I have
seen snow five feet deep around the Reformatory, and it lies there
for months together. If folk can go barefoot there with impunity, they
can assuredly go barefoot anywhere in England.
To make matters worse, the very officials who were told off to try
the experiment were against it: they resented being called upon to
try it, so sure were they that it was foredoomed. Not one among
them was inclined, therefore, to do his best to render it a success. I
very much doubt, indeed, judging by what they themselves told me
later, whether anyone among them had even the wish that it should
be a success. When Dr. Schöffel, the Provincial Home Minister,
informed them that their charges were to go barefoot, every man in
the institution, every woman too, rose up indignantly and denounced
his project as quite wicked. The Directress of the girls’ wing stoutly
refused to have lot or parcel with any such doings. If he chose to kill
the boys, that was no concern of hers, but kill her girls he should
not, she told him roundly. And to make them go barefoot would be
to kill them, it would be downright murder, she declared; and she
had never a doubt in her mind but that it would.
The storm spread from Eggenburg to Vienna, where public opinion
was strongly on the side of the officials and against their Chief. The
Viennese professed themselves quite shocked at his meanness.
Questions were asked in the Landtag. ‘Is Lower Austria so poor that
she cannot buy shoes for her own adopted children?’ member after
member demanded indignantly. Dr. Schöffel stood his ground firmly,
however. That the experiment should be tried, he was determined;
and for the children’s sake, not the rate-payers’. He was responsible
for the children; it was his duty to see that the best that could be
done for them should be done; and the best was not being done, he
declared. When they arrived at Eggenburg they were almost all
physically below the average of children of their age; they were
lacking in stamina even when not tainted with disease. That in itself
was bad, he maintained; but, what was worse, most of them were
still below the average when they left. These children must each one
of them, while at the Reformatory, be put on a par so far as in them
lay with other children, he insisted. Otherwise they would later, when
out in the world, be handicapped in the struggle for life, unable,
therefore, to hold their own and earn their daily bread. It was, as he
told me himself, for the express purpose of trying to put them
physically on a par with other children, and thus give them a fair
chance of making their way in the world, that he had determined
they should go barefoot.
Consumption is terribly prevalent among the very poor in Lower
Austria, it must be remembered; and it was at that time very
prevalent at Eggenburg. The doctors had long been insisting that the
little inmates ought to live practically out of doors the whole year
round, working on the land, tending cattle. Arrangements had
already been made for them to do so, but a difficulty had arisen.
Working on the land and tending cattle in deep snow meant wet
feet, wet stockings as well as wet shoes; and that for many of them
spelt disaster. Dr. Schöffel was convinced, however, that it was not
the wet feet that did the harm, but the wet shoes and stockings;
and many of the doctors whom he consulted agreed with him. It
was with their warm approval that he had decided to banish
stockings and shoes and leave feet to take care of themselves—to
try the going-barefoot experiment, in fact.
The experiment had long passed the experimental stage when I
paid my first visit to Eggenburg; for, by that time, the inmates had
already been going barefoot for some ten years. From the first it had
proved a marked success, the very officials who had done everything
they could to prevent its being tried, frankly admitted; so marked a
success, indeed, that they had all become hearty supporters of the
new system. Even the Directress of the girls’ wing, who had almost
broken her heart when the change was made, and would have
resigned her post forthwith but for her devotion to her charges,
spoke enthusiastically of the good it had wrought among them. Most
of them were at a trying age, between twelve and sixteen; and most
of them were delicate, never free from coughs and colds. She was
as sure as of life itself, therefore, the first day they went barefoot,
that they would all be ill in bed on the morrow. To her amazement,
however, as she told me, when the morrow came, there was no sign
of special illness among them. On the contrary, instead of coughing
more than usual, they coughed less, and were in less urgent need of
pocket-handkerchiefs. Before a week had passed the great majority
of them had ceased coughing at all, and not one of them had a cold
in her head.
The Director told me much the same tale; as it was with the girls
so was it with the boys. By banishing shoes and stockings, he
declared, Dr. Schöffel had practically banished colds with all their
attendant evils. Under the new system, it was a rare thing for any
boy to develop a cold after being at Eggenburg a week. The general
health of all the children had improved quite wonderfully, both he
and the Directress assured me, since going barefoot had become the
order of the day. And what they said was confirmed by what I heard
from every doctor I came across who knew Eggenburg; was
confirmed, too, by what I saw there with my own eyes. For a finer
set of youngsters than the boys and girls there I have never seen in
any institution, and have not often seen anywhere else.
I had hardly crossed the threshold of Eggenburg before I heard,
what I rarely hear in institutions, peal after peal of hearty laughter;
and I saw little urchins flying as the wind in pursuit of something, I
could not tell what. The very way they threw up their heels as they
ran, the speed with which they went, showed the stuff of which they
were made, the strength of their legs and backs; while the cries they
raised left no doubt as to the strength of their lungs. There was not
a laggard among them, not a weakling. Some of them, it is true,
would have been all the better for more flesh on their bones, I found
when I came to examine them; and some few were not quite so well
grown as they ought to have been. Still they were a wonderfully
vigorous set, considering the handicap with which they had started
in life; and they were as alert as they were vigorous. They swarmed
up poles and twirled themselves round bars, in quite professional
style; and went through their drill with head erect and soldierly
swing. Evidently they were not troubled with nerves at all, nor had
they any fear at all of strangers. They met my advances in the most
friendly fashion; and answered my questions intelligently without
hesitation, looking at me straight the while. Their eyes, I noticed,
were not only bright, but, oddly enough, full of fun, many of them.
They were a light-hearted set, it was easy to see, bubbling over with
delight at being alive; they were a kindly sociable set, too, on good
terms with themselves, one another, and even the officials.
This Eggenburg experiment certainly proves that both boys and
girls are the better, not the worse, for going barefoot. Why, then,
should they wear shoes? The wearing of them is sheer waste,
surely; and in war days waste of any sort is unpatriotic, especially
waste in shoes. For leather is none too plentiful, and is becoming
scarcer and scarcer from day to day; while it is only by straining
every nerve that shoemakers can keep the men at the Front even
decently well shod. Were all the children in England to go barefoot,
even if only for the next three months, our soldiers would many of
them have much better shoes than they have. And most children
would be delighted to go barefoot; and very many mothers would be
delighted to save the money they now spend on shoes, if only the
School Authorities, by appealing to them to do so for their country’s
sake, would give them the chance of doing so without offence to
their fetish, respectability. Unfortunately, many of these Authorities
seem to prefer the worst of leaking, toe-crippling shoes to bare feet.
I once asked a certain Head Master to let a little Gipsy, who was
sojourning in his district, go to his school without shoes. She had
never worn them and did not wish to wear them. He was quite
shocked. Such a thing was impossible, he assured me. The tone of
the whole school would be lowered were a barefoot child to cross its
threshold!
Edith Sellers.
LONG ODDS.
by boyd cable.
FOOTNOTES
[3] ‘Jildi’—quick.
A PEEP AT AN OLD PARLIAMENT.
by sir henry lucy.
‘He never opened his mouth,’ Q says, ‘but the House was
convulsed with laughter, Wetherell himself preserving a
countenance morose in its gravity.’
It was Peel’s custom to remain in the House till one or two o’clock
in the morning, later if necessary. Nor was he a quiescent listener,
following the debate with tireless attention and occasionally
intervening. In this respect Disraeli and Gladstone, brought up at his
feet, were equally close in their attendance and attention. Up to the
last both, whether in office or in Opposition, seated themselves
when the Speaker took the Chair, and with brief interval for dinner
remained till the House was up. The fashion of to-day is widely
different, the habit of the Premier and the Leader of the Opposition
(when there was one) being to withdraw to the privacy of their
respective rooms as soon as questions are over, an example loyally
followed by their colleagues.
I don’t know why, but it is something of a surprise to learn that Sir
Robert Peel was a red-haired man. His son Arthur, who for many
years added grace and authority to the Speaker’s Chair, had raven
locks. The circumstance lends support to Q’s quaint theory that in
the House of Commons red hair is the concomitant of supreme
ability. There is none in the present House.
It is curious and interesting to find in this close contemporaneous
study of Sir Robert Peel two mannerisms strongly marked in his most
famous disciple when in due time he filled his master’s official place
in the House of Commons. Q describes how Sir Robert, when
speaking on any great question, was accustomed to strike at regular
intervals the brass-bound box which lies on the table, in front of
which a Minister is habituated to stand whilst addressing the House.
Nothing if not precise, Q, with his eye on the clock, reckoned that
Peel smote the box at the rate of two strokes a minute. Old
members of the House of Commons will recall this curious habit as
practised by Gladstone. It was occasionally varied by another trick of
driving home his argument by smiting the open palm of his left hand
with his right. The consequence was that he frequently drowned in
the clamour the concluding words of his leading sentences.
Another trick of Peel’s, unconsciously imitated by his pupil, was
that of turning his back on the Speaker and addressing passages of
his speech directly to supporters on the bench behind him or seated
below the gangway. This is a violation of the fundamental rule of
order requiring a member on his legs to address himself directly to
the Chair. In Gladstone’s case it afforded opportunity for welcome
diversion on the part of members on the benches opposite, who
lustily cried ‘Order! Order!’ Interrupted in the flow of his argument
and not immediately recognising the cause, he added to the
merriment by turning round with inquiring look at his tormentors.
‘Sir Robert is the idol of the Tory Party,’ writes this shrewd
observer. ‘With the Conservatives in the House of Commons
everything he says is oracular. He can do with them and make
of them what he pleases. They are the mere creatures of his
will, are as much under his control, and as ready to be
formed and fashioned in any way he chooses, as is the clay in
the hands of the potter.’
Ten years later Peel, counting upon this deference, and believing
with Q that the Tory Party was in all matters submissive to his
command, declared himself a Free Trader. Whereupon, as happened
in the old potter’s shop visited by Omar Khayyam, there was revolt
by the clay population.
And suddenly one more impatient cried:
‘Who is the Potter, pray, and who the Pot?’
The awkward question was answered by Peel’s former vassals
uprising and turning out his Government.
Like the maid in the pastoral poem, Colonel Sibthorpe’s face was
his fortune, at least the early making of it.
‘We who sit on this side certainly have not such remarkable
countenances as that of the gallant Colonel. I would not
abate him a single hair’—here resounded a peal of laughter
—‘in good humour on this or any other ordinary occasion.’
Passing through the stately hall of the Reform Club, I often stop to
look at a portrait of Macaulay hung on the wall at the foot of the
stairway. One would not recognise it from this minute description of
the Member for Leeds who sat in the Parliament in the early ’thirties
of the last century. But between the printed letter and the painted
canvas a period of thirty years stretched.
In his incomparable biography of his uncle, Sir George Trevelyan
tells of the success of his maiden speech. Q, who heard it, describes
it as electrifying the House. He adds that by refraining from early
reappearance in debate Macaulay shrewdly preserved his laurels.
Q evidently did not like Roebuck, who, when more than forty years
later he reappeared on the parliamentary scene as Member for
Sheffield, disclosed a natural talent for getting himself disliked. He
came back with the flood of Toryism that in the General Election of
1874 swamped Mr. Gladstone. Dillwyn, an old and generally
esteemed member, secured the corner seat below the gangway on
the Opposition side, a place made historic in a later Parliament by
the occupancy of Lord Randolph Churchill. Roebuck hankered after
this seat, which he might have obtained by the regulation process of
attendance at prayer-time. He preferred to arrive later and turn out
Dillwyn, making himself otherwise pleasant by prodding his stick
along the back of the bench, regardless of the presence of
honourable members.
Dillwyn stood this for a long time. At length his patience was
exhausted. I remember one afternoon when Roebuck, arriving as
usual midway in the course of questions, made for the corner seat
and stood there expecting Dillwyn to rise. The Member for Swansea,
studiously unaware of his presence, made no sign. After a pause
watched with eager eyes by a crowded House, Roebuck turned
about and amid a ringing cheer from the Ministerialists crossed over
to the Tory camp, where politically he was more at home.
In the days when Roebuck represented Bath, Q describes him as
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
testbankfan.com