Deck 8: Arrays

Full screen (f)
exit full mode
Question
An atomic variable is also referred to as a scalar variable.
Use Space or
up arrow
down arrow
to flip the card.
Question
A data structure is also known as an atomic data type.
Question
The values of a data structure can be decomposed into individual data elements, each of which has to be atomic.
Question
A one-dimensional array is also known as both a single-dimensional array and a single-subscript array.
Question
An array component is also referred to as the element's subscript value.
Question
Each individual element in an array is referred to as an indexed variable.
Question
The computer uses the index as an offset from the array's starting position.
Question
Atomic data types can be decomposed into simpler types.
Question
Structured types can be decomposed into simpler types that are related within a defined structure.
Question
A double-precision variable may never be used as a subscript.
Question
The statement scanf("%d %lf", grades[0], price[2]); causes two values to be read and stored in the variables grades[0] and price[2].
Question
The LISP language was developed specifically for manipulating lists.
Question
When using an array element, C performs bound checks on the value of the index.
Question
If an array has been declared as consisting of 10 elements and you use an index of 12, C will notify you of the error when the program is compiled.
Question
Arrays can be declared either within or outside a function.
Question
Arrays declared outside a function have global scope.
Question
Global arrays can only be static.
Question
When first created, the values within auto local arrays are undefined.
Question
When passing an array to a function, the called function receives a copy of the array; this is because C uses pass by value.
Question
For large arrays, making duplicate copies of the array for each function call would waste computer storage, consume execution time, and frustrate the effort to return multiple element changes made by the called program.
Question
It is generally advisable to omit the size of the array in a function header line.
Question
A one-dimensional array consists of both rows and columns of elements.
Question
The outer braces in the initialization statement of a two-dimensional array can be omitted.
Question
Nested loops are especially useful when dealing with two-dimensional arrays because they allow the programmer to easily cycle through each element.
Question
In a three-dimensional array, the second subscript is often called the rank.
Question
Arrays of three, four, five, six, or more dimensions can be viewed as mathematical n-tuples of order three, four, five, six, and so on, respectively.
Question
A(n) ____ is a data type with two main characteristics: (1) its values can be decomposed into individual data elements, and (2) it provides an access scheme for locating individual data elements.

A)data structure
B)scalar data type
C)array
D)atomic data type
Question
A(n) ____, is used to store and process a set of values, all of the same data type, that forms a logical group.

A)data structure
B)scalar variable
C)array
D)atomic variable
Question
A ____ is a list of values of the same data type that is stored using a single group name.

A)one-dimensional array
B)two-dimensional array
C)three-dimensional array
D)matrix
Question
Each item in an array is called a(n) ____ of the array.

A)subscript
B)variable
C)index
D)element
Question
Any individual element in an array can be accessed by giving the name of the array and the element's position; this position is called the element's ____ value.

A)component
B)variable
C)index
D)element
Question
In a one-dimensional array in C, the first element has an index of ____.

A)NULL
B)-1
C)0
D)1
Question
In C, the array name and index of the desired element are combined by listing the index in ____ after the array name.

A)parentheses
B)square braces
C)curly braces
D)dashes
Question
____ refers to the first grade stored in the grades array.

A)grades[0]
B)grades[1]
C)grades(0)
D)grades{1}
Question
Any expression that evaluates a(n) ____ may be used as a subscript.

A)character
B)double
C)boolean
D)integer
Question
A ____ loop is very convenient for cycling through array elements.

A)while
B)do-while
C)switch
D)for
Question
All ____ arrays are created and destroyed each time the function they are local to is called and completes its execution.

A)global
B)static
C)auto
D)extern
Question
The individual elements of all global and static arrays are, by default, set to ____ at compilation time.

A)NULL
B)-1
C)0
D)1
Question
____ is a correct statement.

A)int grades[5] = {98, 87, 92, 79, 85};
B)int grades[5] = 98, 87, 92, 79, 85;
C)int grades[5] = (98, 87, 92, 79, 85);
D)int grades[5] = [98, 87, 92, 79, 85];
Question
____ shows a correct array initialization statement.

A)char codes[4] = {'s', 'a', 'm', 'p', 'l', 'e'};
B)char codes[] = {'s', 'a', 'm', 'p', 'l', 'e'};
C)char codes = {'s', 'a', 'm', 'p', 'l', 'e'};
D)char codes[*] = {'s', 'a', 'm', 'p', 'l', 'e'};
Question
____ shows a correct array initialization statement.

A)char codes[6] = ['s', 'a', 'm', 'p', 'l', 'e'];
B)char codes[] = ('s', 'a', 'm', 'p', 'l', 'e');
C)char codes[] = "sample";
D)char codes[*] = {'s', 'a', 'm', 'p', 'l', 'e'};
Question
char codes[] = "sample"; sets aside ____ elements in the codes array.

A)5
B)6
C)7
D)8
Question
The ____ character is automatically appended to all strings by the C compiler.

A)'\NULL'
B)'\1'
C)'\n'
D)'\0'
Question
A two-dimensional array is sometimes referred to as a ____.

A)list
B)vector
C)queue
D)table
Question
____ declares an array of three rows and four columns.

A)int val[3,4];
B)int val[4,3];
C)int val[3][4];
D)int val[4][3];
Question
The term ____ uniquely identifies the element in row 1, column 3.

A)val[3][1]
B)val[1][3]
C)val[3,1]
D)val[1,3]
Question
In a function prototype that has a two-dimensional argument, the ____ size is optional.

A)column
B)row
C)array
D)subscript
Question
For one-dimensional arrays, the offset to the element with index i is calculated as ____.

A) Offset = i * the size of the array
B) Offset = i * the size of the subscript
C) Offset = i * the size of a component + 1
D) Offset = i * the size of an individual element
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/48
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Arrays
1
An atomic variable is also referred to as a scalar variable.
True
2
A data structure is also known as an atomic data type.
False
3
The values of a data structure can be decomposed into individual data elements, each of which has to be atomic.
False
4
A one-dimensional array is also known as both a single-dimensional array and a single-subscript array.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
5
An array component is also referred to as the element's subscript value.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
6
Each individual element in an array is referred to as an indexed variable.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
7
The computer uses the index as an offset from the array's starting position.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
8
Atomic data types can be decomposed into simpler types.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
9
Structured types can be decomposed into simpler types that are related within a defined structure.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
10
A double-precision variable may never be used as a subscript.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
11
The statement scanf("%d %lf", grades[0], price[2]); causes two values to be read and stored in the variables grades[0] and price[2].
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
12
The LISP language was developed specifically for manipulating lists.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
13
When using an array element, C performs bound checks on the value of the index.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
14
If an array has been declared as consisting of 10 elements and you use an index of 12, C will notify you of the error when the program is compiled.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
15
Arrays can be declared either within or outside a function.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
16
Arrays declared outside a function have global scope.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
17
Global arrays can only be static.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
18
When first created, the values within auto local arrays are undefined.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
19
When passing an array to a function, the called function receives a copy of the array; this is because C uses pass by value.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
20
For large arrays, making duplicate copies of the array for each function call would waste computer storage, consume execution time, and frustrate the effort to return multiple element changes made by the called program.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
21
It is generally advisable to omit the size of the array in a function header line.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
22
A one-dimensional array consists of both rows and columns of elements.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
23
The outer braces in the initialization statement of a two-dimensional array can be omitted.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
24
Nested loops are especially useful when dealing with two-dimensional arrays because they allow the programmer to easily cycle through each element.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
25
In a three-dimensional array, the second subscript is often called the rank.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
26
Arrays of three, four, five, six, or more dimensions can be viewed as mathematical n-tuples of order three, four, five, six, and so on, respectively.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
27
A(n) ____ is a data type with two main characteristics: (1) its values can be decomposed into individual data elements, and (2) it provides an access scheme for locating individual data elements.

