Object Oriented Programming interview questions part 29

Object Oriented Programming interview questions part 29

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

Total Questions: 20

1. If array of objects is declared as given below, which is the limitation on objects? Class_name arrayName[size];

Correct Answer is : The objects will not be initialized individually

2. Which is the condition that must be followed if the array of objects is declared without initialization, only with size of array?

Correct Answer is : The class must have a default or zero argument constructor

3. When are the array of objects without any initialization useful?

Correct Answer is : When object data is not required just after the declaration

4. If constructor arguments are passed to objects of array then ____________ if the constructors are overloaded.

Correct Answer is : It is not mandatory to call same constructor for all the objects

5. How the objects of array can be denoted?

Correct Answer is : Indices

6. The objects in an object array _______________________

Correct Answer is : Can be created without calling default constructor

7. The Object array is created in _____________________

Correct Answer is : Heap memory

8. If an array of objects is of size 10 and a data value have to be retrieved from 5th object then ________________ syntax should be used.

Correct Answer is : Array_Name[4].data_variable_name;

9. Can we have two dimensional object array?

Correct Answer is : Yes, always

10. From which index does the array of objects start?

Correct Answer is : 0

11. Two dimensional array can’t be initialized with the declaration.

Correct Answer is : FALSE

12. Is an array of characters always a string?

Correct Answer is : No, never

13. What is reference to an object?

Correct Answer is : It is address of where the variables and methods of object are stored

14. Whenever an object is assigned to a variable or passed to a method, ________________

Correct Answer is : Actually the objects aren’t used

15. Does use of object reference in assignment or passing means copy of the object is being used?

Correct Answer is : Yes, because the reference directly means using address

16. What will be the output of the following code? import java.awt.Point; class Testing { public static void main(String[] args) { Point p1,p2; p1=new Point(100,100); p2=p1; p1.x=200; p1.y=200; System.out.println(“Point 1: ” + p1.x + ”, “ + p1.y); System.out.println(“Point 2: ” + p2.x + ”, “ + p2.y); } }

Correct Answer is : Point 1: 200, 200

17. Is there any explicit use of pointers in java that would be applicable to objects?

Correct Answer is : No, implicit pointing is possible

18. Can a super class object give reference to a subclass method?

Correct Answer is : No, it’s not possible

19. What will be the output of the following code? import java.awt.Point; class Testing { public static void main(String[] args) { Point t1,t2,t3; t1=new Point(100,100); t2=t1; t3=t1; t1.x=200; t1.y=200; t2.x=300; t3.y=500; System.out.println(“Point 1: ” + p1.x + ”, “ + p1.y); } }

Correct Answer is : Point 1: 300, 500

20. If a reference variable is declared final then, _________________

Correct Answer is : It can never be reassigned to refer to a different object.

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon