Deck 10: Pointers

Full screen (f)
exit full mode
Question
The C++ operator * means the address of .
Use Space or
up arrow
down arrow
to flip the card.
Question
The asterisk ( * ) symbol is also called the ____ operator.

A) pointer
B) reference
C) increment
D) dereferencing
Question
The address named as a reference can be altered.
Question
References are used almost exclusively as formal function parameters and ____ types.

A) object
B) class
C) return
D) constant
Question
As each variable is defined in a program, sufficient storage for it is assigned from a pool of computer memory locations made available to the compiler.
Question
To use a stored address, C++ provides us with an indirection operator, ____.

A) &
B)
C) *
D) %
Question
For each array created, the array name becomes the name of the pointer constant the compiler creates for the array.
Question
____ are simply variables used to store memory addresses.

A) Pointers
B) Objects
C) Arrays
D) Vectors
Question
Essentially, a(n) ____ is a named constant for an address.

A) pointer
B) reference
C) class
D) indirection
Question
When used in declaring reference arguments, the ampersand refers to the data type preceding it.
Question
Technically, references are said to be ____.

A) explicitly dereferenced
B) statically dereferenced
C) manually dereferenced
D) automatically dereferenced
Question
If a character s address is stored in a pointer, only ____ byte(s) of storage would be retrieved when the address is used.

A) one
B) two
C) four
D) six
Question
The delete operator alters the address passed to it.
Question
Reference variables are available in C++.
Question
A(n) ____ error is produced when an attempt is made to equate a reference to a constant.

A) logic
B) compiler
C) codec
D) executable
Question
If the integer s address is stored in a pointer, typically only ____ bytes of storage are retrieved when the address is used.

A) two
B) three
C) four
D) eight
Question
Addresses cannot be incremented or decremented.
Question
Multiple references cannot be declared in a single statement.
Question
To display the address of a variable, you can use C++ s address operator, ____.

A) >>
B) ^
C) ::
D) &
Question
The use of a pointer requires the computer to do a double lookup.
Question
Pointers must be ____________________ before they can be used to store an address.
Question
The C++ ____ operator releases a block of bytes reserved previously.

A) free
B) delete
C) return
D) dealloc
Question
The ____ consists of unallocated memory that can be allocated to a program, as requested, while the program is running.

A) pool
B) queue
C) heap
D) stack
Question
Pointers to functions are possible because function ____ are themselves pointer constants.

A) classes
B) methods
C) names
D) values
Question
Assuming ptNum is a pointer, the statement ____ uses the pointer and then increments it.

A) *++ptNum
B) *ptNum++
C) *ptNum--
D) *--ptNum
Question
In contrast to implicitly passing addresses with ____, addresses can be explicitly passed using pointers.

A) extern variables
B) instances
C) static variables
D) references
Question
A double typically requires the retrieval of ____________________ bytes of storage.
Question
Any address returned by ____ can be used subsequently by ____ to restore reserved memory back to the computer

A) new , delete
B) delete , new
C) * , reset
D) peek , poke
Question
There is a direct relationship between array names and ____________________data types.
Question
The compiler automatically converts any array subscript used by a programmer to an equivalent ____ expression.

A) reference
B) pointer
C) class
D) object
Question
The term ____ describes the condition that occurs when dynamically allocated memory isn t returned explicitly by using the delete operator and the operating system doesn t reclaim allocated memory.

A) stack leak
B) heap leak
C) garbage collection
D) memory leak
Question
The 1 in the expression *(gPtr + 1) is a(n) ____.

A) pointer
B) initializer
C) offset
D) register
Question
Under a ____ allocation scheme, the amount of storage to be allocated is determined and adjusted at runtime rather than compile time.

A) fixed
B) predefined
C) dynamic
D) static
Question
When constructing references, the reference should be of the same data type as the ____________________ to which it refers.
Question
A pointer reference can always be replaced with a ____ reference.

A) variable
B) constant
C) class
D) subscript
Question
The advantage of using references over using pointers is that the notation is ____.

A) more thorough
B) simpler
C) faster at runtime
D) written in a lower-level language
Question
When an array is created, the compiler creates an internal point constant for it automatically and stores the array s ____ in this pointer.

A) length
B) number of elements
C) starting address
D) name
Question
When used in a nondeclarative statement, the operator placed in front of a variable s name refers to the ____________________ of the variable.
Question
Explicitly passing addresses with the address operator is referred to as a pass by ____.

A) reference
B) value
C) copy
D) image
Question
A computer uses an array s ____ to calculate the array element s address based on both the array s starting address and the amount of storage each element uses.

A) subscript
B) reference
C) length
D) operand
Question
The ____________________ statement restores an allocated block of storage back to the free storage area (the heap) while a program is running.
Question
The 1 in the expression *(gPtr + 1) is a(n) ____________________.
Question
For each array created, the array name becomes the name of the pointer ____________________ the compiler creates for the array.
Question
____________________ allocation of memory is useful when dealing with lists because it allows expanding the list as new items are added and contracting the list as items are deleted.
Question
Expressions taking the address of an array name are invalid because the pointer the compiler creates is ____________________ to the computer.
Question
The compiler automatically converts any subscript used by a programmer to an equivalent ____________________ expression.
Question
Like all variables, pointers can be initialized when they are ____________________.
Question
The addresses in pointers can be compared by using any of the C++ ____________________ operators.
Question
The advantage of using pointers rather than references is that the function call specifies that ____________________ are being used.
Question
Access to multidimensional ____________________ can be made using pointer notation.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Pointers
1
The C++ operator * means the address of .
False
2
The asterisk ( * ) symbol is also called the ____ operator.

A) pointer
B) reference
C) increment
D) dereferencing
D
3
The address named as a reference can be altered.
False
4
References are used almost exclusively as formal function parameters and ____ types.

A) object
B) class
C) return
D) constant
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
As each variable is defined in a program, sufficient storage for it is assigned from a pool of computer memory locations made available to the compiler.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
To use a stored address, C++ provides us with an indirection operator, ____.

A) &
B)
C) *
D) %
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
For each array created, the array name becomes the name of the pointer constant the compiler creates for the array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
____ are simply variables used to store memory addresses.

A) Pointers
B) Objects
C) Arrays
D) Vectors
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Essentially, a(n) ____ is a named constant for an address.

A) pointer
B) reference
C) class
D) indirection
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
When used in declaring reference arguments, the ampersand refers to the data type preceding it.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
Technically, references are said to be ____.

A) explicitly dereferenced
B) statically dereferenced
C) manually dereferenced
D) automatically dereferenced
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
If a character s address is stored in a pointer, only ____ byte(s) of storage would be retrieved when the address is used.

A) one
B) two
C) four
D) six
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The delete operator alters the address passed to it.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
Reference variables are available in C++.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A(n) ____ error is produced when an attempt is made to equate a reference to a constant.

A) logic
B) compiler
C) codec
D) executable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
If the integer s address is stored in a pointer, typically only ____ bytes of storage are retrieved when the address is used.

A) two
B) three
C) four
D) eight
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
Addresses cannot be incremented or decremented.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Multiple references cannot be declared in a single statement.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
To display the address of a variable, you can use C++ s address operator, ____.

A) >>
B) ^
C) ::
D) &
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
The use of a pointer requires the computer to do a double lookup.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Pointers must be ____________________ before they can be used to store an address.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
The C++ ____ operator releases a block of bytes reserved previously.

A) free
B) delete
C) return
D) dealloc
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
The ____ consists of unallocated memory that can be allocated to a program, as requested, while the program is running.

A) pool
B) queue
C) heap
D) stack
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Pointers to functions are possible because function ____ are themselves pointer constants.

A) classes
B) methods
C) names
D) values
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
Assuming ptNum is a pointer, the statement ____ uses the pointer and then increments it.

A) *++ptNum
B) *ptNum++
C) *ptNum--
D) *--ptNum
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
In contrast to implicitly passing addresses with ____, addresses can be explicitly passed using pointers.

A) extern variables
B) instances
C) static variables
D) references
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
A double typically requires the retrieval of ____________________ bytes of storage.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
Any address returned by ____ can be used subsequently by ____ to restore reserved memory back to the computer

A) new , delete
B) delete , new
C) * , reset
D) peek , poke
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
There is a direct relationship between array names and ____________________data types.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The compiler automatically converts any array subscript used by a programmer to an equivalent ____ expression.

A) reference
B) pointer
C) class
D) object
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
The term ____ describes the condition that occurs when dynamically allocated memory isn t returned explicitly by using the delete operator and the operating system doesn t reclaim allocated memory.

A) stack leak
B) heap leak
C) garbage collection
D) memory leak
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
The 1 in the expression *(gPtr + 1) is a(n) ____.

A) pointer
B) initializer
C) offset
D) register
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
Under a ____ allocation scheme, the amount of storage to be allocated is determined and adjusted at runtime rather than compile time.

A) fixed
B) predefined
C) dynamic
D) static
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
When constructing references, the reference should be of the same data type as the ____________________ to which it refers.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
A pointer reference can always be replaced with a ____ reference.

A) variable
B) constant
C) class
D) subscript
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
The advantage of using references over using pointers is that the notation is ____.

A) more thorough
B) simpler
C) faster at runtime
D) written in a lower-level language
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
When an array is created, the compiler creates an internal point constant for it automatically and stores the array s ____ in this pointer.

A) length
B) number of elements
C) starting address
D) name
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
When used in a nondeclarative statement, the operator placed in front of a variable s name refers to the ____________________ of the variable.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
Explicitly passing addresses with the address operator is referred to as a pass by ____.

A) reference
B) value
C) copy
D) image
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
A computer uses an array s ____ to calculate the array element s address based on both the array s starting address and the amount of storage each element uses.

A) subscript
B) reference
C) length
D) operand
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
The ____________________ statement restores an allocated block of storage back to the free storage area (the heap) while a program is running.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
The 1 in the expression *(gPtr + 1) is a(n) ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
For each array created, the array name becomes the name of the pointer ____________________ the compiler creates for the array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
____________________ allocation of memory is useful when dealing with lists because it allows expanding the list as new items are added and contracting the list as items are deleted.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
Expressions taking the address of an array name are invalid because the pointer the compiler creates is ____________________ to the computer.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The compiler automatically converts any subscript used by a programmer to an equivalent ____________________ expression.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Like all variables, pointers can be initialized when they are ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
The addresses in pointers can be compared by using any of the C++ ____________________ operators.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The advantage of using pointers rather than references is that the function call specifies that ____________________ are being used.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
Access to multidimensional ____________________ can be made using pointer notation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.