Object- Oriented Programming Interview Questions - 35 | Snaprecruit.com

Object- Oriented Programming Interview Questions - 35 | Snaprecruit.com

Object Oriented Programming interview questions part 35

Object Oriented Programming interview questions part 35

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Which among the following is false for a constructor?

Correct Answer is : Constructors are always user defined

2. When is the constructor called for an object?

Correct Answer is : As soon as object is created

3. Which among the following function can be used to call default constructor implicitly in java?

Correct Answer is : this()

4. Why do we use constructor overloading?

Correct Answer is : To initialize the object in different ways

5. If programmer have defined parameterized constructor only, then __________________

Correct Answer is : Default constructor will not be created by the compiler implicitly

6. Which among the following is not valid in java?

Correct Answer is : Recursive constructor call

7. Which constructor will be called from the object obj2 in the following program? class A { int i; A() { i=0; } A(int x) { i=x+1; } A(int y, int x) { i=x+y; } }; A obj1(10); A obj2(10,20); A obj3;

Correct Answer is : A(int y, int x)

8. What is we only create an object but don’t call any constructor for it in java?

Correct Answer is : Object is created but points to null

9. Which among the following is false?

Correct Answer is : Constructor can’t be overloaded in Kotlin

10. Which is correct syntax?

Correct Answer is : classname objectname= new classname();

11. What does memory allocation for objects mean?

Correct Answer is : Actual creation and memory allocation for object members

12. Where is the memory allocated for the objects?

Correct Answer is : RAM

13. When is the memory allocated for an object?

Correct Answer is : When object constructor is called

14. Using new is type safe as _______________________

Correct Answer is : It doesn’t require to be specified with type of data

15. Which of the following function can be used for dynamic memory allocation of objects?

Correct Answer is : both malloc() and calloc()

16. How much memory will be allocated for an object of class given below? class Test{ int mark1; int mark2; float avg; char name[10]; };

Correct Answer is : 22 Bytes

17. Which keyword among the following can be used to declare an array of objects in java?

Correct Answer is : new

18. When is the memory allocated for an object gets free?

Correct Answer is : When object goes out of scope

19. Which among the following keyword can be used to free the allocated memory for an object?

Correct Answer is : either delete or free

20. Which function is called whenever an object goes out of scope?

Correct Answer is : Destructor function

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon