A
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
A
A
A
#include
using namespace std;
void function(int num1, int num2 = 12)
{
cout << "1st Number: " << num1<
cout << "2nd Number: " << num2<
}
int main()
{
function(2);
function(5, 7);
return 0;
}
A
#include
#include
using namespace std;
string askMessage(string Message = "Please enter a message: ");
int main()
{
string Input = askMessage();
cout << "Here is your message: " << Input;
return 0;
}
string askMessage(string Message)
{
string Input;
cout << Message;
cin >> Input;
return Input;
}
A
#include
using namespace std;
void function(int p, bool condition = true)
{
if (condition == true )
{
cout << "Condition is true. P = " << p;
}
else
{
cout << "Condition is false. P = " << p;
}
}
int main()
{
function(250, false);
return 0;
}
A
A
A
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