Dear candidates you will find MCQ questions of C++ here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
U
Q. What is the output of this program?
#include using namespace std; int function(int p = 12, int q) { int s; s = p + q; return s; } int main() { cout << function(15); return 0; }
U
Q. What is the default return type of a function?
U
Q. If we start our function call with default arguments means, what will be proceeding arguments?
U
Q. What we can’t place followed by the non-default arguments?
U
Q. What is the output of this program?
#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; }
U
Q. What is the output of this program?
#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; }
U
Q. What is the output of this program?
#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; }
U
Q. Which value will it take when both user and default values are given?
U
Q. Where can the default parameter be placed by the user?
U
Q. If the user did not supply the value, what value will it take?
Don't have account? Register here.