WorksheetsReference and Pointers in C++
Total questions: 10
Worksheet time: 30mins
What does this symbol allow for in C++? -> *
De-refrencing
Summing numbers
Making text more sparkly
Performing modular operations
What is the operator used for dereferencing or indirection?
*
&
%
&&
Specify whether the statement below is valid or invalid.
int i;
double * dp = &i;
Valid
Invalid
A pointer variable store a/an
value of another value.
value of another variable.
address of another pointer.
address of another variable.
Given the following declarations:
int i;
int *pi;
double d;
double *pd;
Specify whether the statements below is valid or invalid.
pi = &i;
Valid
Invalid
The __________, also known as the address operator, returns the memory address of a variable.
asterisk (* )
ampersand ( & )
percent sign ( % )
exclamation point ( ! )
What does the following statement do?
double *num2;
Declares a double variable named num2
Declares and initializes a pointer variable named num2
Initializes a pointer variable named num2
Declares a pointer variable named num2
Assuming ptr is a pointer variable, what will the following statement output?
cout << *ptr;
the value stored in the variable whose address is contained in ptr
the string "*ptr"
the address of the variable whose address is stored in ptr
the address of the variable stored in ptr
Which of the following statements displays the address of the variable numb?
cout << numb;
cout << *numb;
cin >> &numb;
cout << &numb;
Which of the following statements displays the address of the variable var?
cout << &var;
cout << *var;
cin >> var;
cout << var&;
