Chapter 12 Flashcards
True or false:
A pointer variable whose content is a memory address.
True
True or false:
In C++, pointer variables are declared using the reserved word pointer.
False
True or false:
In the statement:
int* p, q;
p and q are pointer variables.
False
True or false:
The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.
True
True or false:
In C++, the dot operator has a lower precedence than the dereferencing operator.
False
True or false:
In C++, the member access operator arrow is»_space;.
False
True or false:
Variables that are created during program execution are called static variables.
False
True or false:
Given the declaration
int *p;
The statement
p = new int[50];
dynamically allocates an array of 50 components of type int and p contains the base address of the array.
True
True or false:
A memory leak is an unused memory space that cannot be allocated.
True
True or false:
If p is a pointer variable, the statement p = p + 1; is valid in C++.
True
In C++, you declare a pointer by using the _______ symbol.
*
The code int *p; declared p to be a(n) _____ variable.
pointer
In C++, ________ is called the address of operator.
&
What is the value of x after the following statements execute?
int x = 25;
int *p;
p = &x;
*p = 46;
46
What is the output of the following statements?
int x = 33;
int *q;
q = &x;
cout «_space;*q «_space;endl;
33
What is the output of the following code?
int *p;
int x;
x = 76;
p = &x;
*p = 43;
cout «_space;x «_space;”, “ «_space;*p «_space;endl;
43, 43
What is the output of the following code?
int *p;
int x;
x = 12;
p = &x;
cout «_space;x «_space;”, “;
*p = 81;
cout «_space;*p «_space;endl;
12, 81