MCQOPTIONS
 Saved Bookmarks
				This section includes 97 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Engineering (CSE) knowledge and support exam preparation. Choose a topic below to get started.
| 1. | 
                                    #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. | |
| 2. | 
                                    #include using namespace std; class Point { public: Point() { cout | 
                            
| A. | compiler error | 
| B. | constructor called constructor called | 
| C. | constructor called | 
| Answer» D. | |
| 3. | 
                                    Output of following program? #include using namespace std; class Point { Point() { cout | 
                            
| A. | compile time error | 
| B. | run time error | 
| C. | constructor called | 
| Answer» B. run time error | |
| 4. | 
                                    When a copy constructor may be called? | 
                            
| A. | when an object of the class is returned by value | 
| B. | when an object of the class is passed (to a function) by value as an argument | 
| C. | when an object is constructed based on another object of the same class | 
| D. | all | 
| Answer» E. | |
| 5. | 
                                    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. | |
| 6. | 
                                    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. | |
| 7. | 
                                    What happens when delete is used for a NULL pointer? int *ptr = NULL; delete ptr; | 
                            
| A. | compile time error | 
| B. | run time error | 
| C. | no effect | 
| Answer» D. | |
| 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 of the following is true about new when compared with malloc. 1) new is an operator, malloc is a function 2) new calls constructor, malloc doesn't 3) new returns appropriate pointer, malloc returns void * and pointer needs to typecast to appropriate type. | 
                            
| A. | 1 and 3 | 
| B. | 2 and 3 | 
| C. | 1 and 2 | 
| D. | all 1,2,3 | 
| Answer» D. all 1,2,3 | |
| 10. | 
                                    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. | |
| 11. | 
                                    class Test { int x; }; int main() { Test t; cout | 
                            
| A. | 0 | 
| B. | garbage value | 
| C. | compile time error | 
| Answer» D. | |
| 12. | 
                                    Predict the output of following C++ program #include using namespace std; class Empty {}; int main() { cout | 
                            
| A. | a non zero value | 
| B. | 0 | 
| C. | compile time error | 
| D. | runtime error | 
| Answer» B. 0 | |
| 13. | 
                                    What is the difference between struct and class in C++? | 
                            
| A. | all members of a structure are public and structures don't have constructors and destructors | 
| B. | members of a class are private by default and members of struct are public by default. when deriving a struct from a class/struct, default access-specifier for a base class/struct is public and when deriving a class, default access specifier is private. | 
| C. | all members of a structure are public and structures don't have virtual functions | 
| D. | all above | 
| Answer» C. all members of a structure are public and structures don't have virtual functions | |
| 14. | 
                                    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 | |
| 15. | 
                                    What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor? | 
                            
| A. | compile-time error | 
| B. | preprocessing error | 
| C. | runtime error | 
| D. | runtime exception | 
| Answer» B. preprocessing error | |
| 16. | 
                                    Which of the following statements is correct for a static member function? 1. It can access only other static members of its class. ï‚· It can be called using the class name, instead of objects | 
                            
| 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 | |
| 17. | 
                                    How many objects can be created from an abstract class? | 
                            
| A. | zero | 
| B. | one | 
| C. | two | 
| D. | as many as we want | 
| Answer» B. one | |
| 18. | 
                                    Which of the following data type does not return anything? | 
                            
| A. | int | 
| B. | short | 
| C. | long | 
| D. | void | 
| Answer» E. | |
| 19. | 
                                    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 | |
| 20. | 
                                    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 | |
| 21. | 
                                    Which feature of C++ contain the concept of super class and subclass? | 
                            
| A. | class and object | 
| B. | encapsulation | 
| C. | abstraction | 
| D. | inheritance | 
| Answer» E. | |
| 22. | 
                                    Which of the following approach is adopted in C++? | 
                            
| A. | top down | 
| B. | bottom up | 
| C. | horizontal | 
| D. | vertical | 
| Answer» C. horizontal | |
| 23. | 
                                    Which of the following feature of object oriented program is false? | 
                            
| A. | data and functions can be added easily | 
| B. | data can be hidden from outside world | 
| C. | object can communicate with each other | 
| D. | the focus is on procedures | 
| Answer» E. | |
| 24. | 
                                    C++ was originally developed by …....... | 
                            
| A. | donald knuth | 
| B. | bjarne sroustrups | 
| C. | dennis ritchie | 
| D. | none of these | 
| Answer» C. dennis ritchie | |
| 25. | 
                                    In object oriented programming the focus is on …....... | 
                            
| A. | data | 
| B. | structure | 
| C. | function | 
| D. | pointers | 
| Answer» B. structure | |
| 26. | 
                                    Which of the following feature of procedure oriented program is false? | 
                            
| A. | makes use of bottom up approach | 
| B. | functions share global data | 
| C. | the most fundamental unit of program is function | 
| D. | all of these | 
| Answer» B. functions share global data | |
| 27. | 
                                    In procedural programming the focus in on …........... | 
                            
| A. | data | 
| B. | structure | 
| C. | function | 
| D. | pointers | 
| Answer» D. pointers | |
| 28. | 
                                    Which operator is having the highest precedence? | 
                            
| A. | postfix | 
| B. | unary | 
| C. | shift | 
| D. | equality | 
| Answer» B. unary | |
| 29. | 
                                    #include using namespace std; int main() { int a; a = 5 + 3 * 5; cout | 
                            
| A. | 35 | 
| B. | 20 | 
| C. | 25 | 
| D. | 30 | 
| Answer» C. 25 | |
| 30. | 
                                    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. | |
| 31. | 
                                    Which of the following ways are legal to access a class data member using this pointer? | 
                            
| A. | this->x | 
| B. | this.x | 
| C. | *this.x | 
| D. | *this-x | 
| Answer» B. this.x | |
| 32. | 
                                    Which of the following is the correct class of the object cout? | 
                            
| A. | iostream | 
| B. | istream | 
| C. | ostream | 
| D. | ifstream | 
| Answer» D. ifstream | |
| 33. | 
                                    Which of the following functions are performed by a constructor? | 
                            
| A. | construct a new class | 
| B. | construct a new object | 
| C. | construct a new function | 
| D. | initialize objects | 
| Answer» E. | |
| 34. | 
                                    Which of the following approach is adapted by C++? | 
                            
| A. | top-down | 
| B. | bottom-up | 
| C. | right-left | 
| D. | left-right | 
| Answer» C. right-left | |
| 35. | 
                                    What will be the values of x, m and n after execution of the following statements? Int x, m, n; m=10; n=15; 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 | |
| 36. | 
                                    Which of the following control expressions are valid for an if statement? | 
                            
| A. | an integer expression | 
| B. | a boolean expression | 
| C. | either a or b | 
| D. | neither a nor b | 
| Answer» D. neither a nor b | |
| 37. | 
                                    Functions can returns | 
                            
| A. | arrays | 
| B. | references | 
| C. | objects | 
| D. | all of above | 
| Answer» E. | |
| 38. | 
                                    Which of the following statements is false? | 
                            
| A. | every c++ program must have a main(). | 
| B. | in c++, white spaces and carriage returns are ignored by the compiler. | 
| C. | c++ statements terminate with semicolon. | 
| D. | main() terminates with semicolon. | 
| Answer» E. | |
| 39. | 
                                    The following is the C++ style comment | 
                            
| A. | // | 
| B. | /*..*/ | 
| C. | – | 
| D. | none of above | 
| Answer» B. /*..*/ | |
| 40. | 
                                    Which type is best suited to represent the logical values? | 
                            
| A. | integer | 
| B. | boolean | 
| C. | character | 
| D. | all of the mentioned | 
| Answer» C. character | |
| 41. | 
                                    In C++, const qualifier can be applied to ï‚·Member functions of a class ï‚·Function arguments ï‚·To a class data member which is declared as static ï‚·Reference 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 | |
| 42. | 
                                    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. | |
| 43. | 
                                    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 | |
| 44. | 
                                    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 | |
| 45. | 
                                    What will be the output of following program? #include using namespace std; class Test{ public: Test() { cout | 
                            
| 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 | |
| 46. | 
                                    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. | |
| 47. | 
                                    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 | |
| 48. | 
                                    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 | |
| 49. | 
                                    The operators that cannot be overloaded is | 
                            
| A. | * | 
| B. | - | 
| C. | :: | 
| D. | () | 
| Answer» D. () | |
| 50. | 
                                    Which of the following feature is not supported by C++? | 
                            
| A. | exception handling | 
| B. | reflection | 
| C. | operator overloading | 
| D. | namespace | 
| Answer» C. operator overloading | |