Problem Solving with C++ 9th Edition Savitch Test Bank - Read Directly Or Download With One Click
Problem Solving with C++ 9th Edition Savitch Test Bank - Read Directly Or Download With One Click
_____ Follow the link below to get your download now _____
https://testbankdeal.com/product/problem-solving-with-c-9th-
edition-savitch-test-bank/
https://testbankdeal.com/product/problem-solving-with-c-9th-edition-
savitch-solutions-manual/
https://testbankdeal.com/product/problem-solving-with-c-10th-edition-
savitch-test-bank/
https://testbankdeal.com/product/problem-solving-with-c-10th-edition-
savitch-solutions-manual/
https://testbankdeal.com/product/human-resource-management-5th-
edition-kleiman-test-bank/
IT Strategy 1st Edition McKeen Test Bank
https://testbankdeal.com/product/it-strategy-1st-edition-mckeen-test-
bank/
https://testbankdeal.com/product/abnormal-child-psychology-6th-
edition-mash-wolfe-test-bank/
https://testbankdeal.com/product/principles-of-organizational-
behavior-realities-and-challenges-6th-edition-quick-test-bank/
https://testbankdeal.com/product/invitation-to-health-live-it-now-
brief-edition-9th-edition-dianne-hales-test-bank/
https://testbankdeal.com/product/marketing-research-essentials-8th-
edition-mcdaniel-solutions-manual/
Probability and Statistics for Engineers and Scientists
for Engineers 9th Edition Johnson Solutions Manual
https://testbankdeal.com/product/probability-and-statistics-for-
engineers-and-scientists-for-engineers-9th-edition-johnson-solutions-
manual/
Test Bank for Problem Solving with C++: The Object of Programming, 9/e
Chapter 7 Arrays
TRUE/FALSE
1. The indexed variables (members) of an array must be integers.
ANSWER: FALSE
2. The locations of the various indexed variables in an array can be spread out all
over the memory.
ANSWER: FALSE
3. The following array declaration is legal
double scores[]={0.1,0.2,0.3};
ANSWER: true
4. Arrays can be passed to functions.
ANSWER: TRUE
5. Arrays can be returned from a function.
ANSWER: FALSE
6. If a function is expecting a pass by reference parameter, you can pass an index
variable from an array of the same base type to that function.
ANSWER: TRUE
7. When you have a function that expects an array, it should also expect the size of
the array or the number of indexed variables with valid data.
ANSWER: TRUE
8. The following function declaration guarantees the values in the array argument
are not changed.
ANSWER: FALSE
9. The following function will work with any size integer array.
ANSWER: TRUE
10. If you use the const modifier in a function declaration, you do not include it in the
function definition.
ANSWER: FALSE
Short Answer
1. Write the code to declare a two dimension array of integers with 10 rows and 20
columns.
ANSWER: int array[10][20];
2. Write the code to declare an array of 10 doubles named list;
ANSWER: double list[10];
3. The modifier that guarantees that an array argument will not be changed is called
______.
ANSWER: const
4. How many indexed variables does the following array have?
int myArray[]={1,2,3,6,5,4,7,1,2};
ANSWER: 9
Test Bank for Problem Solving with C++: The Object of Programming, 9/e
Chapter 7 Arrays
d. Nothing.
ANSWER: D
3. Given an array named scores with 25 elements, what is the correct way to access
the 25th element?
a. scores+25
b. scores[24]
c. scores[25]
d. scores[last]
ANSWER: B
4. Why should you use a named constant for the size of an array?
a. Readability of code
b. Makes changes to the program easier
c. Helps reduce logic errors
d. All of the above
ANSWER: D
5. Given an array of integers of size 5, how does the computer know where the 3rd
indexed variable is located?
a. It adds 3 to the base address of the array
b. It adds space for 3 integers to the base address of the array
c. It remembers where all the indexed variables of the array are located.
d. None of the above
ANSWER: B
6. What is wrong with the following code fragment?
const int SIZE =5;
float scores[SIZE];
for(int i=0; i<=SIZE;i++)
{
cout << "Enter a score\n";
cin >> scores[i];
}
a. Array indexes start at 1 not 0
b. Arrays must be integers
c. Array indexes must be less than the size of the array
d. Should be cin >> scores[0];
ANSWER: C
7. Which of the following declare an array of 5 characters, and initializes them to
some known values?
a. char array[5]={'a','b','c','d','e'};
b. char array[4]={'a','b','c','d','e'};
c. char array[5]={''};
d. char array[]={'a','b','d','e'};
e. A and C
f. B and D
g. all of the above
ANSWER: E
Test Bank for Problem Solving with C++: The Object of Programming, 9/e
Chapter 7 Arrays
8. If you declare and initialize an integer array of size 10, but only list 5 values, what
values are stored in the remaining 5 indexed variables?
a. 0
b. garbage
c. 0.0
d. '0'
ANSWER: A
9. Arrays are always passed to a function using
a. pass by value
b. pass by reference
c. pass by array
d. you cannot pass arrays to a function
ANSWER: C
10. Give the following declarations, which of the following is a legal call to this
function?
int myFunction(int myValue);
int myArray[1000];
a. cout << myFunction(myArray);
b. cout << myFunction(myArray[0]);
c. myArray = myFunction(myArray);
d. myArray[1] = myFunction(myArray[0]);
e. A and B
f. A and C
g. B and D
ANSWER: G
11. Which of the following function declarations correctly expect an array as the first
argument?
a. void f1(int array, int size);
b. void f1(int& array, int size);
c. void f1(int array[100], int size);
d. void f1(float array[], int size);
e. All of the above
f. C and D
g. A and B
ANSWER: F
12. Which of the following function declarations correctly guarantee that the function
will not change any values in the array argument?
a. void f1(int array[], int size) const;
b. void f1(int array[], int size);
c. void f1(int &array, int size);
d. void f1(const int array[], int size);
e. void f1(int array[], const int size);
ANSWER: D
13. The following function definition has an error in it. What line is this error on?
Test Bank for Problem Solving with C++: The Object of Programming, 9/e
Chapter 7 Arrays
17. Given the following function definition, will repeated calls to the search function
for the same target find all occurrences of that target in the array?
int search(const int array[], int target, int numElements)
{
int index=0;
bool found=false;
for(index2=0;index2<4;index2++)
cout << array[index1][index2] << " ";
cout << endl;
}
a. 0 1 2 3
1234
2345
3456
b. 0 1 2 3
0123
0123
0123
c. 0 0 0 0
1111
2222
3333
d. 0 0 0 0
0123
0246
0369
ANSWER: A
24. Which of the following correctly declare an array that can hold up to 3 rows of 5
columns of doubles?
a. int array[3],[5];
b. int array[3][5];
c. float array[3][5];
d. float array[3,5];
ANSWER: C
25. Which of the following function declarations can be passed the following array?
char myArray[6][8];
a. void f1(char a[][], int sizeOfFirst);
b. void f1(char a[][8], int sizeOfFirst);
c. void f1(char& a, int sizeOfFirst);
d. void f1(char a[6][8], int sizeOfFirst);
e. B and D
f. A and D
ANSWER: E
26. A two dimension array can also be thought of as
a. a table
b. an array of arrays
c. a file
d. none of the above
e. A and C
f. A and B
ANSWER: F
Test Bank for Problem Solving with C++: The Object of Programming, 9/e
Chapter 7 Arrays
27. Which of the following will correctly assign all the values in one array to the
other array? (Assume both arrays are of the same type and have SIZE elements)
a. array1=array2;
b. array1[]=array2;
c. for(i=0;i<SIZE;i++)
array1[i]=array2[i];
d. for(i=0;i<SIZE;i++)
array1[]=array2[];
ANSWER: C
28. Which of the following will read values from the keyboard into the array?
(Assume the size of the array is SIZE).
a. cin >> array;
b. cin >> array[];
c. cin >> array[SIZE];
d. for(i=0;i<SIZE;i++)
cin >> array[i];
ANSWER: D
29. Which of the following correctly uses C++11’s range-based for statement to
iterate through every element of the array variable arr?
a. for (auto x : arr)
b. foreach (x in arr)
c. for (auto x; x < arr.length; x++)
d. for x in arr
ANSWER: A
30. What is the output of this code?
int arr[] = { 1, 2, 3};
for (int &element : arr)
element+=10;
for (int element : arr)
cout << element << endl;
a. 1 2 3
b. 11 12 13
ANSWER: B
31. What is the output of this code?
int arr[] = { 1, 2, 3};
for (int element : arr)
element+=10;
for (int element : arr)
cout << element << endl;
a. 1 2 3
b. 11 12 13
ANSWER: A
Other documents randomly have
different content
The Project Gutenberg eBook of Arkansasin
sissit: Seikkailuromaani suurilta
ruoholakeuksilta
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: Finnish
ARKANSASIN SISSIT
Seikkailuromaani suurilta ruoholakeuksilta
Kirj.
GUSTAVE AIMARD
Niilo K. Nordström
Hämeenlinnassa, Arvi A. Karisto Oy, 1920.
SISÄLLYS:
Esipuhe.
Johdanto. Kirottu:
I. Hermosillo.
II. Hacienda del Milagro.
III. Tuomio.
IV. Äiti.
I. Uskollinen Sydän:
I. Preirie.
II. Metsästäjät.
III. Jäljet.
IV. Matkalaiset.
V. Comanchit.
VI. Pelastaja.
VII. Yllätys.
VIII. Kosto.
IX. Aave.
X. Varustettu leiri.
XI. Kauppa.
XII. Sielullista
XIII. Mehiläismetsästys.
XIV. Musta Hirvi
XV. Majavat.
XVI. Petos.
XVII. Kotkanpää.
XVIII. Eusebio.
XIX. Päällikköjen neuvottelu.
XX. Kidutus.
II. Tappaja:
I. Uskollinen Sydän.
II. Preirierosvot.
III. Uhraus.
IV. Tohtori.
V. Liitto.
VI. Viimeinen hyökkäys.
VII. Taistelu.
VIII. Verdi Gris-joen luola.
IX. Oveluutta.
X. Rakkaus.
XI. Vangit.
XII. Sotajuoni.
XIII. Preirielaki.
XIV. Rangaistus.
XV. Anteeksianto.
Loppusanat.
Esipuhe.
V. H.-A.
JOHDANTO: KIROTTU
I
Hermosillo
Muuan nuori mies, tai pikemminkin lapsi, sillä hän oli tuskin
kuudentoista vanha, tuli näkyviin tuulispäänä ratsastaen hurjaa
laukkaa puolivillin ratsun selässä.
"Sitten hän yritti tietysti paeta", jatkoi toinen. "Cornejo aikoi hänet
pidättää…"
Kaksoisovien kautta päästiin saliin. Pihalle päin oleva puoli oli noin
jalan verran muuta lattiaa ylempänä; sitä peitti matto, jolla oli
muutamia matalia, omituisilla puuleikkauksilla ja karmosiininvärisellä
veralla päällystettyjä jakkaroita ja jalkapieluksia. Tässä huoneessa oli
myöskin pieni, neliskulmainen, noin puolen metrin korkuinen pöytä,
jota käytettiin ompelupöytänä; se osa oli tarkoitettu naisia varten,
jotka siellä istuivat maurilaisten tapaan jalat ristissä. Toisella puolella
oli samanlaisella veralla kuin jakkarat ja jalkapielukset päällystettyjä
tuoleja. Vastapäätä ovea salin toisella puolella oli makuuhuone
vuodekomeroineen korokkeen päässä, jolle oli sijoitettu juhlavuode,
ja tätä kaunistivat lukemattomat kultauskoristeet sekä kulta- ja
hopeanauhuksilla ja tupsuilla kirjaillut verhot. Lakanat ja
päänalaisten päälliset olivat valmistetut mitä hienoimmasta
kankaasta, ja niitä reunusti pitsi.
Hän oli ylhäisen näköinen herra, jolla oli hoikka, sorea, hiukan
notkoselkäinen, mutta varsin suhteellinen vartalo; hänen hienot
kasvonpiirteensä, joissa oli lujuutta ja varmuutta, todistivat
vilpittömyyttä, rohkeutta ja ennen kaikkea rautaista tahtoa. Hänen
suuret, mustat silmänsä, jotka olivat tuuheitten kulmakarvojen
varjossa, olivat verrattoman kauniit, mutta heti kun tavallista
suurempi vastoinkäyminen nosti hänen ruskettuneelle iholleen
punertavan kajastuksen, kävi hänen katseensa kiinteäksi ja niin
voimakkaaksi, ettei kukaan voinut sitä kestää, vaan se pani
rohkeimmankin epäröimään ja vapisemaan.
Mitä don Ramóniin tulee, niin hän oli aina hyvä ja huomaavainen
vaimolleen, jota hän ei ollut vaivautunut tutkistelemaan, ja niin
hänellä oli oikeus pitää vaimoaan maailman onnellisimpana olentona,
jollainen tämä olikin senjälkeen, kun Jumala oli suonut hänen tulla
äidiksi.
testbankdeal.com