A
Q. What is the output of the following code?
Code:#include <iostream>
using namespace std;
int main()
{
char *p;
char str[] = "StackHowTo";
p = str;
p += 5;
cout << p;
return 0;
}
Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.
To check the correct answer, simply click the View Answer button provided for each question.
Have your own questions to contribute? Click the button below to share your MCQs with others!
+ Add QuestionA
#include <iostream>
using namespace std;
int main()
{
char *p;
char str[] = "StackHowTo";
p = str;
p += 5;
cout << p;
return 0;
}
A
A
#include <iostream>
using namespace std;
void carree(int *x)
{
*x = (*x + 1) * (*x);
}
int main()
{
int n = 10;
carree(&n);
cout << n;
return 0;
}
A
A
#include <iostream>
using namespace std;
int sum(int x, int y);
int main()
{
int i = 1, j = 2;
cout << sum(i, j) << endl;
return 0;
}
int sum(int x, int y )
{
int s = x + y;
x = 2;
return x + y;
}
A
A
#include <iostream>
using namespace std;
void Sum(int a, int b, int & c)
{
a = b + c;
b = a + c;
c = a + b;
}
int main()
{
int a = 2, b =1;
Sum(a, b, b);
cout << a << " " << b;
return 0;
}
A
#include <iostream>
using namespace std;
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int *ptr = (arr + 1);
cout << *arr + 2;
return 0;
}
A
#include <iostream>
using namespace std;
main()
{
double x = 15.564702;
float y = 5.99;
int z ,w;
z = (int) x;
w = (int) y;
cout << z <<<< w;
return 0;
}
A
If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.
Share Your MCQ