Object Oriented Programming interview questions part 28

Object Oriented Programming interview questions part 28

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.

Correct Answer is : Inner declaration shadows outer declaration in

2. A static nested class is _____________ class in behavior that is nested in another _________ class.

Correct Answer is : Top level, top level

3. What is new operator?

Correct Answer is : Allocates memory for an object or array and returns a particular pointer

4. Microsoft C++ Components extensions support new keyword to _____________

Correct Answer is : Add new vtable slot entries

5. What happens when new fails?

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?

Correct Answer is : _set_new_handler

7. In C++, if new operator is used, when is the constructor called?

Correct Answer is : After the allocation of memory

8. Which among the following is correct syntax to declare a 2D array using new operator?

Correct Answer is : char (*pchar)[10] = new char[][10];

9. For declaring data by using new operator ____________________

Correct Answer is : Type name can’t contain const, volatile, class declaration or enumerations

10. The new operator _____________

Correct Answer is : Doesn’t allocate reference types

11. Which among the following is true?

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?

Correct Answer is : Initializer

13. Initializers __________________

Correct Answer is : Can’t be specified for arrays

14. The objects allocated using new operator ________________

Correct Answer is : Are not destroyed even if they go out of scope

15. The new operator _________________

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?

Correct Answer is : Scope resolution

17. How does compiler convert “::operator new” implicitly?

Correct Answer is : ::operator new( sizeof( type ) )

18. What is array of objects?

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?

Correct Answer is : All the objects should be of same class

20. What is the type of the elements of array of objects?

Correct Answer is : Class

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon