Professional Documents
Culture Documents
Test Bank:
https://testbankpack.com/p/test-bank-for-c-how-to-program-early-
objects-version-9th-edition-by-deitel-isbn-0133378713-9780133378719/
2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using:
a. Two forward slashes ( // ).
b. Three forward slashes ( /// ).
c. A slash and a star ( /* ).
d. A slash and two stars ( /** ).
ANS: a. Two forward slashes ( // ).
2.2 Q2: Which of the following does not cause a syntax error to be reported by the C++ compiler?
a. Mismatched {}.
b. Missing */ in a comment.
c. Missing ; at the end of a statement.
d. Extra blank lines.
ANS: d. Extra blank lines.
2.2 Q5: Which of the following statements would display the phrase C++ is fun?
a. std::cout << "Thisis fun\rC++ ";
b. std::cout << '++ is fun';
c. std::cout << "\"C++ is fun\"";
d. std::cout << C++ is fun;
ANS: a. std::cout << "Thisis fun\rC++ ";
Section 2.3 Modifying Our First C++ Program
b. World Hello
c. Hello
World
d. World
Hello
ANS: a. Hello World
2.3 Q4: Which of the following code segments prints a single line containing hello there with
the words separated by a single space?
a. std::cout << "hello ";
std::cout << " there";
b. std::cout << "hello" , " there";
c. std::cout << "hello";
std::cout << "there";
d. std::cout << "hello";
std::cout << " there";
ANS: d. std::cout << "hello";
std::cout << " there";
2.4 Q2: The object enables a program to read data from the user.
a. std::cout.
b. std::cin.
c. std::cread.
d. std::cget.
ANS:b. std::cin.
2.4 Q3: The assignment operator assigns the value of the expression on its right to the
variable on its left.
a. <-
b. ->
c. =
d. #
ANS: c. =.
2.5 Q1: Which of the following statements does not overwrite a preexisting value stored in a
memory location?
a. int a;
b. number = 12;
c. y = y + 2;
d. width = length;
ANS: a. int a;
2.5 Q2: Which of the following statements could potentially change the value of number2?
a. std::cin >> number2;
b. sum = number1 + number2;
c. number1 = number2;
d. std::cout << number2;
ANS: a. std::cin >> number2;
2.6 Q1: What is the value of result after the following C++ statements execute?
int a, b, c, d, result;
a = 4;
b = 12; c = 37;
d = 51;
result = d % a * c + a % b + a;
a. 119
b. 51
c. 127
d. 59
ANS: a. 119.
-,*,/,+,%
Assume that if two operations have the same precedence, the one listed first will be evaluated first.
a. +,-,/,*,%
b. -,+,%,*,/
c. -,*,%,+,/
d. *,/,%,-,+
ANS: d. *, /, %, -, +
2.7 Q1: What will be the output after the following C++ statements have been executed?
int a, b, c, d;
a = 4;
b = 12;
c = 37;
d = 51;
if ( a < b )
cout << "a < b" << endl;
if ( a > b )
cout << "a > b" << endl;
if ( d <= c )
cout << "d <= c" << endl;
if ( c != d )
cout << "c != d" << endl;
a. a < b
c != d
b. a < b
d <= c
c != d
c. a > b
c != d
d. a < b
c < d
a != b
ANS: a. a < b
c != d
At eight in the morning of the birthday His Majesty left his Palace
in the “Ocean Terrace” and proceeded to the Throne Hall. His
emaciated and woe-begone appearance was such, however, that the
Old Buddha took compassion upon him, and bade his attendant
eunuchs support him to his palanquin, excusing him from further
attendance. Later in the day she issued a special Decree praising
the loyalty of the Dalai Lama, and ordering him to return promptly to
Thibet, “there to extol the generosity of the Throne of China, and
faithfully to obey the commands of the Sovereign power.” The
Empress Dowager spent the afternoon of her birthday in the
congenial amusement of a masquerade, appearing in the costume of
the Goddess of Mercy, attended by a numerous suite of concubines,
Imperial Princesses, and eunuchs, all in fancy dress. They picnicked
on the lake, and Her Majesty appeared to be in the very highest
spirits. Unfortunately, towards evening, she caught a chill, and
thereafter, partaking too freely of a mixture of clotted cream and crab
apples, she had a return of the dysenteric complaint from which she
had suffered all through the summer. On the following day she
attended to affairs of State as usual, reading a vast number of
Memorials and recording her decision thereon, but on the 5th of
November neither she nor the Emperor were sufficiently well to
receive the Grand Council, so that all business of government was
suspended for two days. Upon hearing of Her Majesty’s illness, the
Dalai Lama hastened to present her with an image of Buddha,
which, he said, should be despatched forthwith to her mausoleum at
the hills, the building of which had just been completed under the
supervision of Prince Ch’ing.[127] The high priest urged all haste in
transmitting this miracle-working image to her future burial-place; if it
were done quickly, he said, her life would be prolonged by many
years, because the unlucky conjunction of the stars now affecting
her adversely would avail nothing against the magic power of this
image. The Old Buddha was greatly reassured by the Dalai Lama’s
cheerful prognostications, and next morning held audience as usual.
She commanded Prince Ch’ing to proceed without delay to the
tombs, and there to deposit the miraculous image on the altar.[128]
She ordered him to pay particular attention to the work done at the
mausoleum, and to make certain that her detailed instructions had
been faithfully carried out. Prince Ch’ing demurred somewhat at
these instructions, inquiring whether she really wished him to leave
Peking at a time when she herself and the Emperor were both ill. But
the Old Buddha would brook no argument, and peremptorily ordered
him to proceed as instructed. “I am not likely to die,” she said,
“during the next few days; already I am feeling much better. In any
case you will do as you are told.” On Monday, November 9th, both
the Empress Dowager and the Emperor were present at a meeting
of the Grand Council, and a special audience was given to the
Educational Commissioner of Chihli province, about to leave for his
post. At this audience the Old Buddha spoke with some bitterness of
the increasing tendency of the student class to give vent to
revolutionary ideas, and she commanded the Commissioner of
Education to do all in his power to check their political activities.
Shortly afterwards four more physicians, who had come up from
the provinces, were admitted to see His Majesty. That same
afternoon he had a serious relapse, and from that day forward never
left his palace. On the following morning he sent a dutiful message
(or it was sent for him) enquiring after the Empress Dowager’s
health, she being also confined to her room and holding no
audiences. The Court physicians reported badly of both their
Imperial patients: being fearful as to the outcome, they begged the
Comptroller-General of the Household to engage other physicians in
their place. The Grand Council sent a message to Prince Ch’ing,
directing him to return to Peking with all haste, his presence being
required forthwith on matters of the highest importance. Travelling
night and day, he reached the capital at about eight o’clock in the
morning of the 13th, and hastened to the palace. He found the Old
Buddha cheerful and confident of ultimate recovery, but the Emperor
was visibly sinking, his condition being comatose, with short lucid
intervals. His last conscious act had been to direct his Consort to
inform the Empress Dowager that he regretted being unable to
attend her, and that he hoped that she would appoint an Heir
Apparent without further delay. Whether these dutiful messages
were spontaneous or inspired, and indeed, whether they were ever
sent by the Emperor, is a matter upon which doubt has been freely
expressed.
Immediately after the arrival of Prince Ch’ing, an important
audience was held in the Hall of Ceremonial Phœnixes. Her Majesty
was able to mount the Throne, and, although obviously weak, her
unconquerable courage enabled her to master her physical ailments,
and she spoke with all her wonted vehemence and lucidity. A well-
informed member of the Grand Council, full of wonder at such an
exhibition of strength of will, has recorded the fact that she
completely led and dominated the Council. There were present
Prince Ch’ing, Prince Ch’un, the Grand Councillor Yüan Shih-k’ai,
and the Grand Secretaries Chang Chih-tung, Lu Ch’uan-lin and Shih
Hsü.
Her Majesty announced that the time had come to nominate an
Heir to the Emperor T’ung-Chih, in accordance with that Decree of
the first day of the reign of Kuang-Hsü, wherein it was provided that
the deceased Sovereign’s ancestral rites should be safeguarded by
allowing him precedence over his successor of the same generation.
Her choice, she said, was already made, but she desired to take the
opinion of the Grand Councillors in the first instance. Prince Ch’ing
and Yüan Shih-k’ai then recommended the appointment of Prince
P’u Lun, or, failing him, Prince Kung. They thought the former, as
senior great-grandson of Tao-Kuang, was the more eligible
candidate, and with this view Prince Ch’un seemed disposed to
agree. The remaining Grand Councillors, however, advised the
selection of Prince Ch’un’s infant son.
After hearing the views of her Councillors, the Old Buddha
announced that long ago, at the time when she had betrothed the
daughter of Jung Lu to Prince Ch’un, she had decided that the eldest
son of this marriage should become Heir to the Throne, in
recognition and reward of Jung Lu’s lifelong devotion to her person,
and his paramount services to the Dynasty at the time of the Boxer
rising. She placed on record her opinion that he had saved the
Manchus by refusing to assist in the attack upon the Legations. In
the 3rd Moon of this year she had renewed her pledge to Jung Lu’s
widow, her oldest friend, just before she died. She would, therefore,
now bestow upon Prince Ch’un as Regent, the title of “Prince co-
operating in the Government,” a title one degree higher than that
which had been given to Prince Kung in 1861, who was made
“Adviser to the Government” by herself and her co-Regent.
The Son of Heaven. H.M. Hsüan-T’ung, Emperor of China.
Upon hearing this decision, Prince Ch’un arose from his seat and
repeatedly kowtowed before Her Majesty, expressing a deep sense
of his own unworthiness. Once more Yüan Shih-k’ai courageously
advanced the superior claims of Prince P’u Lun: he was sincerely of
opinion that the time had come for the succession to be continued
along the original lines of primogeniture; it was clear also that he fully
realised that Prince Ch’un was his bitter enemy. The Old Buddha
turned upon him with an angry reprimand. “You think.” she said, “that
I am old, and in my dotage, but you should have learned by now that
when I make up my mind nothing stops me from acting upon it. At a
critical time in a nation’s affairs a youthful Sovereign is no doubt a
source of danger to the State, but do not forget that I shall be here to
direct and assist Prince Ch’un.” Then, turning to the other
Councillors, she continued:—“Draft two Decrees at once, in my
name, the first, appointing Tsai-feng, Prince Ch’un, to be ‘Prince co-
operating in the Government’ and the second commanding that P’u
Yi, son of Prince Ch’un, should enter the palace forthwith, to be
brought up within the precincts.” She ordered Prince Ch’ing to inform
the Emperor of these Decrees.
Kuang-Hsü was still conscious, and understood what Prince
Ch’ing said to him. “Would it not have been better,” he said, “to
nominate an adult? No doubt, however, the Empress Dowager
knows best.” Upon hearing of the appointment of Prince Ch’un to the
Regency, he expressed his gratification. This was at 3 p.m.; two
hours later the infant Prince had been brought into the Palace, and
was taken by his father to be shown both to the Empress Dowager
and the Emperor. At seven o’clock on the following morning the
physicians in attendance reported that His Majesty’s “nose was
twitching and his stomach rising,” from which signs they knew that
his end was at hand. During the night, feeling that death was near,
he had written out his last testament, in a hand almost illegible,
prefacing the same with these significant words:—
At the close of a long and exciting day, Her Majesty retired to rest
on the 14th of November, weary with her labours but apparently
much improved in health. Next morning she arose at her usual hour,
6 a.m., gave audience to the Grand Council and talked for some time
with the late Emperor’s widow, with the Regent and with his wife, the
daughter of Jung Lu. By a Decree issued in the name of the infant
Emperor, she assumed the title of Empress Grand Dowager, making
Kuang-Hsü’s widow Empress Dowager. Elaborate ceremonies were
planned to celebrate the bestowal of these new titles, and to
proclaim the installation of the Regent. Suddenly, at noon, while
sitting at her meal, the Old Buddha was seized with a fainting fit, long
and severe. When at last she recovered consciousness, it was clear
to all that the stress and excitement of the past few days had brought
on a relapse, her strength having been undermined by the long
attack of dysentery. Realising that her end was near, she hurriedly
summoned the new Empress Dowager, the Regent and the Grand
Council to the Palace, where, upon their coming together, she
dictated the following Decree, speaking in the same calm tones
which she habitually used in transacting the daily routine of
Government work:—