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 <iostream> #include <iomanip> using namespace std; void showDate(int mm, int dd, int yy) { cout << setfill('0'); cout << setw(2) << mm << '/' << setw(2) << dd << '/' << setw(4) << yy << endl; } int main() { showDate(1, 1, 2019); return 0; }
U
Q. Which function allows you to set minimum width for the next input?
U
Q. Choose the correct formatted code.
U
Q. What is the use of the indentation in c++?
U
Q. 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; }
U
Q. 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; }
U
Q. 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; }
U
Q. What is used to write multi line comment in c++?
U
Q. What is the output of this program?
#include using namespace std; int main() { /* this is comment*\ cout << "Uday"; return 0; }
U
Q. What type of comments does c++ support?
Don't have account? Register here.