Explore topic-wise MCQs in C++ Programming.

This section includes 5 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the output of this program?
#include 
using namespace std;
int main()
{
/* this is comment*
cout << "Interview Mania";
return 0;
}

A. Interview Mania
B. Compilation Error
C. Runtime Error
D. Garbage value
E. None of these
Answer» C. Runtime Error
2.

What is the output of this program?
#include 
using namespace std;
int add(int p, int q);
int main()
{
int k = 7, L = 9;
cout << add(k, L) << endl;
return 0;
}
int add(int p, int q )
{
int sum = p + q;
p = 10;
return p + q;
}

A. 7
B. 9
C. 10
D. 19
E. None of these
Answer» E. None of these
3.

What is the output of this program?
#include 
using namespace std;
void square (int *p)
{
*p = (*p + 3) * (*p);
}
int main ( )
{
int n = 15;
square(&n);
cout << n;
return 0;
}

A. 207
B. 270
C. 15
D. 3
E. None of these
Answer» C. 15
4.

What is the output of this program?
#include 
using namespace std;
long fact (long p)
{
if (p > 1)
return (p * fact (p + 1));
else
return (1);
}
int main ()
{
long n = 6;
cout << n << "! = " << fact ( n );
return 0;
}

A. 1
B. 6
C. segmentation fault
D. compile time error
E. None of these
Answer» D. compile time error
5.

How many types of comments are there in c++?

A. 4
B. 3
C. 2
D. 1
E. None of these
Answer» D. 1