MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming (OOP) knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What will be the output of following program? |
| A. | main started |
| B. | main started hello from test() |
| C. | hello from test() main started |
| D. | compiler error: global objects are not allowed |
| Answer» D. compiler error: global objects are not allowed | |
| 2. |
#include using namespace std; int main() |
| A. | 35 |
| B. | 20 |
| C. | 25 |
| D. | 30 |
| Answer» C. 25 | |
| 3. |
What will be the values of x, m and n after execution of the following statements? Int x, m, n; |
| A. | x=25, m=10, n=15 |
| B. | x=27, m=10, n=15 |
| C. | x=26, m=11, n=16 |
| D. | x=27, m=11, n=16 |
| Answer» D. x=27, m=11, n=16 | |
| 4. |
#include using namespace std; |
| A. | compiler error |
| B. | 10 followed by garbage value |
| C. | 10 10 |
| D. | 10 0 |
| Answer» E. | |
| 5. |
class Test { int x; |
| A. | 0 |
| B. | garbage value |
| C. | compile time error |
| Answer» D. | |
| 6. |
#include using namespace std; class Point { |
| A. | compiler error |
| B. | constructor called constructor called |
| C. | constructor called |
| Answer» D. | |
| 7. |
Predict the output of following C++ program |
| A. | a non zero value |
| B. | 0 |
| C. | compile time error |
| D. | runtime error |
| Answer» B. 0 | |
| 8. |
Which of the following operators are overloaded by default by the compiler? |
| A. | both 1 and 2 |
| B. | only 1 |
| C. | only 2 |
| D. | none of the two |
| Answer» D. none of the two | |
| 9. |
Which of the following statements is correct for a static member function? |
| A. | only 1 is correct |
| B. | only 2 is correct |
| C. | both 1 and 2 are correct |
| D. | both 1 and 2 are incorrect |
| Answer» D. both 1 and 2 are incorrect | |
| 10. |
Which of the following is true about constructors. |
| A. | all 1, 2, and 3 |
| B. | only 1 and 3 |
| C. | only 1 and 2 |
| D. | only 2 and 3 |
| Answer» C. only 1 and 2 | |
| 11. |
Which of the following is true about the following program |
| A. | compiler error: cannot have two objects with same class name |
| B. | compiler error in line "::t.get();" |
| C. | compiles and runs fine |
| Answer» D. | |