Explore topic-wise MCQs in C++ Programming.

This section includes 8 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 function(int N, int M, int O)
{
return N + M;
}
double function(double N, double M, double O)
{
return N + M;
}
int main()
{
cout << function(7, 16);
cout << function(15.05, 61.16);
return 0;
}

A. 7
B. 16
C. 15.05
D. 61.15
E. Compilation Error
Answer» F.
2.

What is the output of this program?
#include 
using namespace std;
void function(int n)
{
cout << n< }
void function(double m)
{
cout << m;
}
int main(void)
{
function(10);
function(50.36);
return 0;
}

A. 10 50.36
B. 50.36 10
C. 10 50
D. All of above
E. None of these
Answer» B. 50.36 10
3.

What is the output of the following program?
#include 
using namespace std;
int calculate(int p, int q)
{
return (p * q);
}
float calculate (float p, float q)
{
return (p / q);
}
int main()
{
int n = 10, m = 3;
float r = 30.0, s = 10.0;
cout << calculate(n, m) < cout << calculate (r, s);
return 0;
}

A. 10 3
B. 30.0 10.0
C. 30 3
D. Compilation Error
E. None of these
Answer» D. Compilation Error
4.

What are the advantages of passing arguments by reference?

A. There is no need to call constructors for parameters (i.e. faster)
B. Changes to parameter values within the function also affect the original arguments.
C. There is need to copy parameter values (i.e. less memory used)
D. All of above
E. None of these
Answer» E. None of these
5.

Which of the following permits function overloading on c++?

A. type & number of arguments
B. number of arguments
C. type
D. All of above
E. None of these
Answer» B. number of arguments
6.

When our function doesn t need to return anything means what will we use/send as parameter in function?

A. blank space
B. void
C. both blank space & void
D. All of above
E. None of these
Answer» B. void
7.

What will happen while using pass by reference

A. The location of variable in memory is passed to the function so that it can use the same memory area for its processing
B. The function declaration should contain ampersand (& in its type declaration)
C. The values of those variables are passed to the function so that it can manipulate them
D. All of above
E. None of these
Answer» B. The function declaration should contain ampersand (& in its type declaration)
8.

Overloaded functions are

A. Two or more functions with the same name but different number of parameters or type
B. Very long functions that can hardly run
C. One function containing another one or more functions inside it
D. All of above
E. None of these
Answer» B. Very long functions that can hardly run