Question
QUESTION 1 The deference operator accesses the ___________ of a pointer variable? a. value b. pointer c. address d. binky QUESTION 2 What will the
QUESTION 1
The deference operator accesses the ___________ of a pointer variable?
a. | value | b. | pointer | c. | address | d. | binky |
QUESTION 2
What will the following code output?
int number = 22;
int *var = &number;
cout << var << endl;
An asterisk followed by the address of the number variable | ||
The address of the number variable | ||
22 | ||
An asterisk followed by 22 |
QUESTION 3
An array name is a constant pointer to the first element in the array.
True
False
QUESTION 4
A function may return a pointer, but the programmer must ensure that the pointer ________.
a. | has not previously been returned by another function | b. | Still points to a valid object or variable after the function ends | c. | has not been assigned an address | d. | No other answer applies | e. | was received as a parameter by the function |
QUESTION 5
Where does the last pointer in a linked-list point to?
We don't set the last pointer value. | ||
To NULL. | ||
To head. | ||
To itself. |
QUESTION 6
Which operation on a linked-list is faster than doing the same operation on a vector(array).
Inserting an element at the end. | ||
Accessing the last element. | ||
Inserting an element at the beginning. | ||
Accessing the middle element. |
QUESTION 7
Assuming myValues is an array of int values, and index is an int variable, both of the following statements do the same thing.
cout << myValues[index] << endl;
cout << *(myValues + index) << endl;
True
False
QUESTION 8
Given the following struct defination:
struct C
{
double x;
int y;
}; C U; C *Cptr = &U; What is the valid expression to access the y member of the C struct via the Cptr pointer?
a. | cout << Cptr.y << endl; | b. | cout << c->y << endl; | c. | cout << C.y << endl; | d. | cout << Cptr->y << endl; |
QUESTION 9
Select a correct answer for the following code.
int *pValue = new int;
*pValue = 45;
pValue = new int;
*pValue =55;
cout << *pValue << endl;
a. | 45 and 55 are stored in different memory locations. | |
b. | The memory space that originally stores 45 can still be accessed. | |
c. | None of the above is correct. | |
d. | The memory space that originally stores 45 finally stores 55. |
QUESTION 10
The ________, also known as the address operator, returns the memory address of a variable.
ampersand ( & ) | exclamation point ( ! ) | None of these | asterisk ( * ) | percent sign (%) |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started