MCQOPTIONS
Saved Bookmarks
This section includes 144 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Mcqs knowledge and support exam preparation. Choose a topic below to get started.
| 101. |
Which of the following is the perfect set of operators that can’t be overloaded in CPP ? |
| A. | +=, ?, :: , >> |
| B. | >>, < |
| C. | :: , . , .* , ?: |
| D. | :: , ->, * , new, delete |
| Answer» D. :: , ->, * , new, delete | |
| 102. |
__________________ is the OOP feature and mechanism that binds together code and the data it manipulates, and keep both safe from outside world. |
| A. | Data Binding |
| B. | Data Encapsulation |
| C. | Data Storing |
| D. | Data Abstraction |
| Answer» C. Data Storing | |
| 103. |
Static variable in a class is initialized when _____ . |
| A. | every object of the class is created. |
| B. | last object of the class is created. |
| C. | first object of the class is created. |
| D. | No need to initialize static variable. |
| Answer» D. No need to initialize static variable. | |
| 104. |
Which of the followings are true about Virtual functions? |
| A. | They must be non-static member function of the class |
| B. | They cannot be friends |
| C. | Constructor Functions cannot be virtual |
| D. | All of these |
| Answer» E. | |
| 105. |
Which of the followings is/are not keyword/s in CPP? 1. asm 2. boolean 3. mutable 4. export 5. constant_cast |
| A. | Only 5 |
| B. | Only 1 and 4 |
| C. | Only 1,2 and 5 |
| D. | Only 2 and 5 |
| Answer» E. | |
| 106. |
Return type of uncaught_exception() is ________________ . |
| A. | int |
| B. | bool |
| C. | char * |
| D. | double |
| Answer» C. char * | |
| 107. |
Can we write throw clause inside catch handler? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 108. |
Runtime polymorphism is achieved only when a virtual function is accessed through a pointer to the base class. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 109. |
Find the wrong statement/s about Abstract Class. |
| A. | We can’t create its objects. |
| B. | We can’t create pointers to an abstract class. |
| C. | It contains at least one pure virtual function. |
| D. | We can create references to an abstract class. |
| Answer» C. It contains at least one pure virtual function. | |
| 110. |
If an argument to a function is declared as const, then _______ . |
| A. | function can modify the argument. |
| B. | Function can’t modify the argument. |
| C. | const argument to a function is not possible. |
| D. | None of these |
| Answer» C. const argument to a function is not possible. | |
| 111. |
Assigning one or more function body to the same name is called ____________ . |
| A. | Function Overriding |
| B. | Function Overloading |
| C. | Both a and b |
| D. | None of the above |
| Answer» C. Both a and b | |
| 112. |
In nested try blocks, if both inner and outer catch handlers are not able to handle the exception, then ______________ . |
| A. | Compiler executes only executable statements of main(). |
| B. | Compiler issues compile time errors about it. |
| C. | Program will be executed without any interrupt. |
| D. | Program will be terminated abnormally. |
| Answer» E. | |
| 113. |
A friend function does not have 'this' pointer associated with it. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 114. |
Default values for a function are specified when ____ . |
| A. | function is defined |
| B. | function is declared |
| C. | Both a and b |
| D. | None of these |
| Answer» C. Both a and b | |
| 115. |
We can initialize a value of static variable of a class only when its object is created. No other initialization is permitted. |
| A. | True |
| B. | False |
| Answer» C. | |
| 116. |
What is the difference between protected and private access specifiers in inheritance? |
| A. | private member is not inheritable and not accessible in derived class. |
| B. | protected member is inheritable and also accessible in derived class. |
| C. | Both are inheritable but private is accessible in the derived class. |
| D. | Both are inheritable but protected is not accessible in the derived class. |
| Answer» C. Both are inheritable but private is accessible in the derived class. | |
| 117. |
When a base class is privately inherited by the derived class, then_____________ . |
| A. | protected members of the base class become private members of derived class |
| B. | public members of the base class become private members of derived class |
| C. | both a and b |
| D. | only b |
| Answer» D. only b | |
| 118. |
__________ is return type of is_open() function. |
| A. | int |
| B. | bool |
| C. | float |
| D. | char * |
| Answer» C. float | |
| 119. |
Only functions of the class can access the data of the class and they(functions) provides the interface between data, objects and the program. This kind isolation of the data from direct access by the program is called _______________ . |
| A. | Data Abstraction |
| B. | Data Hiding |
| C. | Data Binding |
| D. | Data Encapsulation |
| Answer» C. Data Binding | |
| 120. |
By default, if a function with minimum lines of code is declared and defined inside the class becomes Inline function. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 121. |
Public data members and member functions of the class are accessible ONLY to the member functions of that class. |
| A. | True |
| B. | False |
| Answer» C. | |
| 122. |
An exception is thrown using _____________ keyword in CPP. |
| A. | throws |
| B. | throw |
| C. | threw |
| D. | Thrown |
| Answer» C. threw | |
| 123. |
Which of the followings is/are not a manipulator/s ? 1. flush 2. base 3. ends 4. oct 5. bin 6. skipws |
| A. | Only 1, 6 |
| B. | Only 1,4,6 |
| C. | Only 1,3,6 |
| D. | Only 2,5 |
| Answer» E. | |
| 124. |
In CPP, the size of the character array should be one larger than the number of characters in the string. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 125. |
When base class is derived in protected mode, then_____________ . 1. public members of base class become private members of derived class. 2. public members of base class become protected members of derived class. 3. public members of base class become public members of derived class. 4. protected members of base class become protected members of derived class. 5. protected members of base class become private members of derived class. 6. protected members of base class become public members of |
| A. | Only 1, 5 |
| B. | Only 1, 6 |
| C. | Only 2, 6 |
| D. | Only 2, 4 |
| Answer» E. | |
| 126. |
To perform File I/O operations, we must use _____________ header file. |
| A. | < ifstream> |
| B. | < ofstream> |
| C. | < fstream> |
| D. | Any of these |
| Answer» D. Any of these | |
| 127. |
Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP? |
| A. | int *p = new int(100); |
| B. | int *p; p = new int; *p = 100; |
| C. | int *p = NULL; p = new int; *p=100; |
| D. | Only 1,2 |
| E. | All of these |
| Answer» F. | |
| 128. |
If default constructor is not defined, then how the objects of the class will be created? |
| A. | The compiler will generate error |
| B. | Error will occur at run-time. |
| C. | Compiler provides its default constructor to build the object. |
| D. | None of these |
| Answer» D. None of these | |
| 129. |
A virtual function that has no definition within the base class is called____________. |
| A. | Pure virtual function |
| B. | Pure static function |
| C. | Pure Const function |
| D. | Friend function |
| Answer» B. Pure static function | |
| 130. |
_________________are used for generic programming. |
| A. | Inheritance |
| B. | Virtual Functions |
| C. | Templates |
| D. | None of these |
| Answer» D. None of these | |
| 131. |
Object oriented programming employs_________ programming approach. |
| A. | top-down |
| B. | procedural |
| C. | bottom-up |
| D. | all of these. |
| Answer» D. all of these. | |
| 132. |
Constant variables can be created in CPP by using ________ . |
| A. | enum |
| B. | const |
| C. | #define |
| D. | All of these |
| E. | None of these |
| Answer» E. None of these | |
| 133. |
Irrespective of exception occurrence, catch handler will always get executed. |
| A. | True |
| B. | False |
| Answer» C. | |
| 134. |
Members of the class can be declared with auto, extern or register storage classes. |
| A. | True |
| B. | False |
| Answer» C. | |
| 135. |
In CPP, cin and cout are the predefined stream __________ . |
| A. | Operator |
| B. | Functions |
| C. | Objects |
| D. | Data types |
| Answer» D. Data types | |
| 136. |
Can we have overloading of the function templates? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 137. |
By default, all the files are opened in ___________mode . |
| A. | Binary |
| B. | Text |
| C. | Can’t say |
| Answer» C. Can’t say | |
| 138. |
Is it mandatory to invoke/call a constructor for creating an object? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 139. |
Generic catch handler must be placed at the end of all the catch handlers. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 140. |
An exception can be of only built-In type. |
| A. | True |
| B. | False |
| Answer» C. | |
| 141. |
The CPP compiler supports automatic type conversions for the user defined datatypes. |
| A. | True |
| B. | False |
| Answer» C. | |
| 142. |
Can a class be declared/defined inside another class ? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 143. |
Which of the following is CPP style type-casting? |
| A. | per = total/(float)m |
| B. | per = total/float(m) |
| C. | per = (float)total/m |
| D. | None of these |
| Answer» C. per = (float)total/m | |
| 144. |
By default, members of the class are ____________ in nature. |
| A. | protected |
| B. | private |
| C. | public |
| D. | static |
| Answer» C. public | |