Select an option to see the answer and solution.
Pointers and References in C++
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
98
Questions
4/5
Page
Pick an option on a question to see the right answer and solution.
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char const *argv[])
{
int a = 5;
int *p = &a;
int *(&q) = p;
cout<<q;
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int f(int &x, int c)
{
c = c - 1;
if (c == 0) return 1;
x = x + 1;
return f(x, c) * x;
}
int main(int argc, char const *argv[])
{
int a = 4;
cout<<f(a,a);
return 0;
}Select an option to see the answer and solution.
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char const *argv[])
{
int &q = NULL;
cout<<q;
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char const *argv[])
{
int &q = 5;
cout<<q;
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int main()
{
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << *arr + 9;
return 0;
}Select an option to see the answer and solution.
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char const *argv[])
{
int &p;
int a = 5;
&p = a;
cout<<p;
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int main()
{
char arr[20];
int i;
for(i = 0; i < 10; i++)
*(arr + i) = 65 + i;
*(arr + i) = '\0';
cout << arr;
return(0);
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
int(*p[5])();Select an option to see the answer and solution.
int a = 100, b = 200;
int *p = &a, *q = &b;
p = q;Select an option to see the answer and solution.
#include <iostream>
using namespace std;
#define PI 3.14159
int main ()
{
float r = 2;
float circle;
circle = 2 * PI * r;
cout << circle;
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.