C++ Programming From Problem Analysis to Program Design 6th Edition Malik Test Bank - Complete Set Of Chapters Available For One-Click Download
C++ Programming From Problem Analysis to Program Design 6th Edition Malik Test Bank - Complete Set Of Chapters Available For One-Click Download
https://testbankdeal.com/product/c-programming-from-problem-analysis-
to-program-design-6th-edition-malik-solutions-manual/
https://testbankdeal.com/product/c-programming-from-problem-analysis-
to-program-design-7th-edition-malik-test-bank/
https://testbankdeal.com/product/c-programming-from-problem-analysis-
to-program-design-8th-edition-malik-test-bank/
https://testbankdeal.com/product/pearsons-federal-
taxation-2018-comprehensive-31st-edition-rupert-solutions-manual/
Basic Immunology Functions and Disorders of the Immune
System 4th Edition Abbas Test Bank
https://testbankdeal.com/product/basic-immunology-functions-and-
disorders-of-the-immune-system-4th-edition-abbas-test-bank/
https://testbankdeal.com/product/nonlinear-systems-3rd-edition-khalil-
solutions-manual/
https://testbankdeal.com/product/busn-5-5th-edition-kelly-test-bank/
https://testbankdeal.com/product/guide-to-sql-9th-edition-pratt-
solutions-manual/
https://testbankdeal.com/product/mf-4th-edition-knox-test-bank/
Psychology 1st Edition Marin Test Bank
https://testbankdeal.com/product/psychology-1st-edition-marin-test-
bank/
Chapter 8: Arrays and Strings
TRUE/FALSE
2. The array index can be any integer less than the array size.
3. The statement int list[25]; declares list to be an array of 26 components, since the array
index starts at 0.
4. Given the declaration int list[20]; the statement list[12] = list[5] + list[7];
updates the content of the twelfth component of the array list.
5. Suppose list is a one dimensional array of size 25, wherein each component is of type int. Further,
suppose that sum is an int variable. The following for loop correctly finds the sum of the elements
of list.
sum = 0;
6. If an array index goes out of bounds, the program always terminates in an error.
7. Arrays can be passed as parameters to a function by value, but it is faster to pass them by reference.
8. When you pass an array as a parameter, the base address of the actual array is passed to the formal
parameter.
9. The one place where C++ allows aggregate operations on arrays is the input and output of C-strings.
MULTIPLE CHOICE
1. Which of the following statements declares alpha to be an array of 25 components of the type int?
a. int alpha[25]; c. int alpha[2][5];
b. int array alpha[25]; d. int array alpha[25][25];
ANS: A PTS: 1 REF: 507-508
2. Assume you have the following declaration char nameList[100];. Which of the following
ranges is valid for the index of the array nameList?
a. 0 through 99 c. 1 through 100
b. 0 through 100 d. 1 through 101
ANS: A PTS: 1 REF: 509
3. Assume you have the following declaration int beta[50];. Which of the following is a valid
element of beta?
a. beta['2'] c. beta[0]
b. beta['50'] d. beta[50]
ANS: C PTS: 1 REF: 509
4. Assume you have the following declaration double salesData[1000];. Which of the following
ranges is valid for the index of the array salesData?
a. 0 through 999 c. 1 through 1001
b. 0 through 1000 d. 1 through 1000
ANS: A PTS: 1 REF: 509
5. Suppose that sales is an array of 50 components of type double. Which of the following correctly
initializes the array sales?
a. for (int 1 = 1; j <= 49; j++)
sales[j] = 0;
b. for (int j = 1; j <= 50; j++)
sales[j] = 0;
c. for (int j = 0; j <= 49; j++)
sales[j] = 0.0;
d. for (int j = 0; j <= 50; j++)
sales[j] = 0.0;
ANS: C PTS: 1 REF: 512
6. Suppose that list is an array of 10 components of type int. Which of the following codes correctly
outputs all the elements of list?
a. 0 1 2 3 4 c. 0 5 10 15 20
b. 0 5 10 15 d. 5 10 15 20
ANS: C PTS: 1 REF: 512
int alpha[5];
int j;
a. 1 c. 5
b. 4 d. 6
ANS: C PTS: 1 REF: 512
a. 2 4 6 8 10 c. 8 6 4 2 0
b. 4 3 2 1 0 d. 10 8 6 4 2
ANS: D PTS: 1 REF: 512
a. 0 5 10 15 20 c. 5 10 15 20 20
b. 5 10 15 20 0 d. Code results in index out-of-bounds
ANS: D PTS: 1 REF: 515-516
11. Suppose that gamma is an array of 50 components of type int and j is an int variable. Which of the
following for loops sets the index of gamma out of bounds?
a. for (j = 0; j <= 49; j++)
cout << gamma[j] << " ";
b. for (j = 1; j < 50; j++)
cout << gamma[j] << " ";
c. for (j = 0; j <= 50; j++)
cout << gamma[j] << " ";
d. for (j = 0; j <= 48; j++)
cout << gamma[j] << " ";
ANS: C PTS: 1 REF: 515-516
12. Consider the following declaration: int alpha[5] = {3, 5, 7, 9, 11};. Which of the
following is equivalent to this statement?
a. int alpha[] = {3, 5, 7, 9, 11};
b. int alpha[] = {3 5 7 9 11};
c. int alpha[5] = [3, 5, 7, 9, 11];
d. int alpha[] = (3, 5, 7, 9, 11);
ANS: A PTS: 1 REF: 516
14. Which of the following correctly declares name to be a character array and stores "William" in it?
a. char name[6] = "William";
b. char name[7] = "William";
c. char name[8] = "William";
d. char name[8] = 'William';
ANS: C PTS: 1 REF: 536
15. Consider the following declaration: char str[15];. Which of the following statements stores
"Blue Sky" into str?
a. str = "Blue Sky";
b. str[15] = "Blue Sky";
c. strcpy(str, "Blue Sky");
d. strcpy("Blue Sky");
ANS: C PTS: 1 REF: 537
16. Consider the following declaration:
char charArray[51];
char discard;
cin.get(charArray, 51);
cin.get(discard);
17. Consider the following statement: double alpha[10][5];. The number of components of
alpha is ____.
a. 15 c. 100
b. 50 d. 150
ANS: B PTS: 1 REF: 544
18. Consider the statement int list[10][8];. Which of the following about list is true?
a. list has 10 rows and 8 columns.
b. list has 8 rows and 10 columns.
c. list has a total of 18 components.
d. list has a total of 108 components.
ANS: A PTS: 1 REF: 544
19. Consider the following statement: int alpha[25][10];. Which of the following statements about
alpha is true?
a. Rows of alpha are numbered 0...24 and columns are numbered 0...9.
b. Rows of alpha are numbered 0...24 and columns are numbered 1...10.
c. Rows of alpha are numbered 1...24 and columns are numbered 0...9.
d. Rows of alpha are numbered 1...25 and columns are numbered 1...10.
ANS: A PTS: 1 REF: 544
20. Which of the following correctly declares and initializes alpha to be an array of four rows and three
columns with the component type int?
a. int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
b. int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
c. int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};
d. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};
ANS: D PTS: 1 REF: 546
21. After the following statements execute, what are the contents of matrix?
int matrix[3][2];
int j, k;
a. 0 0 c. 0 1
1 1 1 2
2 2 2 3
b. 0 1 d. 1 1
2 3 2 2
4 5 3 3
ANS: C PTS: 1 REF: 548-550
int j;
int sum;
double sale[10][7];
which of the following correctly finds the sum of the elements of the fifth row of sale?
a. sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[5][j];
b. sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[4][j];
c. sum = 0;
for(j = 0; j < 10; j++)
sum = sum + sale[5][j];
d. sum = 0;
for(j = 0; j < 10; j++)
sum = sum + sale[4][j];
ANS: B PTS: 1 REF: 550
int j;
int sum;
double sale[10][7];
which of the following correctly finds the sum of the elements of the fourth column of sale?
a. sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[j][3];
b. sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[j][4];
c. sum = 0;
for(j = 0; j < 10; j++)
sum = sum + sale[j][4];
d. sum = 0;
for(j = 0; j < 10; j++)
sum = sum + sale[j][3];
ANS: D PTS: 1 REF: 551
25. A collection of a fixed number of elements (called components) arranged in n dimensions (n>=1) is
called a(n) ____.
a. matrix c. n-dimensional array
b. vector d. parallel array
ANS: C PTS: 1 REF: 557
COMPLETION
1. A data type is called ____________________ if variables of that type can store only one value at a
time.
ANS: simple
2. In a(n) ____________________ data type, each data item is a collection of other data items.
ANS: structured
double sales[10];
int index;
ANS: sales[index]
4. The word ____________________ is used before the array declaration in a function heading to
prevent the function from modifying the array.
ANS: const
5. The ____________________ of an array is the address (that is, the memory location) of the first array
component.
ANS: base address
6. The ____________________ sort algorithm finds the location of the smallest element in the unsorted
portion of the list and moves it to the top of the unsorted portion of the list.
ANS: selection
7. For a list of length n, the ____________________ sort makes exactly (n(n - 1))/2 key
comparisons and 3(n-1) item assignments.
ANS: selection
ANS:
12
twelve
9. The function ____________________ returns the length of the string s, excluding the null character.
ANS: strlen(s)
ANS: 15
11. The following statements store the value ____________________ into len.
int len;
len = strlen("Sunny California");
ANS: 16
12. The header file string contains the function ____________________,which converts a value of type
string to a null-terminated character array.
ANS: c_str
PTS: 1 REF: 541
13. Two (or more) arrays are called ____________________ if their corresponding components hold
related information.
ANS: parallel
int alpha[10][25];
ANS:
10
ten
15. In the following declaration, the array gamma has ____________________ components.
int gamma[5][6][10];
ANS:
300
three hundred
Language: English
BY
ALLEN CHAPMAN
AUTHOR OF “THE HEROES OF THE SCHOOL,” “NED WILDING’S
DISAPPEARANCE,” “FRANK ROSCOE’S SECRET,” “FENN
MASTERSON’S DISCOVERY,” “BART KEENE’S
HUNTING DAYS,” ETC., ETC.
Copyright, 1907, by
Cupples & Leon Company
CONTENTS
CHAPTER PAGE
I. Waking Up 1
II. A Five-Dollar Job 11
III.A Business Call 19
IV. A Break for Liberty 28
V. The Balloonist’s Rescue 37
VI. “Mail Order Frank” 51
VII. Strictly Business 57
VIII. A Step Forward 67
IX. Sense and System 76
X. A Visit To the City 87
XI. A Friend in Need 99
XII. A Boy With a Mystery 109
XIII. A Good Start 117
XIV. A Mean Enemy 126
XV. A Piece of Chalk 133
XVI. “Frank’s Mail Order House” 143
XVII. A Nest Egg 153
XVIII. A Suspicious Visitor 162
XIX. Missing 169
XX. A Bad Business 176
XXI. An Unexpected Meeting 185
XXII. Good News 194
XXIII. A Rival Concern 200
XXIV. An Unwelcome Visitor 206
XXV. Trouble Brewing 213
XXVI. Mysterious Stet 219
XXVII. The Post-Office Inspector 225
XXVIII. A Heart of Gold 232
XXIX. Conclusion 237
BOUND TO SUCCEED
CHAPTER I
WAKING UP
Frank watched Dorsett dismount from the gig and tie his horse.
He realized that he would be up into the insurance man’s office in a
few minutes.
“I must do something, and quickly,” thought Frank. “The second
that man sees me he will suspect my mission here. He is a person of
substance, and will carry weight. I shall be left if he gets into action
first.”
Frank reflected rapidly. The old clerk, as he had already found out,
was unapproachable. Frank was seized with a wild impulse to leap
over the wire railing and rush past the clerk to the door of Mr. Pryor’s
private office.
“Maybe it’s locked, though,” said Frank. “No, I won’t do that. I
don’t see that I can do much of anything, except to wait and take
my chance of getting the check into Mr. Pryor’s hands before Mr.
Dorsett guesses what’s up.”
Frank glanced at the clock. It showed ten minutes to eleven. He
went out into the hall and drew back into the shelter of a big fuel
box there.
Dorsett came up the stairs, buggy whip in hand. He bustled into
the office in his usual self-important way. Frank noticed that the old
clerk sat down on him promptly. He was not one bit impressed with
the bombastic visitor from Greenville.
Dorsett scowled as the clerk pointed to the clock, and impatiently
fumbling the whip, sat down with the others in the office to await
the royal pleasure of its closeted proprietor.
Frank did a lot of thinking. He planned all kinds of wild dashes
when the door of that private office should open. Then, happening
to stroll down the hall, a new idea was suggested to him.
“Would it win?” Frank breathlessly asked himself.
He had come out on a little landing. This was that platform of
stairs running down into the rear of the lot that the bank and the
insurance office occupied.
Six feet away from it to the left were two windows. They were
both open. The low hum of voices reached Frank’s ears. Judging
from the situation of the apartment beyond, Frank was sure that he
had located the insurance man’s private room.
“I wonder if I dare?” he challenged himself. “I wonder if it would
work?”
His eyes snapped and his fingers tingled. Then Frank studied the
outlook more carefully. He calculated first his chances of getting to
the first window. He also planned just what he would say in the way
of explanation and apology once he reached it.
Two feet away from the platform a lightning rod ran straight up
the building. Frank seized this. He fearlessly swung himself free of
the platform, bracing his toes on a protending joint of the rod.
At the side of the nearest window, top and bottom, were two
hinge standards. They had been imbedded in the solid masonry
when the place was built to hold iron shutters, if such were ever
needed. The bank floor below was guarded with these, but none had
been put in place on the upper story.
Frank swung one hand free, and bending to a rather risky angle
hooked a forefinger around the upper one of these standards. At the
same time he gave his body a swing clear of his footing.
He aimed to land his feet on the sill of the nearest window. In this
Frank succeeded. There was no time, however, to chance losing the
foothold thus gained. He promptly slid his free hand down under the
frame of the raised window. He got a firm clutch. Relaxing his hold
of the hinge standard, he stooped.
The next moment, on a decidedly reckless and awkward balance,
Frank tumbled rather than dropped inside of the room that was his
objective point of assault.
“Hello! what’s this?” instantly hailed him.
Frank nimbly gained an upright position. He faced two men who,
seated at a table covered with papers, began to push back their
chairs in a somewhat startled way. They stared hard at the intruder.
Frank promptly doffed his cap. He made his most courteous bow.
“Excuse me, gentlemen,” he said in a rather flustrated way, “but
which is Mr. Pryor, please?”
“I am Pryor,” answered one of the twain, and Frank saw from the
gathering frown on the speaker’s face that a storm was brewing
unless he headed it off summarily.
“I must beg your pardon, Mr. Pryor,” said Frank, “but it is a matter
of some business importance. I have been waiting for over an hour
to see you. It won’t take but a moment, sir,” and Frank swiftly
produced the check and the receipt entrusted to him by Mr. Buckner.
Before Pryor realized it, they were thrust into his hands and he was
looking at them.
“Oh, this can wait,” he said pettishly. “I don’t like this kind of an
intrusion, young man.”
“I am very sorry, Mr. Pryor,” interrupted Frank in a gentle, polite
tone, “but I am only a paid messenger, and I promised Mr. Buckner
to be back with that receipt at a certain time.”
“So you seized the bull by the horns,” broke in Pryor’s companion
with a great chuckle. “And outwitted old Grumper, the clerk, ha! ha!
Pryor, nail the boy on a year’s contract. He’s got the making in him
of a first-class insurance solicitor, in his originality, daring and—”
“Cheek,” muttered Pryor. “Well, well—here’s your receipt.”
Frank seized the paper that Pryor signed with a swift scrawl of the
pen, with an eagerness that was a kind of delighted rapture.
“Oh, thank you, sir,” he said, “and a thousand apologies for my
rude intrusion.”
“Hold on,” ordered Pryor, as Frank returned towards the window.
“Yes, unless you carry extra accident insurance,” put in Pryor’s
companion. “You might not find it so easy getting out of that window
as you did getting in, young fellow.”
Mr. Pryor had gone to the clouded glass door, which Frank knew
opened into the main office. He slipped its catch and opened it.
Frank understood that he was to pass out that way. He started
forward, making a deferential bow to his host.
“Hi, I say, Pryor—one minute!” sounded a voice in the outer office,
and Frank wondered what was about to happen as he recognized
the tones as belonging to Dorsett.
“In a few minutes,” responded Pryor, with an impatient wave of his
hand.
“All right. It’s about the salvage business, you know,” went on
Dorsett from behind the wire grating. “Want to pay you the money
and close up the deal.”
“Oh, that?” spoke Pryor, with a sudden glance at Frank and a grim
twinkle in his eyes. “You young schemer!” he said to Frank in an
undertone, with a slight chuckle. “I understand your peculiar tactics,
now. You’ll do, decidedly, young man!”
Frank tried to look all due humility, but he could not entirely
suppress a satisfied smile. As he passed out Pryor said to Dorsett:
“You are too late on that matter. I have just closed the salvage
business with Buckner of Greenville.”
“You’ve what?” howled Dorsett, with a violent start. “Why, I’m
here first. No one passed me on the road. I—er, hum”—Dorsett
turned white as his eye fell on Frank. He glared and shook his
driving whip.
The animated and interested friend of Pryor stuck his head past
the open doorway.
“I say, youngster,” he asked guardedly, his face all a-grin, “how did
you circumvent the old chap?”
“Well, I nearly swam part of the way,” explained Frank. “Thank
you, Mr. Pryor,” he added, as the latter opened the wire gate for him
to pass out.
The old clerk had sprung to his feet, gaping in consternation at
him. Pryor’s friend was convulsed with internal mirth. Pryor himself
did not look altogether displeased at the situation.
Frank thought that Dorsett would actually leap upon him and
strike him with the whip. The latter, however, with a hoarse growl in
his throat, allowed Frank to proceed on his way unhindered.
“We shall hear from this of course—my mother and I,” said the
youth to himself as he gained the street. “Mr. Dorsett will store this
up against me, hard. All right—I’ve done my simple duty and I’ll
stand by the results.”
A minute later, looking back the way he had come, Frank saw
Dorsett come threshing out into the street. He kicked a dog out of
his path, rudely jostled a pedestrian, jumped into the gig and went
tearing down the homeward road plying the whip and venting his
cruel rage on the poor animal in the shafts.
Frank started back towards Greenville the way he had come. He
was greatly pleased at his success, and cheeringly anticipated the
good the five dollars would do his mother and himself.
As Frank passed the spot where he had noticed the barefooted,
mud-bespattered urchin lying asleep by the side of the ditch, he
could find no trace of the lad.
A little farther on Frank came in sight of the high board fence he
had so curiously observed on his way to Riverton.
The wind was his way, and as he approached the queer barrier he
was somewhat astonished at a great babel of canine barking and
howls that greeted his ears.
“Sounds like a kennel,” he reflected, “but’s a big one. Why, if there
isn’t the little fellow with the package of meat.”
Frank wonderingly regarded a tattered, forlorn figure at a distance
seeming to be glued right up face forward against the fence.
The boy had piled two or three big boulders on top of one
another. These he had surmounted, and was peering through a high
up crack or knot hole in the fence.
On one arm he carried the newspaper package Frank had noticed.
Bit by bit he poised its contents, hurling them over the fence.
A loud clamor of yelps and barkings would greet this shower of
food. Frank drew nearer, mightily interested.
The little fellow would throw over a bone and peer inside the
enclosure.
“Get it, Fido!” Frank heard him shout. “They won’t let him—those
big ones,” he wailed. “Oh, you dear, big fellow, help him, help him.
No, they won’t let him. Fido, Fido, Oh, my! oh my!”
The little fellow slipped down to a seat on the boulders now and
began to cry as if his heart would break. Frank approached and
pulled at his arm.
“Hi, youngster,” he challenged, “what in the world are you up to,
anyhow?”
CHAPTER IV
A BREAK FOR LIBERTY
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.
testbankdeal.com