References
- What does a reference provide?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Because we are pointing memory address using the temp variable.
- What is the output of this program?
#include
using namespace std;
int main()
{
int num = 11;
int & numref = num;
num++;
cout << "The value of num is " << numref;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The value is declared and it isincrementedrement, so it’s value is 11.
- What is the output of this program?
#include
using namespace std;
void print (char * str)
{
cout << str << endl;
}
int main ()
{
const char * str = "Interview Mania";
print(const_cast(str) );
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In this program we used the concept of constant casting to cast the variable and printing it.
- Identify the correct sentence regarding inequality between reference and pointer.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
we can not create the array of reference
- Pick out the correct statement.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The NULL pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to NULL