MCQOPTIONS
Saved Bookmarks
This section includes 42 Mcqs, each offering curated multiple-choice questions to sharpen your BPCL knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Inline functions may not work ______ . 1. If function contain static variables. 2. If function contain global and register variables. 3. If function returning value consists looping construct(i.e. for, while). 4. If inline functions are recursive. 5. If function contains const value. |
| A. | Only 1,4,5 |
| B. | Only 2,3,5 |
| C. | Only 1,3,4 |
| D. | All of these |
| Answer» D. All of these | |
| 2. |
Catch handler can have multiple parameters. |
| A. | True |
| B. | False |
| Answer» C. | |
| 3. |
To create an output stream, we must declare the stream to be of class ___________ . |
| A. | ofstream |
| B. | ifstream |
| C. | iostream |
| D. | None of these |
| Answer» B. ifstream | |
| 4. |
Run time polymorphism can be achieved with______ . |
| A. | Virtual Base class |
| B. | Container class |
| C. | Virtual function |
| D. | Both a and c |
| Answer» D. Both a and c | |
| 5. |
Private members of the class are accessible only to the members of the same class. |
| A. | True |
| B. | False |
| Answer» C. | |
| 6. |
Which of the following is not a false statement about new operator? |
| A. | It can’t be overloaded. |
| B. | It returns garbage value when memory allocation fails. |
| C. | It automatically computes the size of the data object. |
| D. | All of these |
| Answer» D. All of these | |
| 7. |
Which of the following operator is used to release the dynamically allocated memory in CPP? |
| A. | remove |
| B. | free |
| C. | delete |
| D. | both b and c |
| Answer» D. both b and c | |
| 8. |
Static variable declared in a class are also called_________ . |
| A. | instance variable |
| B. | named constant |
| C. | global variable |
| D. | class variable |
| Answer» E. | |
| 9. |
Which of the following statements are true about Catch handler? 1. It must be placed immediately after try block T. 2. It can have multiple parameters. 3. There must be only one catch handler for every try block. 4. There can be multiple catch handler for a try block T. 5. Generic catch handler can be placed anywhere after try block. |
| A. | Only 1, 4, 5 |
| B. | Only 1, 2, 3 |
| C. | Only 1, 4 |
| D. | Only 1, 2 |
| Answer» D. Only 1, 2 | |
| 10. |
Exception handlers are declared with ____________ keyword. |
| A. | Try |
| B. | catch |
| C. | throw |
| D. | Finally |
| Answer» C. throw | |
| 11. |
Streams that will be performing both input and output operations must be declared as class _________ . |
| A. | iostream |
| B. | fstream |
| C. | stdstream |
| D. | Stdiostream |
| Answer» C. stdstream | |
| 12. |
Can we have overloading of the function templates? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 13. |
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 derived class. |
| A. | Only 1, 5 |
| B. | Only 1, 6 |
| C. | Only 2, 6 |
| D. | Only 2, 4 |
| Answer» E. | |
| 14. |
class X, class Y and class Z are derived from class BASE. This is ______ inheritance. |
| A. | Multiple |
| B. | Multilevel |
| C. | Hierarchical |
| D. | Single |
| Answer» D. Single | |
| 15. |
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 | |
| 16. |
Static variable must be declared in public section of the class. |
| A. | True |
| B. | False |
| Answer» C. | |
| 17. |
Which of the following are true about static member function? 1. They can access non-static data members. 2. They can call only other static member functions. 3. They can access global functions and data. 4. They can have this pointer. 5. They cannot be declared as const or volatile. |
| A. | Only 2 |
| B. | Only 2,5 |
| C. | Only 2,3,4,5 |
| D. | Only 2 , 3 , 5 |
| Answer» E. | |
| 18. |
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 | |
| 19. |
Constant variables can be created in CPP by using ________ . |
| A. | enum |
| B. | const |
| C. | #define |
| D. | All of these |
| Answer» E. | |
| 20. |
Object oriented programming employs_________ programming approach. |
| A. | top-down |
| B. | procedural |
| C. | bottom-up |
| D. | all of these. |
| Answer» D. all of these. | |
| 21. |
In CPP, cin and cout are the predefined stream __________ . |
| A. | Operator |
| B. | Functions |
| C. | Objects |
| D. | Data types |
| Answer» D. Data types | |
| 22. |
Irrespective of exception occurrence, catch handler will always get executed. |
| A. | True |
| B. | False |
| Answer» C. | |
| 23. |
_________________are used for generic programming. |
| A. | Inheritance |
| B. | Virtual Functions |
| C. | Templates |
| D. | None of these |
| Answer» D. None of these | |
| 24. |
Can we pass parameters to base class constructor though derived class or derived class constructor? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 25. |
Can a class be declared/defined inside another class ? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 26. |
The CPP compiler supports automatic type conversions for the user defined datatypes. |
| A. | True |
| B. | False |
| Answer» C. | |
| 27. |
Generic catch handler must be placed at the end of all the catch handlers. |
| A. | True |
| B. | False |
| Answer» C. | |
| 28. |
By default, all the files are opened in ___________mode . |
| A. | Binary |
| B. | Text |
| C. | Can’t say |
| Answer» C. Can’t say | |
| 29. |
If abstract class is inherited by derived class, then_______________ . |
| A. | Derived class should provide definition for all the pure virtual functions |
| B. | Derived class also become abstract if fails to implement pure virtual functions |
| C. | Objects of derived class can’t be created if it fails to implement pure virtual functions |
| D. | All of these |
| Answer» E. | |
| 30. |
While overloading binary operators using member function, it requires ___ argument/s. |
| A. | Zero |
| B. | One |
| C. | Two |
| D. | Three |
| Answer» C. Two | |
| 31. |
Private members of the class are not inheritable. |
| A. | True |
| B. | True |
| Answer» C. | |
| 32. |
It is not possible to combine two or more file opening mode in open () method. |
| A. | True |
| B. | False |
| Answer» C. | |
| 33. |
Which of the following is not used to seek a file pointer? |
| A. | ios::cur |
| B. | ios::set |
| C. | ios::end |
| D. | ios::beg |
| Answer» C. ios::end | |
| 34. |
Which one is suitable syntax for function template? |
| A. | template< class T> return_type Function_Name(parameters) |
| B. | template< typename T> return_type Function_Name(parameters) |
| C. | both a and b |
| D. | None of these |
| Answer» C. both a and b | |
| 35. |
Generic catch handler is represented by ______________ . |
| A. | catch(..,) |
| B. | catch(---) |
| C. | catch(…) |
| D. | catch( void x) |
| Answer» D. catch( void x) | |
| 36. |
If inner catch handler is not able to handle the exception then__________ . |
| A. | Compiler will look for outer try handler |
| B. | Program terminates abnormally |
| C. | Compiler will check for appropriate catch handler of outer try block |
| D. | None of these |
| Answer» D. None of these | |
| 37. |
If a class contains pure virtual function, then it is termed as____________________ . |
| A. | Virtual class |
| B. | Sealed class |
| C. | Pure Local class |
| D. | Abstract Class |
| Answer» E. | |
| 38. |
Can we alter/modify the values of data members of a class inside const member function? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 39. |
A class can contain objects of other classes and this phenomenon is called_________ . |
| A. | Relationship |
| B. | Object Association |
| C. | Containership |
| D. | None of these |
| Answer» D. None of these | |
| 40. |
The explicit keyword is an optional decoration for the constructors that takes exactly_____argument. |
| A. | No argument |
| B. | Two |
| C. | Three |
| D. | One |
| Answer» E. | |
| 41. |
Functions called from within a try block may also throw exception. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 42. |
We can prevent a function from throwing any exceptions. |
| A. | True |
| B. | False |
| Answer» B. False | |