Java Quiz 12 : Classes & Methods III By Tejas Chaudhari - September 2, 2021 FacebookTwitterPinterestWhatsApp Welcome to your Java Quiz 12 : Classes & Methods III 1. What is the return type of Constructors?a) intb) floatc) voidd) none of the mentioned 2. Which keyword is used by the method to refer to the object that invoked it?a) importb) catchc) abstractd) this 3. Which of the following is a method having same name as that of its class?a) finalizeb) deletec) classd) constructor 4. Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?a) deleteb) freec) newd) none of the mentioned 5. Which function is used to perform some action when the object is to be destroyed?a) finalize()b) delete()c) main()d) none of the mentioned 6. Abstract class cannot have a constructor.a) Trueb) False 7. What is true about protected constructor?a) Protected constructor can be called directlyb) Protected constructor can only be called using super()c) Protected constructor can be used outside packaged) protected constructor can be instantiated even if child is in a different package 8. What is not the use of “this” keyword in Java?a) Passing itself to another methodb) Calling another constructor in constructor chainingc) Referring to the instance variable when local variable has the same named) Passing itself to method of the same class 9. What would be the behaviour if one parameterized constructor is explicitly defined?a) Compilation errorb) Compilation succeedsc) Runtime errord) Compilation succeeds but at the time of creating object using default constructor, it throws compilation error 10. What would be behaviour if the constructor has a return type?a) Compilation errorb) Runtime errorc) Compilation and runs successfullyd) Only String return type is allowed 11. What is true about private constructor?a) Private constructor ensures only one instance of a class exist at any point of timeb) Private constructor ensures multiple instances of a class exist at any point of timec) Private constructor eases the instantiation of a classd) Private constructor allows creating objects in other classes 12. What would be the behaviour if this() and super() used in a method?a) Runtime errorb) Throws exceptionc) compile time errord) Runs successfully 13. What is false about constructor?a) Constructors cannot be synchronized in Javab) Java does not provide default copy constructorc) Constructor can have a return typed) “this” and “super” can be used in a constructor 14. What is true about Class.getInstance()?a) Class.getInstance calls the constructorb) Class.getInstance is same as new operatorc) Class.getInstance needs to have matching constructord) Class.getInstance creates object if class does not have any constructor 15. What is true about constructor?a) It can contain return typeb) It can take any number of parametersc) It can have any non access modifiersd) Constructor cannot throw an exception Time is Up!