A)data structure
B)scalar data type
C)array
D)atomic data type
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
28
A(n) ____, is used to store and process a set of values, all of the same data type, that forms a logical group.

A)data structure
B)scalar variable
C)array
D)atomic variable
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
29
A ____ is a list of values of the same data type that is stored using a single group name.

A)one-dimensional array
B)two-dimensional array
C)three-dimensional array
D)matrix
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
30
Each item in an array is called a(n) ____ of the array.

A)subscript
B)variable
C)index
D)element
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
31
Any individual element in an array can be accessed by giving the name of the array and the element's position; this position is called the element's ____ value.

A)component
B)variable
C)index
D)element
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
32
In a one-dimensional array in C, the first element has an index of ____.

A)NULL
B)-1
C)0
D)1
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
33
In C, the array name and index of the desired element are combined by listing the index in ____ after the array name.

A)parentheses
B)square braces
C)curly braces
D)dashes
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
34
____ refers to the first grade stored in the grades array.

A)grades[0]
B)grades[1]
C)grades(0)
D)grades{1}
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
35
Any expression that evaluates a(n) ____ may be used as a subscript.

A)character
B)double
C)boolean
D)integer
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
36
A ____ loop is very convenient for cycling through array elements.

A)while
B)do-while
C)switch
D)for
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
37
All ____ arrays are created and destroyed each time the function they are local to is called and completes its execution.

A)global
B)static
C)auto
D)extern
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
38
The individual elements of all global and static arrays are, by default, set to ____ at compilation time.

A)NULL
B)-1
C)0
D)1
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
39
____ is a correct statement.

A)int grades[5] = {98, 87, 92, 79, 85};
B)int grades[5] = 98, 87, 92, 79, 85;
C)int grades[5] = (98, 87, 92, 79, 85);
D)int grades[5] = [98, 87, 92, 79, 85];
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
40
____ shows a correct array initialization statement.

A)char codes[4] = {'s', 'a', 'm', 'p', 'l', 'e'};
B)char codes[] = {'s', 'a', 'm', 'p', 'l', 'e'};
C)char codes = {'s', 'a', 'm', 'p', 'l', 'e'};
D)char codes[*] = {'s', 'a', 'm', 'p', 'l', 'e'};
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
41
____ shows a correct array initialization statement.

A)char codes[6] = ['s', 'a', 'm', 'p', 'l', 'e'];
B)char codes[] = ('s', 'a', 'm', 'p', 'l', 'e');
C)char codes[] = "sample";
D)char codes[*] = {'s', 'a', 'm', 'p', 'l', 'e'};
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
42
char codes[] = "sample"; sets aside ____ elements in the codes array.

A)5
B)6
C)7
D)8
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
43
The ____ character is automatically appended to all strings by the C compiler.

A)'\NULL'
B)'\1'
C)'\n'
D)'\0'
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
44
A two-dimensional array is sometimes referred to as a ____.

A)list
B)vector
C)queue
D)table
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
45
____ declares an array of three rows and four columns.

A)int val[3,4];
B)int val[4,3];
C)int val[3][4];
D)int val[4][3];
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
46
The term ____ uniquely identifies the element in row 1, column 3.

A)val[3][1]
B)val[1][3]
C)val[3,1]
D)val[1,3]
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
47
In a function prototype that has a two-dimensional argument, the ____ size is optional.

A)column
B)row
C)array
D)subscript
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
48
For one-dimensional arrays, the offset to the element with index i is calculated as ____.

A) Offset = i * the size of the array
B) Offset = i * the size of the subscript
C) Offset = i * the size of a component + 1
D) Offset = i * the size of an individual element
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 48 flashcards in this deck.