MCQOPTIONS
Saved Bookmarks
This section includes 81 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented System Design knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which operator is having right to left associativity in the following? |
| A. | array subscripting |
| B. | function call |
| C. | addition and subtraction |
| D. | type cast |
| Answer» E. | |
| 2. |
Which of the following interface determines how your program will be used by other program? |
| A. | public |
| B. | private |
| C. | protected |
| D. | none of these |
| Answer» B. private | |
| 3. |
Which of the following is FALSE about references in C++ |
| A. | a reference must be initialized when declared |
| B. | once a reference is created, it cannot be later made to reference another object; it cannot be reset |
| C. | references cannot be null |
| D. | references cannot refer to constant value |
| Answer» E. | |
| 4. |
When an argument is passed by reference |
| A. | a variable is created in the function to hold the argument’s value. |
| B. | the function cannot access the argument’s value. |
| C. | a temporary variable is created in the calling program to hold the argument’s value. |
| D. | the function accesses the argument’s original value in the calling program. |
| Answer» E. | |
| 5. |
Which of the following is true about inline functions and macros. |
| A. | inline functions do type checking for parameters, macros don't |
| B. | macros cannot have return statement, inline functions can |
| C. | macros are processed by pre-processor and inline functions are processed in later stages of compilation. |
| D. | all of the above |
| Answer» E. | |
| 6. |
In a class definition, data or functions designated private are accessible |
| A. | to any function in the program. |
| B. | only if you know the password. |
| C. | to member functions of that class. |
| D. | only to public members of the class. |
| Answer» D. only to public members of the class. | |
| 7. |
The extraction operator (>>) stops reading a string when it encounters a space. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 8. |
Predict the output?#include using namespace std;class Test{int x;Test() { x = 5;}};int main(){Test *t = new Test; cout |
| A. | compile time error |
| B. | garbage |
| C. | 5 |
| Answer» B. garbage | |
| 9. |
Which function will change the state of the object? |
| A. | only set() |
| B. | only display() |
| C. | display() and set() both |
| D. | none of the above |
| Answer» B. only display() | |
| 10. |
What value will be printed for data.i? |
| A. | 10 220.5 230.5 unpredictable value |
| B. | 220 |
| C. | 230.5 |
| D. | unpredictable value |
| Answer» E. | |
| 11. |
A static local variable is used to |
| A. | make a variable visible to several functions. |
| B. | make a variable visible to only one function. |
| C. | retain a value when a function is not executing. |
| D. | b and c |
| Answer» E. | |
| 12. |
Under what conditions a destructor destroys an object? |
| A. | scope of existence has finished |
| B. | object dynamically assigned and it is released using the operator delete. |
| C. | program terminated. |
| D. | both a and b. |
| Answer» E. | |
| 13. |
#include using namespace std; class Point {public:Point() { cout |
| A. | compiler error |
| B. | constructor called constructor called |
| C. | constructor called |
| Answer» D. | |
| 14. |
#include using namespace std;class X{public:int x;};int main(){X a = {10};X b = a;cout |
| A. | compiler error |
| B. | 10 followed by garbage value |
| C. | 10 10 |
| D. | 10 0 |
| Answer» E. | |
| 15. |
How many values can be returned from a function? |
| A. | 0 |
| B. | 1 |
| C. | 2 |
| D. | 3 |
| Answer» C. 2 | |
| 16. |
When a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 17. |
Overloaded functions |
| A. | are a group of functions with the same name. |
| B. | all have the same number and types of arguments. |
| C. | make life simpler for programmers. |
| D. | a and c |
| Answer» E. | |
| 18. |
Which of the followings is/are automatically added to every class, if we do not write our own. |
| A. | copy constructor |
| B. | assignment operator |
| C. | a constructor without any parameter |
| D. | all |
| Answer» E. | |
| 19. |
Is it fine to call delete twice for a pointer?#include using namespace std;int main(){int *ptr = new int; delete ptr;delete ptr; return 0;} |
| A. | yes |
| B. | no |
| Answer» C. | |
| 20. |
Can constructors be overloaded? |
| A. | true |
| B. | false |
| Answer» B. false | |
| 21. |
Every class has at least one constructor function, even when none is declared. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 22. |
Which of the following feature is not supported by C++? |
| A. | exception handling |
| B. | reflection |
| C. | operator overloading |
| D. | namespace |
| Answer» C. operator overloading | |
| 23. |
In an assignment statement, the value on the left of the equal sign is always equal to the value on the right. |
| A. | true |
| B. | false |
| Answer» C. | |
| 24. |
The main intention of using inheritance is …......... |
| A. | to help in converting one data type to other |
| B. | to hide the details of base class |
| C. | to extend the capabilities of base class |
| D. | to help in modular programming |
| Answer» D. to help in modular programming | |
| 25. |
Which one of the following is not a fundamental data type in C++? |
| A. | float |
| B. | string |
| C. | int |
| D. | char |
| Answer» C. int | |
| 26. |
Functions can returns |
| A. | arrays |
| B. | references |
| C. | objects |
| D. | all of above |
| Answer» E. | |
| 27. |
C++ was originally developed by …....... |
| A. | donald knuth |
| B. | bjarne sroustrups |
| C. | dennis ritchie |
| D. | none of these |
| Answer» C. dennis ritchie | |
| 28. |
Which of the following operators are overloaded by default by the compiler?1) Comparison Operator ( == )2) Assignment Operator ( = ) |
| A. | both 1 and 2 |
| B. | only 1 |
| C. | only 2 |
| D. | none of the two |
| Answer» D. none of the two | |
| 29. |
If particular software can be used in some other application than the one for which it is created then it reveals …......... |
| A. | data binding |
| B. | data reusability |
| C. | data encapsulation |
| D. | none of these |
| Answer» C. data encapsulation | |
| 30. |
Which type of class has only one unique value for all the objects of that same class? |
| A. | this |
| B. | friend |
| C. | static |
| D. | both a and b |
| Answer» D. both a and b | |
| 31. |
Which of the following can legitimately be passed to a function? |
| A. | a constant |
| B. | a variable |
| C. | a structure |
| D. | all of the above |
| Answer» E. | |
| 32. |
Dividing a program into functions |
| A. | is the key to object-oriented programming. |
| B. | makes the program easier to conceptualize. |
| C. | may reduce the size of the program. |
| D. | option b and c |
| Answer» E. | |
| 33. |
In C++ there can be an array of four dimensions. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 34. |
The operators that cannot be overloaded is |
| A. | * |
| B. | - |
| C. | :: |
| D. | () |
| Answer» D. () | |
| 35. |
In object oriented programming the focus is on …....... |
| A. | data |
| B. | structure |
| C. | function |
| D. | pointers |
| Answer» B. structure | |
| 36. |
In C++, const qualifier can be applied toMember functions of a classFunction argumentsTo a class data member which is declared as staticReference variables |
| A. | only 1, 2 and 3 |
| B. | only 1, 2 and 4 |
| C. | all |
| D. | only 1, 3 and 4 |
| Answer» D. only 1, 3 and 4 | |
| 37. |
C++ programmers concentrate on creating , which contain data members and the member functions that manipulate those data members and provide services to clients. |
| A. | structures |
| B. | classes |
| C. | objects |
| D. | function |
| Answer» C. objects | |
| 38. |
#include using namespace std; int main(){int a;a = 5 + 3 * 5;cout |
| A. | 35 |
| B. | 20 |
| C. | 25 |
| D. | 30 |
| Answer» C. 25 | |
| 39. |
The only integer that can be assigned directly to a pointer is |
| A. | 0 |
| B. | -1 |
| C. | 999 |
| D. | -999 |
| Answer» B. -1 | |
| 40. |
In procedural programming the focus in on …........... |
| A. | data |
| B. | structure |
| C. | function |
| D. | pointers |
| Answer» D. pointers | |
| 41. |
Empty parentheses following a function name in a function prototype indicate that the function does not require any parameters to perform its task. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 42. |
Which of the following is true about the following program#include class Test{public:int i;void get();};void Test::get(){std::cout i;}Test t; // Global object int main(){Test t; // local object t.get();std::cout |
| 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. | |
| 43. |
You should prefer C-strings to the Standard C++ string class in new programs. |
| A. | true |
| B. | false |
| Answer» C. | |
| 44. |
When an array name is passed to a function, the function |
| A. | accesses exactly the same array as the calling program. |
| B. | refers to the array using a different name than that used by the calling program. |
| C. | refers to the array using the same name as that used by the calling program. |
| D. | a and b |
| Answer» E. | |
| 45. |
Which of the following is true about constructors.They cannot be virtual. They cannot be private.They are automatically called by new operator |
| 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 | |
| 46. |
Which of the following operators allow defining the member functions of a class outside the class? |
| A. | :: |
| B. | ? |
| C. | :? |
| D. | % |
| Answer» B. ? | |
| 47. |
For the object for which it was called, a const member function |
| A. | can modify both const and non-const member data. |
| B. | can modify only const member data. |
| C. | can modify only non-const member data. |
| D. | can modify neither const nor non-const member data. |
| Answer» E. | |
| 48. |
Classes are useful because they |
| A. | can closely model objects in the real world. |
| B. | permit data to be hidden from other classes. |
| C. | bring together all aspects of an entity in one place. |
| D. | options a, b and c |
| Answer» E. | |
| 49. |
When arguments are passed by value, the function works with the original arguments in the calling program. |
| A. | true |
| B. | false |
| Answer» C. | |
| 50. |
What is value of size? |
| A. | 28 |
| B. | 32 |
| C. | 20 |
| D. | 24 |
| Answer» D. 24 | |