Home
MCQs
Java MCQs
Object Class
Java MCQs

Java MCQs - Object Class

In Object Class MCQs, we will cover following things in it. Object declaration syntax, new operator, class syntax, Java methods, logical mcqs

11. A variable, which gets memory at runtime when an object is created is called?

A. static variable

B. local variable

C. instance variable

Answer: C

12. new keyword is used for?

A. allocating memory at runtime

B. allocating memory at compile time

C. releasing memory at runtime

D. All of above

Answer: A

13. An object can be initialize in Java by?

A. reference variable

B. method

C. constructor

D. All of above

Answer: D

14. A program which shows an example of

A. initialization by reference variable

B. initialization by method

C. initialization by constructor

D. None of above

Answer: A

15. A program which shows an example of

A. initialization by reference variable

B. initialization by method

C. initialization by constructor

D. None of above

Answer: B

16. What are the different ways to create an object in Java?

A. by new keyword

B. by newInstance() or clone() method

C. by deserialization & factory method

D. All of Above

Answer: D

17. What is an anonymous object in Java?

A. An object with final properties

B. An object with no reference

C. An object with static methods

D. All of above

Answer: B