ExamVeda
Login
Home
51
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
 
using namespace std;
 
int main(int argc, char const *argv[])
{
	int a = 5;
	int &q = a;
	cout<<&a<<endl;
	cout<<&q<<endl;
	return 0;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
52
The pointer can point to any variable that is not declared with which of these?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
53
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void swap(int &a, int &b);
int main()
{
    int a = 5, b = 10;
    swap(a, b);
    cout << "In main " << a << b;
    return 0;
}
void swap(int &a, int &b)
{
    int temp;
    temp = a;
    a = b;
    b = temp;
    cout << "In swap " << a << b;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
54
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int a = 5, b = 10, c = 15;
    int *arr[ ] = {&a, &b, &c};
    cout << arr[1];
    return 0;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
55
What will be the output of the following C++ code?
#include<iostream>
using namespace std;
 
int main()
{
   int x = 10;
   int& ref = x;
   ref = 20;
   cout << x << endl ;
   x = 30;
   cout << ref << endl;
   return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
56
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int a[2][4] = {3, 6, 9, 12, 15, 18, 21, 24};
    cout << *(a[1] + 2) << *(*(a + 1) + 2) << 2[1[a]];
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
57
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int i;
    const char *arr[] = {"C", "C++", "Java", "VBA"};
    const char *(*ptr)[4] = &arr;
    cout << ++(*ptr)[2];
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
58
Pick the correct statement about references in C++.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
59
A void pointer cannot point to which of these?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
60
Identify the correct sentence regarding inequality between reference and pointer.
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board