Home / Programming Questions / JAVA MCQs / Page 5

JAVA MCQs with answers Page - 5

Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

Y

Yogesh • 7.43K Points
Tutor III

Q. How to get the class object of associated class using Reflection?

(A) Class.name(“className”)
(B) className.getClassName()
(C) Class.forName(“className”)
(D) className.getClass()

Y

Yogesh • 7.43K Points
Tutor III

Q. How method can be invoked on unknown object?

(A) obj.getClass().getObject()
(B) obj.getClass().getMethod()
(C) obj.getClass().getDeclaredField()
(D) obj.getClass().getDeclaredMethod()

Y

Yogesh • 7.43K Points
Tutor III

Q. What is used to get class name in reflection?

(A) new getClass()
(B) getClass().getDeclaredFields()
(C) getClass().getName()
(D) getClass().getFields()

Y

Yogesh • 7.43K Points
Tutor III

Q. How private field can be called using reflection?

(A) getFields
(B) getDeclaredFields
(C) getDeclaredMethods
(D) getMethods

Y

Yogesh • 7.43K Points
Tutor III

Q. How private method can be called using reflection?

(A) getFields
(B) getMethods
(C) getDeclaredFields
(D) getDeclaredMethods

Y

Yogesh • 7.43K Points
Tutor III

Q. What does Class.forName(“myreflection.Foo”).getInstance() return?

(A) Foo object
(B) Calls the getInstance() method of Foo class
(C) class object of Foo
(D) An array of Foo objects

Y

Yogesh • 7.43K Points
Tutor III

Q. What is not the advantage of Reflection?

(A) Examine an object’s class at runtime
(B) Examine a class’s field at compile time
(C) Construct an object for a class at runtime
(D) Examine a class’s field and method at runtime

Y

Yogesh • 7.43K Points
Tutor III

Q. Which of the following is not a marker interface?

(A) Remote
(B) Serializable
(C) Reader
(D) Cloneable

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.