JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Object Oriented Programming interview questions part 28
Object Oriented Programming interview questions part 28
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. If a declaration of a member in inner class has the same name as that in the outer class, then ________________ enclosing scope.
A. Outer declaration shadows inner declaration in
B. Inner declaration shadows outer declaration in
C. Declaration gives compile time error
D. Declaration gives runtime error
Show Correct Answer
Correct Answer is :
Inner declaration shadows outer declaration in
2. A static nested class is _____________ class in behavior that is nested in another _________ class.
A. Top level, top level
B. Top level, low level
C. Low level, top level
D. Low level, low level
Show Correct Answer
Correct Answer is :
Top level, top level
3. What is 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
Show Correct Answer
Correct Answer is :
Allocates memory for an object or array and returns a particular pointer
4. 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
Show Correct Answer
Correct Answer is :
Add new vtable slot entries
5. 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
Show Correct Answer
Correct Answer is :
Either throws an exception or returns zero
6. 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
Show Correct Answer
Correct Answer is :
_set_new_handler
7. 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
Show Correct Answer
Correct Answer is :
After the allocation of memory
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;
Show Correct Answer
Correct Answer is :
char (*pchar)[10] = new char[][10];
9. 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
Show Correct Answer
Correct Answer is :
Type name can’t contain const, volatile, class declaration or enumerations
10. 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
Show Correct Answer
Correct Answer is :
Doesn’t allocate reference types
11. 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 allocation
Show Correct Answer
Correct Answer is :
New operator can’t allocate functions but pointer to functions can be allocated
12. Which among the following is added in grammar of new operator?
A. Finalize
B. Arg
C. Initializer
D. Allocator
Show Correct Answer
Correct Answer is :
Initializer
13. 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
Show Correct Answer
Correct Answer is :
Can’t be specified for arrays
14. 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
Show Correct Answer
Correct Answer is :
Are not destroyed even if they go out of scope
15. 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
Show Correct Answer
Correct Answer is :
Invokes function operator new
16. 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?
A. Colon
B. Arrow
C. Dot
D. Scope resolution
Show Correct Answer
Correct Answer is :
Scope resolution
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
Show Correct Answer
Correct Answer is :
::operator new( sizeof( type ) )
18. What is array of objects?
A. An array of instances of class represented by single name
B. An array of instances of class represented by more than one name
C. An array of instances which have more than 2 instances
D. An array of instances which have different types
Show Correct Answer
Correct Answer is :
An array of instances of class represented by single name
19. Which among the following is a mandatory condition for array of objects?
A. All the objects should be of different class
B. All the objects should be of same program classes
C. All the objects should be of same class
D. All the objects should have different data
Show Correct Answer
Correct Answer is :
All the objects should be of same class
20. What is the type of the elements of array of objects?
A. Class
B. Void
C. String
D. Null
Show Correct Answer
Correct Answer is :
Class
Similar Interview Questions
Search for latest jobs
Find Jobs