Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C++ Programming
»
References
What will be the output of the following program? #include
class CuriousTabTest { public: CuriousTabTest(int &x, int &y) { x++; y++; } }; int main() { int a = 10, b = 20; CuriousTabTest objBT(a, b); cout<< a << " " << b; return 0; }
10 20
11 21
Garbage Garbage
It will result in a compile time error.
Correct Answer:
11 21
← Previous Question
Next Question→
More Questions from
References
Which of the following statement is correct about the program given below? #include
int main() { int x = 0; int &y = x; y = 5; while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; }
Which of the following statement is correct about the program given below? #include
int main() { int x = 10; int &y = x; x = 25; y = 50; cout<< x << " " << --y; return 0; }
Which of the following statement is correct about the program given below? #include
int main() { int m = 2, n = 6; int &x = m++; int &y = n++; m = x++; x = m++; n = y++; y = n++; cout<< m << " " << n; return 0; }
Which of the following statement is correct about the program given below? #include
class Tab { int x, y; public: Tab(int x, int y) { this->x = x; this->y = y; } void Display() { cout<< x << " " << y; } }; int main() { int x = 50; int &y = x ; Tab b(y, x); return 0; }
Which of the following statements is correct? A reference is not a constant pointer. A referenced is automatically de-referenced.
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments