MCQOPTIONS
Saved Bookmarks
This section includes 9 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
which of this can not be declared as virtual |
| A. | Constructor |
| B. | Destructor |
| C. | Both A & B |
| D. | None of the above |
| E. | |
| Answer» D. None of the above | |
| 2. |
#include <iostream>using namespace std;int i;class LFC{public: ~LFC() { i=10; }};int foo(){ i=3; LFC ob; return i;} int main(){ cout << foo() << endl; return 0;}19.If the copy constructor receives its arguments by value, the copy constructor would |
| A. | Call one-argument constructor of the class |
| B. | Work without any problem |
| C. | Call itself recursively |
| D. | Call zero-argument constructor |
| Answer» D. Call zero-argument constructor | |
| 3. |
#include <iostream>using namespace std;class LFC{ private: int x; public: void LFC(){x=0; printf("Object created.");} void LFC(int a){x=a;}};int main(){ LFC s; return 0;} 18.What will be the output of the following program? |
| A. | 0 |
| B. | 10 |
| C. | 3 |
| D. | None of the above |
| Answer» C. 3 | |
| 4. |
#include <iostream>using namespace std;class LFC{ private: int x,y; public: void LFC(int a,int b) { x=a; y=b;}};int main(){ LFC s; return 0;}17.What will be the output of this program? |
| A. | Compile Time Error |
| B. | Object Created. |
| C. | Run Time Error |
| D. | Cannot be predicted |
| Answer» C. Run Time Error | |
| 5. |
#include <iostream>using namespace std;class LFC{ int x; public: LFC(short ss) { cout<< "Short" << endl; } LFC(int xx) { cout<< "Int" << endl; } LFC(float ff) { cout<< "Float" << endl; } ~LFC() { cout<< "Final"; }};int main(){ LFC *ptr = new LFC('F'); return 0; }16.What will be the output of this program? |
| A. | Compile Time Error |
| B. | Run Time Error |
| C. | No Error |
| D. | Warning |
| Answer» B. Run Time Error | |
| 6. |
#include <iostream>using namespace std;class LFC{ int *p; public: LFC(int xx, char ch) { p = new int(); *p = xx + int(ch); cout<< *p; } ~LFC() { delete p; }};int main(){ LFC obj(15, 'A'); return 0;}15.Which of the following is true about the following program |
| A. | The program will print the output Short . |
| B. | The program will print the output Final . |
| C. | The program will print the output Float . |
| D. | The program will print the output Int. |
| Answer» E. | |
| 7. |
#include <iostream>using namespace std;class LFC{ int x; public: LFC(); ~LFC(); void Show() const;};LFC::LFC(){ x = 50;}void LFC::Show() const{ cout<< x;}int main(){ LFC obj; obj.Show(); return 0; }14.Which of the following statement is correct about the program given below? |
| A. | The program will print the output 80. |
| B. | The program will print the output 112. |
| C. | The program will print the output garbage value. |
| D. | The program will report compile time error. |
| Answer» B. The program will print the output 112. | |
| 8. |
#include <iostream>using namespace std;class LFC{ public: LFC() { cout<< "find"; } ~LFC() { cout<< "course"; }};int main(){ LFC obj; return 0;}13.What is the output of this program? |
| A. | The program will print the output 50. |
| B. | The program will print the output Garbage-value. |
| C. | The program will report compile time error. |
| D. | The program will report runtime error. |
| Answer» D. The program will report runtime error. | |
| 9. |
#include <iostream>using namespace std;class LFC{ int x; public: LFC(int xx, float yy) { cout<< char(yy); }};int main(){ LFC *p = new LFC(35, 99.50f); return 0;}12.What is the output of this program? |
| A. | The program will print the output find. |
| B. | The program will print the output course. |
| C. | The program will print the output findcourse. |
| D. | The program will report compile time error. |
| Answer» D. The program will report compile time error. | |