C++ Ch.9 Pointers Flashcards

1
Q

Each byte in memory is assigned a unique _________.

A

Address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The ________ operator can be used to determine a variables address.

A

& (Address Operator)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

_________ variables are designed to hold addresses.

A

Pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The ________ operator can be used to work the variable a pointer points to.

A

Indirection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Array names can be used as ________, and vice versa.

A

Pointers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Creating variables while a program is running is called _________.

A

Dynamic memory allocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The _______ operator is used to dynamically allocate memory.

A

new

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Under old compilers, if the new operator cannot allocate the amount of memory requested it returns ______.

A

null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A pointer that contains the address 0 is called a(n) ________.

A

null pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When a program is finished with a chunk of dynamically allocated memory, it should free it with the _______ operator.

A

delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You should only use pointers with delete that were previously used with ________.

A

new

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Each byte of memory is assigned a unique address. (T/F)

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The * operator is used to get the address of a variable. (T/F)

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pointer variables are designed to hold addresses. (T/F)

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The & symbol is called the indirection operator. (T/F)

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The & operator dereferences a pointer. (T/F)

A

False

17
Q

When the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to. (T/F)

A

True

18
Q

Array names cannot be dereferenced with the indirection operator. (T/F)

A

False

19
Q

When you add a value to a pointer, you are actually adding that number times the size of the data type referenced by the pointer.
(T/F)

A

True

20
Q

The address operator is not needed to assign an array’s address to pointer. (T/F)

A

True

21
Q

You can change the address that an array name points to. (T/F)

A

False

22
Q

Any mathematical operation, including multiplication and division, may be performed on a pointer. (T/F)

A

False

23
Q

Pointers may be compared using the relational operators. (T/F)

A

True

24
Q

When used as function parameters, reference variables are much easier to work with than pointers. (T/F)

A

True

25
Q

The “new” operator dynamically allocates memory. (T/F)

A

True

26
Q

A pointer variable that has not been initialized is called a null pointer. (T/F)

A

False

27
Q

The address 0 is generally considered unusable. (T/F)

A

True

28
Q

In using a pointer with the “delete” operator, it is not necessary for the pointer to have been previously used with the “new” operator.
(T/F)

A

False