Deck 7: Arrays
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 7: Arrays
1
Each item in an array is called a(n) ____ or component of the array.
A) element
B) object
C) instance
D) list
A) element
B) object
C) instance
D) list
A
2
Each individual array element is referred to as an indexed variable or a(n) ____ variable.
A) scalar
B) subscripted
C) static
D) array
A) scalar
B) subscripted
C) static
D) array
B
3
A string is any sequence of characters enclosed in ____.
A) asterisks
B) single quotation marks
C) parentheses
D) double quotation marks
A) asterisks
B) single quotation marks
C) parentheses
D) double quotation marks
D
4
Array elements can be initialized in their declaration statements in the same manner as scalar variables, except that the initializing elements must be included in braces.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
A(n) ____ array consists of both rows and columns of elements.
A) one-dimensional
B) two-dimensional
C) single-dimensional
D) simple-dimensional
A) one-dimensional
B) two-dimensional
C) single-dimensional
D) simple-dimensional
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
The escape sequence \0 is called the ____ character.
A) null
B) newline
C) tab
D) zero
A) null
B) newline
C) tab
D) zero
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Using a subscript that references a nonexistent array element will always be detected by all C++ compilers.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
The element s index or ____ value gives the element s position in the array.
A) id
B) scale
C) subscript
D) reference
A) id
B) scale
C) subscript
D) reference
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
A(n) ____ is a list of related values, all having the same data type, that s stored with a single group name.
A) static variable
B) one-dimensional array
C) atomic variable
D) instance variable
A) static variable
B) one-dimensional array
C) atomic variable
D) instance variable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
It is generally advisable to use the size of the array in a function header line.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
C++ allows up to two dimensions to be declared for arrays.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Arrays are extremely useful in any application that requires multiple passes through the same set of data elements.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Only integer constants can be used as array subscripts.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
A two-dimensional array is sometimes referred to as a table.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A one-dimensional array is also referred to as a single-dimensional array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
A(n) ____ check is a check of the value of the index being used.
A) index
B) bounds
C) object
D) reference
A) index
B) bounds
C) object
D) reference
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
Two-dimensional array variables can be used anywhere that scalar variables are valid.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
A(n) ____ variable is one whose value can t be further subdivided or separated into a legitimate data type.
A) indexed
B) array
C) grade
D) scalar
A) indexed
B) array
C) grade
D) scalar
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
A(n) ____ type is any type whose values can be decomposed and are related by some defined structure.
A) scalar
B) static
C) aggregate
D) atomic
A) scalar
B) static
C) aggregate
D) atomic
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
Forgetting to declare an array is a common programming error.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
A(n) ____ is the data structure of first choice when you have a list of primitive data types or objects that can be grouped as an array but must be expanded or contracted.
A) array
B) vector
C) object
D) class
A) array
B) vector
C) object
D) class
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
____ are used to specify which elements in a container are to be operated on when an algorithm is called.
A) Iterators
B) Walkers
C) Sequencers
D) Indexers
A) Iterators
B) Walkers
C) Sequencers
D) Indexers
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
For a one-dimensional array, the first element has an index of ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
The STL algorithm ____ removes duplicate adjacent elements in a specified range.
A) duplicate
B) delete
C) unique
D) remove
A) duplicate
B) delete
C) unique
D) remove
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
Good programming practice requires defining the number-of-items in the array as a(n) ____________________ before declaring the array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The ____ header is required to create one or more vector objects.
A) < string >
B) < iostream >
C) < algorithm >
D) < vector >
A) < string >
B) < iostream >
C) < algorithm >
D) < vector >
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
The STL algorithm ____ assigns every element in a specified range to a specified value.
A) equal
B) fill
C) find
D) unique
A) equal
B) fill
C) find
D) unique
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
The STL ____ function returns a value corresponding to the start of the vector.
A) begin()
B) end()
C) rear()
D) last()
A) begin()
B) end()
C) rear()
D) last()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
To meet the need of providing a tested and generic set of data structures that can be modified, expanded, and contracted, C++ includes a useful set of classes in its ____.
A) Standard Array Library
B) Standard Template Library
C) Standard Data Structure Library
D) Data Structure Library
A) Standard Array Library
B) Standard Template Library
C) Standard Data Structure Library
D) Data Structure Library
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The STL algorithm ____ copies elements from a source range to a destination range.
A) copy
B) copy_backward
C) copy_forward
D) replace
A) copy
B) copy_backward
C) copy_forward
D) replace
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
Internally, the computer uses the ___________________ as an offset from the array s starting position.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
In C++, a two-dimensional array is initialized in ____ order.
A) vector
B) linear
C) row
D) column
A) vector
B) linear
C) row
D) column
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
The STL algorithm ____ returns the sum of the numbers in a specified range.
A) count
B) sum
C) max
D) accumulate
A) count
B) sum
C) max
D) accumulate
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The STL algorithm ____ randomly shuffles element values in a specified range.
A) random
B) rnd_shuffle
C) shuffle
D) random_shuffle
A) random
B) rnd_shuffle
C) shuffle
D) random_shuffle
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
Individual array elements can be displayed using the ___________________ object.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
____ loops are especially useful when dealing with two-dimensional arrays because they allow the programmer to designate and cycle through each element easily.
A) Nested
B) Single
C) Simple
D) Conditional
A) Nested
B) Single
C) Simple
D) Conditional
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The ____________________ of an array may be omitted when initializing values in the declaration statement.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
Conceptually, a ____-dimensional array can be viewed as a book of data tables.
A) one
B) two
C) three
D) four
A) one
B) two
C) three
D) four
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
Each STL class is coded as a template that permits the constructing a generic data structure, referred to as a(n) ____.
A) container
B) object
C) structure
D) array
A) container
B) object
C) structure
D) array
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
Many compilers automatically set all elements of integer and real value arrays to ____.
A) -100
B) -10
C) -1
D) 0
A) -100
B) -10
C) -1
D) 0
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
____________________ classes and algorithms provide verified and reliable code that can shorten program development time.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
Generic STL functions are referred to in the STL as ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
The statement char code 6 26 ; declares an array code consisting of ____________________ rows.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Array elements are passed to a called function in the same manner as __________________ variables.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
The C++ vector class function ___________________ appends an element at the end of the vector .
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The header is required to create and use an STL sort algorithm.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
A(n) ____________________ is the data structure of choice when you have a list of primitive data types or objects that don t have to be expanded or contracted.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
A vector is similar to an array in that it stores elements that can be accessed using an integer index that starts at ___________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The value of using a(n) ___________________ search algorithm is that the number of elements that must be searched is cut in half on each iteration of the algorithm.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The functions begin() and end() are known as STL____________________ functions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck