Deck 10: Pointers

Full screen (f)
exit full mode
Question
A pointer may be initialized with

A) the address of an existing object of the appropriate type.
B) the value of a floating-point constant.
C) the value of a floating-point variable.
D) All of the above
E) None of the above
Use Space or
up arrow
down arrow
to flip the card.
Question
With pointer variables, you can ________ manipulate data stored in other variables.

A) never
B) seldom
C) indirectly
D) All of the above
E) None of the above
Question
Memory cannot be allocated after a program is already running.
Question
With pointer variables you can access, but you cannot modify, data in other variables.
Question
The term pointer can be used interchangeably with

A) address.
B) variable.
C) decimal pointer.
D) counter pointer.
E) None of the above
Question
Assuming that arr is an array identifier, the statement sum += *arr;

A) is illegal in C++.
B) will always result in a compiler error.
C) adds the value stored in arr[0] to sum.
D) adds the address of the pointer arr to sum.
E) None of the above
Question
An array name is a pointer constant because the address it represents cannot be changed during run-time.
Question
Which of the following statements correctly deletes a dynamically-allocated array pointed to by p?

A) delete p;
B) p delete[ ];
C) delete [ ] p;
D) delete array p;
E) None of the above
Question
When the less than ( < ) operator is used between two pointer variables, the expression is testing whether

A) the value pointed to by the first is less than the value pointed to by the second.
B) the value pointed to by the first is greater than the value pointed to by the second.
C) the address of the first variable comes before the address of the second variable in the computer's memory.
D) the first variable was declared before the second variable.
E) None of the above
Question
A pointer with the value 0 (zero) is called the NULL pointer.
Question
________ can be used as pointers.

A) Array names
B) C++ string objects
C) Punctuation marks
D) All of the above
E) None of the above
Question
The delete operator should only be used on pointers that

A) have not yet been used.
B) have been correctly initialized.
C) point to storage allocated by the new operator.
D) are appropriately dereferenced.
E) None of the above
Question
Which arithmetic operations can be performed on pointers?

A) All arithmetic operations that are legal in C++
B) Multiplication, division, addition, and subtraction
C) Addition , subtraction , preincrement, and postincrement
D) Only multiplication and addition
E) None of the above
Question
It is legal to subtract a pointer variable from another pointer variable.
Question
When you work with a dereferenced pointer, you are actually working with

A) a variable whose memory has been deallocated.
B) a copy of the value pointed to by the pointer variable.
C) the variable whose address is stored in the pointer variable.
D) All of the above
E) None of the above
Question
Which of the following statements is not valid C++ code?

A) int ptr = &num1;
B) int ptr = int *num1;
C) float num1 = &ptr2;
D) All of the above are valid.
E) All of the above are invalid.
Question
The statement double *num;

A) defines a variable of type double called num.
B) defines and initializes a pointer variable called num.
C) initializes a variable called *num.
D) defines a pointer variable called num.
E) None of the above
Question
The ________, also known as the address operator, returns the memory address of a variable.

A) asterisk ( * )
B) ampersand ( & )
C) percent sign (%)
D) exclamation point ( ! )
E) None of the above
Question
A function may return a pointer, but the programmer must ensure that the pointer

A) is pointing to an object that is still valid after the return of the function.
B) has been assigned an address.
C) was received as a parameter by the function.
D) has not previously been returned by another function.
E) None of the above
Question
The code segment int *ptr; has the same meaning as

A) int ptr;.
B) *int ptr;.
C) int ptr*;.
D) int* ptr;.
E) None of the above
Question
A pointer variable is designed to store

A) any legal C++ value.
B) only floating-point values.
C) a memory address.
D) an integer.
E) None of the above
Question
The statement cout << *ptr; will output

A) the value stored in the variable whose address is contained in ptr.
B) the string "*ptr".
C) the address of the variable stored in ptr.
D) the address of the variable whose address is stored in ptr.
E) None of the above
Question
A pointer with the value 0 (zero) is called the NULL pointer.
Question
Any arithmetic operation may be performed on pointers.
Question
A pointer can be passed as an argument to a function.
Question
The expression s->m is meaningful only when s is a pointer to a structure and m is a member of the structure.
Question
The statement shared_ptr p(new int); involves

A) a single allocation of a dynamic block of memory.
B) two allocations of two different dynamic blocks of memory.
C) three allocations of three different dynamic blocks of memory.
D) no allocations of dynamic memory.
E) None of the above
Question
The statement cout << &num1; will output

A) the value stored in the variable called num1.
B) the memory address of the variable called num1.
C) the number 1.
D) the string "&num1".
E) None of the above
Question
The expression s->m has the same meaning as (*s).m.
Question
C++ does not perform array bounds checking.
Question
When the ________ is placed in front of a variable name, it returns the address of that variable.

A) asterisk ( * )
B) conditional operator
C) ampersand ( & )
D) semicolon ( ; )
E) None of the above
Question
If arr is an array identifier and k is an integer, the expression arr[k] is equivalent to

A) *(arr + k).
B) *arr + k.
C) &arr[k].
D) arr + k.
E) None of the above
Question
Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then

A) the pointer p becomes a dangling pointer.
B) the compiler will automatically deallocate the memory pointed to by p.
C) the program will suffer from memory leaks.
D) the returning function will throw the bad_alloc exception.
E) None of the above
Question
The statement int *ptr; means

A) the variable called ptr will store an integer value.
B) the variable called *ptr will store an asterisk and an integer value.
C) ptr is a pointer variable that will store the address of an integer variable.
D) All of the above
E) None of the above
Question
The set of operations supported by the unique_ptr class include

A) the dereferencing operators * and ->, the post and pre increment operators ++, and the post and pre decrement operators --.
B) the dereferencing operators * and ->.
C) the assignment operator.
D) the delete operator.
E) None of the above
Question
Which of the following statements is not valid C++ code?

A) int ptr = &num1;
B) int ptr = int *num1;
C) float num1 = &ptr2;
D) All of the above are valid.
E) All of the above are invalid.
Question
You may use the type pointer to a structure as the type of a

A) function parameter.
B) structure member.
C) function return type.
D) All of the above
E) None of the above
Question
To dereference a structure pointer and simultaneously access a member of the structure, the appropriate operator to use is

A) the ampersand, &.
B) an asterisk, *.
C) the structure pointer operator, ->.
D) the dereference operator, <-.
E) None of the above
Question
A function may return a pointer, but the programmer must ensure that the pointer

A) is pointing to an object that is still valid after the return of the function.
B) has been assigned an address.
C) was received as a parameter by the function.
D) has not previously been returned by another function.
E) None of the above
Question
The ________ and ________ operators can respectively be used to increment and decrement a pointer variable.

A) dereferencing, indirection
B) modulus, division
C) ++, --
D) All of the above
E) None of the above
Question
If Circle is a structure type, the statement Circle *pcirc;

A) defines a structure variable called *pcirc.
B) defines a structure pointer called pcirc.
C) is illegal in C++.
D) initializes a Circle pointer.
E) None of the above
Question
It is possible for a structure to contain as a member a pointer to its own structure type.
Question
A reason for passing a pointer to a function is

A) to avoid the overhead of copying large data structures.
B) to allow the called function to modify a variable accessible to the calling function.
C) to allow easy access to data in the function that is being called.
D) A and B are both True.
E) None of the above
Question
Every byte in the computer's memory is assigned a unique

A) value.
B) address.
C) dynamically allocated value.
D) name.
E) None of the above
Question
The statement Rectangle * boxPtr; defines a variable boxPtr to be a pointer pointing to a type Rectangle.
Question
A statement that displays the address of the variable num1 is

A) cout << num1;.
B) cout << *num1;.
C) cout << &(*num1);.
D) cout << &num1;.
E) None of the above
Question
A dangling pointer is a pointer

A) to a block of memory that has been deleted.
B) that has been declared, but has not yet been assigned a value.
C) that has not been initialized.
D) that has been assigned the value of null or null_ptr.
E) None of the above
Question
When the ________ is placed in front of a variable name, it returns the address of that variable.

A) asterisk ( * )
B) conditional operator
C) ampersand ( & )
D) semicolon ( ; )
E) None of the above
Question
The statement cin >> *p;

A) stores the keyboard input into the variable p.
B) stores the keyboard input into the pointer called p.
C) is illegal in C++.
D) stores the keyboard input into the variable pointed to by p.
E) None of the above
Question
The statement int *ptr = new int; acquires memory to hold an integer and then

A) initializes the allocated memory to 0.
B) assigns an integer value to the variable called ptr.
C) sets ptr to point to the allocated memory.
D) creates a new pointer called int.
E) None of the above
Question
Which of the following statements correctly deletes a dynamically-allocated array pointed to by p?

A) delete p;
B) p delete[ ];
C) delete [ ] p;
D) delete array p;
E) None of the above
Question
If dynamically allocated memory is not freed,

A) the system may run out of memory.
B) it results in a compiler error.
C) a run-time error informs your user that the program did not free memory space.
D) the source code will not link correctly.
E) None of the above
Question
If s is a structure variable and p, a pointer, is a member of the structure, the statement cout << *s.p; will

A) output the dereferenced value pointed to by p.
B) result in a compiler error.
C) output the address stored in p.
D) output the value stored in s.
E) None of the above
Question
An array name is a pointer constant because the address it represents cannot be changed during run-time.
Question
Any time you use the new operator, it is good practice to

A) use delete afterwards to free the memory allocated by new.
B) use a preprocessor directive.
C) clear the data from the old operator
D) All of the above
E) None of the above
Question
A pointer variable may be initialized with

A) any non-zero integer value.
B) the address of an existing variable of the appropriate type.
C) A and B are both True.
D) None of the above
Question
If a variable occupies more than one byte of memory, its address is

A) the address of the last byte of storage allocated to it.
B) the average of the addresses used to store the variable.
C) the address of the first byte of storage allocated to it.
D) general delivery.
E) None of the above
Question
The expression *s->p; is only meaningful if s is a pointer to a structure and p is a pointer that is a member of that structure.
Question
The ampersand (&) is used to dereference a pointer variable in C++.
Question
Dynamic memory allocation occurs

A) when a variable is created by the compiler.
B) when a variable is created at run-time.
C) when a pointer fails to dereference the right variable.
D) when a pointer is assigned an incorrect address.
E) None of the above
Question
A temporary value in a program can be referred to by at most one lvalue reference.
Question
A ________________ keeps track of dynamically-allocated memory and automatically deletes when it is no longer in use.

A) deleting pointer
B) null pointer
C) smart pointer
D) memory conservation pointer
E) None of the above
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/62
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Pointers
1
A pointer may be initialized with

A) the address of an existing object of the appropriate type.
B) the value of a floating-point constant.
C) the value of a floating-point variable.
D) All of the above
E) None of the above
A
2
With pointer variables, you can ________ manipulate data stored in other variables.

A) never
B) seldom
C) indirectly
D) All of the above
E) None of the above
C
3
Memory cannot be allocated after a program is already running.
False
4
With pointer variables you can access, but you cannot modify, data in other variables.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
5
The term pointer can be used interchangeably with

A) address.
B) variable.
C) decimal pointer.
D) counter pointer.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
6
Assuming that arr is an array identifier, the statement sum += *arr;

A) is illegal in C++.
B) will always result in a compiler error.
C) adds the value stored in arr[0] to sum.
D) adds the address of the pointer arr to sum.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
7
An array name is a pointer constant because the address it represents cannot be changed during run-time.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following statements correctly deletes a dynamically-allocated array pointed to by p?

A) delete p;
B) p delete[ ];
C) delete [ ] p;
D) delete array p;
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
9
When the less than ( < ) operator is used between two pointer variables, the expression is testing whether

A) the value pointed to by the first is less than the value pointed to by the second.
B) the value pointed to by the first is greater than the value pointed to by the second.
C) the address of the first variable comes before the address of the second variable in the computer's memory.
D) the first variable was declared before the second variable.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
10
A pointer with the value 0 (zero) is called the NULL pointer.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
11
________ can be used as pointers.

A) Array names
B) C++ string objects
C) Punctuation marks
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
12
The delete operator should only be used on pointers that

A) have not yet been used.
B) have been correctly initialized.
C) point to storage allocated by the new operator.
D) are appropriately dereferenced.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
13
Which arithmetic operations can be performed on pointers?

A) All arithmetic operations that are legal in C++
B) Multiplication, division, addition, and subtraction
C) Addition , subtraction , preincrement, and postincrement
D) Only multiplication and addition
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
14
It is legal to subtract a pointer variable from another pointer variable.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
15
When you work with a dereferenced pointer, you are actually working with

A) a variable whose memory has been deallocated.
B) a copy of the value pointed to by the pointer variable.
C) the variable whose address is stored in the pointer variable.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following statements is not valid C++ code?

A) int ptr = &num1;
B) int ptr = int *num1;
C) float num1 = &ptr2;
D) All of the above are valid.
E) All of the above are invalid.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
17
The statement double *num;

A) defines a variable of type double called num.
B) defines and initializes a pointer variable called num.
C) initializes a variable called *num.
D) defines a pointer variable called num.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
18
The ________, also known as the address operator, returns the memory address of a variable.

A) asterisk ( * )
B) ampersand ( & )
C) percent sign (%)
D) exclamation point ( ! )
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
19
A function may return a pointer, but the programmer must ensure that the pointer

A) is pointing to an object that is still valid after the return of the function.
B) has been assigned an address.
C) was received as a parameter by the function.
D) has not previously been returned by another function.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
20
The code segment int *ptr; has the same meaning as

A) int ptr;.
B) *int ptr;.
C) int ptr*;.
D) int* ptr;.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
21
A pointer variable is designed to store

A) any legal C++ value.
B) only floating-point values.
C) a memory address.
D) an integer.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
22
The statement cout << *ptr; will output

A) the value stored in the variable whose address is contained in ptr.
B) the string "*ptr".
C) the address of the variable stored in ptr.
D) the address of the variable whose address is stored in ptr.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
23
A pointer with the value 0 (zero) is called the NULL pointer.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
24
Any arithmetic operation may be performed on pointers.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
25
A pointer can be passed as an argument to a function.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
26
The expression s->m is meaningful only when s is a pointer to a structure and m is a member of the structure.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
27
The statement shared_ptr p(new int); involves

A) a single allocation of a dynamic block of memory.
B) two allocations of two different dynamic blocks of memory.
C) three allocations of three different dynamic blocks of memory.
D) no allocations of dynamic memory.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
28
The statement cout << &num1; will output

A) the value stored in the variable called num1.
B) the memory address of the variable called num1.
C) the number 1.
D) the string "&num1".
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
29
The expression s->m has the same meaning as (*s).m.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
30
C++ does not perform array bounds checking.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
31
When the ________ is placed in front of a variable name, it returns the address of that variable.

A) asterisk ( * )
B) conditional operator
C) ampersand ( & )
D) semicolon ( ; )
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
32
If arr is an array identifier and k is an integer, the expression arr[k] is equivalent to

A) *(arr + k).
B) *arr + k.
C) &arr[k].
D) arr + k.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
33
Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then

A) the pointer p becomes a dangling pointer.
B) the compiler will automatically deallocate the memory pointed to by p.
C) the program will suffer from memory leaks.
D) the returning function will throw the bad_alloc exception.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
34
The statement int *ptr; means

A) the variable called ptr will store an integer value.
B) the variable called *ptr will store an asterisk and an integer value.
C) ptr is a pointer variable that will store the address of an integer variable.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
35
The set of operations supported by the unique_ptr class include

A) the dereferencing operators * and ->, the post and pre increment operators ++, and the post and pre decrement operators --.
B) the dereferencing operators * and ->.
C) the assignment operator.
D) the delete operator.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following statements is not valid C++ code?

A) int ptr = &num1;
B) int ptr = int *num1;
C) float num1 = &ptr2;
D) All of the above are valid.
E) All of the above are invalid.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
37
You may use the type pointer to a structure as the type of a

A) function parameter.
B) structure member.
C) function return type.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
38
To dereference a structure pointer and simultaneously access a member of the structure, the appropriate operator to use is

A) the ampersand, &.
B) an asterisk, *.
C) the structure pointer operator, ->.
D) the dereference operator, <-.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
39
A function may return a pointer, but the programmer must ensure that the pointer

A) is pointing to an object that is still valid after the return of the function.
B) has been assigned an address.
C) was received as a parameter by the function.
D) has not previously been returned by another function.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
40
The ________ and ________ operators can respectively be used to increment and decrement a pointer variable.

A) dereferencing, indirection
B) modulus, division
C) ++, --
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
41
If Circle is a structure type, the statement Circle *pcirc;

A) defines a structure variable called *pcirc.
B) defines a structure pointer called pcirc.
C) is illegal in C++.
D) initializes a Circle pointer.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
42
It is possible for a structure to contain as a member a pointer to its own structure type.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
43
A reason for passing a pointer to a function is

A) to avoid the overhead of copying large data structures.
B) to allow the called function to modify a variable accessible to the calling function.
C) to allow easy access to data in the function that is being called.
D) A and B are both True.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
44
Every byte in the computer's memory is assigned a unique

A) value.
B) address.
C) dynamically allocated value.
D) name.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
45
The statement Rectangle * boxPtr; defines a variable boxPtr to be a pointer pointing to a type Rectangle.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
46
A statement that displays the address of the variable num1 is

A) cout << num1;.
B) cout << *num1;.
C) cout << &(*num1);.
D) cout << &num1;.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
47
A dangling pointer is a pointer

A) to a block of memory that has been deleted.
B) that has been declared, but has not yet been assigned a value.
C) that has not been initialized.
D) that has been assigned the value of null or null_ptr.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
48
When the ________ is placed in front of a variable name, it returns the address of that variable.

A) asterisk ( * )
B) conditional operator
C) ampersand ( & )
D) semicolon ( ; )
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
49
The statement cin >> *p;

A) stores the keyboard input into the variable p.
B) stores the keyboard input into the pointer called p.
C) is illegal in C++.
D) stores the keyboard input into the variable pointed to by p.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
50
The statement int *ptr = new int; acquires memory to hold an integer and then

A) initializes the allocated memory to 0.
B) assigns an integer value to the variable called ptr.
C) sets ptr to point to the allocated memory.
D) creates a new pointer called int.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following statements correctly deletes a dynamically-allocated array pointed to by p?

A) delete p;
B) p delete[ ];
C) delete [ ] p;
D) delete array p;
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
52
If dynamically allocated memory is not freed,

A) the system may run out of memory.
B) it results in a compiler error.
C) a run-time error informs your user that the program did not free memory space.
D) the source code will not link correctly.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
53
If s is a structure variable and p, a pointer, is a member of the structure, the statement cout << *s.p; will

A) output the dereferenced value pointed to by p.
B) result in a compiler error.
C) output the address stored in p.
D) output the value stored in s.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
54
An array name is a pointer constant because the address it represents cannot be changed during run-time.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
55
Any time you use the new operator, it is good practice to

A) use delete afterwards to free the memory allocated by new.
B) use a preprocessor directive.
C) clear the data from the old operator
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
56
A pointer variable may be initialized with

A) any non-zero integer value.
B) the address of an existing variable of the appropriate type.
C) A and B are both True.
D) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
57
If a variable occupies more than one byte of memory, its address is

A) the address of the last byte of storage allocated to it.
B) the average of the addresses used to store the variable.
C) the address of the first byte of storage allocated to it.
D) general delivery.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
58
The expression *s->p; is only meaningful if s is a pointer to a structure and p is a pointer that is a member of that structure.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
59
The ampersand (&) is used to dereference a pointer variable in C++.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
60
Dynamic memory allocation occurs

A) when a variable is created by the compiler.
B) when a variable is created at run-time.
C) when a pointer fails to dereference the right variable.
D) when a pointer is assigned an incorrect address.
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
61
A temporary value in a program can be referred to by at most one lvalue reference.
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
62
A ________________ keeps track of dynamically-allocated memory and automatically deletes when it is no longer in use.

A) deleting pointer
B) null pointer
C) smart pointer
D) memory conservation pointer
E) None of the above
Unlock Deck
Unlock for access to all 62 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 62 flashcards in this deck.