Unit-2
I. Each Question Carries 1 Mark.
1) Class is ____for an object?
a) Template b) Instance c) Structure d) None
2) Which operator dynamically allocates memory for an object?
a) New b) Static c) Malloc d) Calloc
3) _______Initializes an object immediately upon creation.
a) Constructor b) Destructor c) Main d) None
4) Which keyword is used inside any method to refer to the current object?
a) This b) Super c) Volatile d) None
5) When no reference to an object exist, the memory occupied by the object can be
Reclaimed by.
a) Garbage Collection b) Destructor c) Free d) None
6) Which method is invoked before an object is reclaimed by the garbage collector?
A) Finalize b) Initialize c) gc( ) d) None
7) Can we overload Constructors?
a) True b) False c) Sometimes d) None
8) Can we overload Methods?
a) True b) False c) Sometimes d) None
9) Java passes objects by?
a) Call by reference b) Call By value c) Call By Name d) None
10) Whenever a subclass needs to refer its immediate super class, it can do so by __?
a) Super b) This c) static d) None
11) A call to overridden function is resolved at run time?
a) Dynamic Method dispatch b) Static method Dispatch
c) Dynamic Memory Dispatch d) None
12) Overriding of methods is an example of ______
a) Polymorphism b) Inheritance c) Exception d) None
13) Which class can’t be directly instantiated with the new operator?
a) Abstract b) Final c) Super d) None
14) In a class if there is at least one abstract method then the class is ___?
a) Abstract b) Final c) Super d) None
15) Which class can’t be subclassed?
a) Final b) Abstract c) Super d) None
16) Which method can’t be overridden_______?
a) Final b) Abstract c) Super d) None
17) Which class is the Super class for the all the classes?
a) Object b) Class c) Super d) None
18) What are the containers for the classes?
a) Packages b) Interfaces c) Abstract d) None
19) Which modifier can be accessed from anywhere?
a) public b) private c) protected d) None
20) No modifier specifier can be accessed with in the same package?
a) Yes b) No
21) Protected modifier can be accessed by subclass in different package?
a) Yes b) No
22) Protected modifier can be accessed by non-subclass in different package?
a) No b) Yes
23) Which modifier can’t be visible outside of its class?
a) private b) public c) protected d) None
24) Which statement is use to bring certain classes or entire package into visibility?
a) Import b) Include c) package d) None
25) A____________ constructor does not take any parameter
a) new b) default c) old d) class
I. Answer – 1 Mark.
1. B 2. A 3. A 4. A 5. A 6. A 7. A
8. A 9. A 10. A 11. A 12. A 13. A 14. A
15. A 16. A 17. A 18. A 19. A 20. B 21. A
22. A 23. A 24. A 25. A