Memory Allocation and Variable Scope Mcqs
Our collections of Multiple choice questions and answers focuses on study of Memory Allocation and Variable Scope in OOP. These questions are chosen from a collection of most authoritative and best reference books on OOP. Our aim is to prepare an individual for competitive exams like NTS, Web Developer | IOS Developer | Game Developer | Software House interviews and jobs, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate IMemory Allocation and Variable Scope in OOP comprehensively.
Object Oriented Programming Mcqs
- Access Specifiers Mcqs
- Builtin Classes Mcqs
- Class Members Mcqs
- Concept and Features Mcqs
- Constructors and Destructors Mcqs
- Exception Handling Mcqs
- Inheritance and its Types Mcqs
- Member Functions Mcqs
- Memory Allocation and Variable Scope Mcqs
- Objects and Classes Mcqs
- Objects and Pointers Mcqs
- Overloading Mcqs
Computer MCQS
Sciences MCQS
2.
Microsoft C++ Components extensions support new keyword to _____________
Modify a vtable
Replace a vtable slot entry
Add new vtable slot entries
Rearrange vtable slot entries
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
3.
What happens when new fails?
Returns zero always
Throws an exception always
Either throws an exception or returns zero
Terminates the program
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
4.
If new throws an error, which function can be called to write a custom exception handler?
_set_handler
_new_handler
_handler_setter
_set_new_handler
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
5.
In C++, if new operator is used, when is the constructor called?
Before the allocation of memory
After the allocation of memory
Constructor is called to allocate memory
Depends on code
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
6.
Which among the following is correct syntax to declare a 2D array using new operator?
Char (*pchar)[10] = new char[][10],
Char (pchar) = new char[][10],
Char (*char) = new char[10][],
Char (*char)[][10]= new char,
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
7.
For declaring data by using new operator ____________________
Type name can’t contain const
Type name can’t contain volatile
Type name can’t contain class declarations
Type name can’t contain const, volatile, class declaration or enumerations
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
8.
The new operator _____________
Can allocate reference types too
Doesn’t allocate reference types
Can allocate reference to objects
Doesn’t allocate any data
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
9.
Which among the following is correct?
New operator can’t allocate functions but pointer to functions can be allocated
New operator can allocate functions as well as pointer to functions
New operator can allocate any type of functions
New operator is not applicable with functions allocation
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
10.
Which among the following is added in grammar of new operator?
Finalize
Arg
Initializer
Allocator
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
11.
Initializers __________________
Are used for specifying arrays
Are used to defined multidimensional arrays
Can’t be specified for arrays
Can’t be specified for any data
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
12.
The objects allocated using new operator ________________
Are destroyed when they go out of scope
Are not destroyed even if they go out of scope
Are destroyed anytime
Are not destroyed throughout the program execution
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
13.
The new operator _________________
Invokes function operator new
Doesn’t invoke function operator new
Invokes function operator only if required
Can’t invoke function operator new implicitly
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
14.
If 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?
Colon
Arrow
Dot
Scope resolution
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
15.
How does compiler convert “::operator new” implicitly?
::operator new( sizeof( type ) )
::operator new( sizeof( ) )
New operator :: type sizeof( type )
New sizeof( type ) operator
Answer & Solution
No Solution for this Answer..! Report or Discus this Question