MCQOPTIONS
Saved Bookmarks
This section includes 18 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How does compiler convert “::operator new” implicitly? |
| A. | ::operator new( sizeof( type ) ) |
| B. | ::operator new( sizeof( ) ) |
| C. | new operator :: type sizeof( type ) |
| D. | new sizeof( type ) operator |
| Answer» B. ::operator new( sizeof( ) ) | |
| 2. |
If a new operator is defined for a class and still global new operator have to be used, which operator should be used with the keyword new? |
| A. | Colon |
| B. | Arrow |
| C. | Dot |
| D. | Scope resolution |
| Answer» E. | |
| 3. |
The new operator _________________ |
| A. | Invokes function operator new |
| B. | Doesn’t invoke function operator new |
| C. | Invokes function operator only if required |
| D. | Can’t invoke function operator new implicitly |
| Answer» B. Doesn’t invoke function operator new | |
| 4. |
The objects allocated using new operator ________________ |
| A. | Are destroyed when they go out of scope |
| B. | Are not destroyed even if they go out of scope |
| C. | Are destroyed anytime |
| D. | Are not destroyed throughout the program execution |
| Answer» C. Are destroyed anytime | |
| 5. |
Initializers __________________ |
| A. | Are used for specifying arrays |
| B. | Are used to defined multidimensional arrays |
| C. | Can’t be specified for arrays |
| D. | Can’t be specified for any data |
| Answer» D. Can’t be specified for any data | |
| 6. |
Which among the following is added in grammar of new operator? |
| A. | Finalize |
| B. | Arg |
| C. | Initializer |
| D. | Allocator |
| Answer» D. Allocator | |
| 7. |
The new operator _____________ |
| A. | Can allocate reference types too |
| B. | Doesn’t allocate reference types |
| C. | Can allocate reference to objects |
| D. | Doesn’t allocate any data |
| Answer» C. Can allocate reference to objects | |
| 8. |
Which among the following is correct syntax to declare a 2D array using new operator? |
| A. | char (*pchar)[10] = new char[][10]; |
| B. | char (pchar) = new char[][10]; |
| C. | char (*char) = new char[10][]; |
| D. | char (*char)[][10]= new char; |
| Answer» B. char (pchar) = new char[][10]; | |
| 9. |
In C++, if new operator is used, when is the constructor called? |
| A. | Before the allocation of memory |
| B. | After the allocation of memory |
| C. | Constructor is called to allocate memory |
| D. | Depends on code |
| Answer» C. Constructor is called to allocate memory | |
| 10. |
If new throws an error, which function can be called to write a custom exception handler? |
| A. | _set_handler |
| B. | _new_handler |
| C. | _handler_setter |
| D. | _set_new_handler |
| Answer» E. | |
| 11. |
What happens when new fails? |
| A. | Returns zero always |
| B. | Throws an exception always |
| C. | Either throws an exception or returns zero |
| D. | Terminates the program |
| Answer» D. Terminates the program | |
| 12. |
Microsoft C++ Components extensions support new keyword to _____________ |
| A. | Modify a vtable |
| B. | Replace a vtable slot entry |
| C. | Add new vtable slot entries |
| D. | Rearrange vtable slot entries |
| Answer» D. Rearrange vtable slot entries | |
| 13. |
What is the new operator? |
| A. | Allocates memory for an object or array |
| B. | Allocates memory for an object or array and returns a particular pointer |
| C. | Used as return type when an object is created |
| D. | Used to declare any new thing in a program |
| Answer» C. Used as return type when an object is created | |
| 14. |
WHICH_AMONG_THE_FOLLOWING_IS_ADDED_IN_GRAMMAR_OF_NEW_OPERATOR??$ |
| A. | Finalize |
| B. | Arg |
| C. | Initializer |
| D. | Allocator |
| Answer» D. Allocator | |
| 15. |
The objects allocated using new operator ________________$ |
| A. | Are destroyed when they go out of scope |
| B. | Are not destroyed even if they go out of scope |
| C. | Are destroyed anytime |
| D. | Are not destroyed throughout the program execution |
| Answer» C. Are destroyed anytime | |
| 16. |
Initializers __________________$ |
| A. | Are used for specifying arrays |
| B. | Are used to defined multidimensional arrays |
| C. | Can’t be specified for arrays |
| D. | Can’t be specified for any data |
| Answer» D. Can‚Äö√Ñ√∂‚àö√ë‚àö¬•t be specified for any data | |
| 17. |
How does compiler convert “::operator new” implicitly?$ |
| A. | ::operator new( sizeof( type ) ) |
| B. | ::operator new( sizeof( ) ) |
| C. | new operator :: type sizeof( type ) |
| D. | new sizeof( type ) operator |
| Answer» B. ::operator new( sizeof( ) ) | |
| 18. |
For declaring data by using new operator ____________________ |
| A. | Type name can’t contain const |
| B. | Type name can’t contain volatile |
| C. | Type name can’t contain class declarations |
| D. | Type name can’t contain const, volatile, class declaration or enumerations |
| Answer» E. | |