InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
Which among the following is true?(a) New operator can’t allocate functions but pointer to functions can be allocated(b) New operator can allocate functions as well as pointer to functions(c) New operator can allocate any type of functions(d) New operator is not applicable with functions allocationI got this question during an interview.My question comes from New Operator in chapter Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» The correct option is (a) NEW OPERATOR can’t allocate functions but pointer to functions can be allocated |
|
| 52. |
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 dataI had been asked this question during an interview for a job.My question is from New Operator topic in portion Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» Right answer is (B) Doesn’t allocate reference TYPES |
|
| 53. |
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 enumerationsThis question was addressed to me in class test.I need to ask this question from New Operator in division Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» Right OPTION is (d) Type name can’t contain CONST, volatile, class declaration or enumerations |
|
| 54. |
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;The question was posed to me by my college professor while I was bunking the class.I would like to ask this question from New Operator topic in section Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» The correct OPTION is (a) CHAR (*pchar)[10] = new char[][10]; |
|
| 55. |
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 codeI had been asked this question by my school teacher while I was bunking the class.Asked question is from New Operator in portion Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» The correct choice is (b) After the allocation of memory |
|
| 56. |
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_handlerI have been asked this question in an internship interview.This key question is from New Operator topic in chapter Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» Correct option is (d) _set_new_handler |
|
| 57. |
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 programI had been asked this question in my homework.The doubt is from New Operator topic in division Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» Correct option is (c) Either THROWS an exception or returns ZERO |
|
| 58. |
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 entriesThe question was posed to me by my school teacher while I was bunking the class.Enquiry is from New Operator in section Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» Correct choice is (c) Add new VTABLE slot entries |
|
| 59. |
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 programThe question was asked in a national level competition.My question comes from New Operator in chapter Memory Allocation & Scope of Variable of Object Oriented Programming |
|
Answer» The correct option is (b) Allocates memory for an object or ARRAY and returns a particular POINTER |
|