Starting Out with C++ From Control Structures through Objects Brief Version 9th Edition Gaddis Test Bankinstant download
Starting Out with C++ From Control Structures through Objects Brief Version 9th Edition Gaddis Test Bankinstant download
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-brief-version-9th-edition-gaddis-test-
bank/
We believe these products will be a great fit for you. Click
the link to download now, or visit testbankfan.com
to discover even more!
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-brief-version-9th-edition-gaddis-
solutions-manual/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-brief-version-8th-edition-gaddis-test-
bank/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-7th-edition-tony-gaddis-test-bank/
https://testbankfan.com/product/biopsychology-8th-edition-pinel-
test-bank/
Guide to Computer Forensics and Investigations 4th
Edition Nelson Solutions Manual
https://testbankfan.com/product/guide-to-computer-forensics-and-
investigations-4th-edition-nelson-solutions-manual/
https://testbankfan.com/product/shelly-cashman-series-microsoft-
office-365-and-access-2016-intermediate-1st-edition-pratt-test-
bank/
https://testbankfan.com/product/modern-principles-of-
economics-3rd-edition-cowen-test-bank/
https://testbankfan.com/product/journey-of-adulthood-8th-edition-
bjorklund-solutions-manual/
https://testbankfan.com/product/calculus-single-variable-
canadian-8th-edition-adams-solutions-manual/
Economics 4th Edition Krugman Test Bank
https://testbankfan.com/product/economics-4th-edition-krugman-
test-bank/
Starting Out with C++ from Control Structures to Objects, 9e (Gaddis)
Chapter 7 Arrays and Vectors
TRUE/FALSE
1. The amount of memory used by an array depends on the array's data type and the number of elements
in the array.
ANS: T
ANS: F
3. When you pass an array as an argument to a function, the function can modify the contents of the
array.
ANS: T
ANS: F
5. If you attempt to store data past an array's boundaries, it is guaranteed to cause a compiler error.
ANS: F
6. An individual array element can be processed like any other type of C++ variable.
ANS: T
7. In C++11 you cannot use a range-based for loop to modify the contents of an array unless you
declare the range variable as a reference variable.
ANS: T
8. In C++11 the range-based for loop is best used in situations where you need the element subscript for
some purpose.
ANS: F
9. Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.
ANS: F
10. Each individual element of an array can be accessed by the array name and the element subscript.
ANS: T
11. If an array is partially initialized, the uninitialized elements will be set to zero.
ANS: T
ANS: F
13. Assume array1 and array2 are the names of two arrays. To assign the contents of array2 to
array1, you would use the following statement:
array1 = array2;
ANS: F
14. A vector object automatically expands in size to accommodate the items stored in it.
ANS: T
MULTIPLE CHOICE
3. To access an array element, use the array name and the element's ___________.
a. data type
b. subscript
c. value
d. name
e. None of these
ANS: B
4. By using the same ___________ you can build relationships between data stored in two or more
arrays.
a. array name
b. data types
c. subscript
d. arguments
e. None of these
ANS: C
5. The name of an array stores the __________ of the first array element.
a. value
b. memory address
c. element number
d. data type
e. None of these
ANS: B
10. An array's size declarator must be a __________ with a value greater than __________.
a. number, one
b. number, zero
c. constant integer expression, zero
d. variable, -1
e. None of these
ANS: C
a. sized, executed
b. re-scoped, deleted
c. initialized, declared
d. compiled, typed
e. None of these
ANS: C
14. Given the following declaration, where is the value 77 stored in the scores array?
int scores[] = {83, 62, 77, 97, 86}
a. scores[0]
b. scores[1]
c. scores[2]
d. scores[3]
e. scores[5]
ANS: C
16. The range-based for loop in C++11 is designed to work with a built-in variable known as
a. the counter
b. the i variable
c. an iterator
d. the range variable
e. None of these
ANS: D
17. A(n) __________ can be used to specify the starting values of an array.
a. initialization list
b. array name
c. subscript
d. element
e. None of these
ANS: A
19. It is _________ to pass an argument to a function that contains an individual array element, such as
scores[3].
a. illegal in C++11
b. legal in C++
c. not recommended by the ANSI committee
d. not good programming practice
e. None of these
ANS: B
20. What is the last legal subscript that can be used with the following array?
int values[5];
a. 0
b. 5
c. 6
d. 4
e. 1
ANS: D
22. To assign the contents of one array to another, you must use
a. the assignment operator with the array names
b. the equality operator with the array names
c. a loop to assign the elements of one array to the other array
d. Any of these
e. None of these
ANS: C
23. To pass an array as an argument to a function, pass the __________ of the array.
a. contents
b. size, expressed as an integer
c. name
d. value of the first element
e. None of these
ANS: C
24. The __________ is automatically appended to a character array when it is initialized with a string
constant.
a. array name
b. number of elements
c. value of the first element
d. null terminator
e. None of these
ANS: D
25. An array of string objects that will hold five names would be declared with which of the following
statements?
a. string names[5];
b. string names(5);
c. string names 5;
d. String[5] = names;
ANS: A
28. When writing functions that accept multi-dimensional arrays as arguments, __________ must be
explicitly stated in the parameter list.
a. all dimensions
b. all but the first dimension
c. the size declarator of the first dimension
d. all element values
e. None of these
ANS: B
35. Which statement correctly defines a vector object for holding integers?
a. vector v<int>;
b. int vector v;
c. int<vector> v;
d. vector<int> v;
ANS: D
36. Which statement correctly uses C++11 to initalize a vector of ints named n with the values 10
and 20?
a. vector n<int>(10, 20);
b. vector<int> n = {10, 20};
c. vector<int> n {10, 20};
d. int vector n ({10}, {20});
ANS: C
37. What does the following statement do?
vector<int> v(10);
a. It creates a vector object and initializes all its elements to the value 10.
b. It creates a vector object with a starting size of 10.
c. It creates a vector object and initializes the first element with the value 10.
d. It creates a vector object that can only store values of 10 or less.
ANS: B
42. This vector function returns true if the vector has no elements.
a. has_no_elements
b. null_size
c. empty
d. is_empty
ANS: C
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.