Reflection API Online Exam Quiz

Reflection API GK Quiz. Question and Answers related to Reflection API. MCQ (Multiple Choice Questions with answers about Reflection API

Can servlet class declare constructor with ServletConfig object as an argument?

Options

A : TRUE

B : FALSE

C : -

D : -

View Answer

How constructor can be used for a servlet?

Options

A : Initialization

B : Constructor function

C : Initialization and Constructor function

D : Setup() method

View Answer

How method can be invoked on unknown object?

Options

A : obj.getClass().getDeclaredMethod()

B : obj.getClass().getDeclaredField()

C : obj.getClass().getMethod()

D : obj.getClass().getObject()

View Answer

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

Options

A : Class.forName(?className?)

B : Class.name(?className?)

C : className.getClass()

D : className.getClassName()

View Answer

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

Options

A : An array of Foo objects

B : class object of Foo

C : Calls the getInstance() method of Foo class

D : Foo object

View Answer

What does foo.getClass().getMethod(?doSomething?, null) return?

Options

A : doSomething method instance

B : Method is returned and we can call the method as method.invoke(foo,null);

C : Class object

D : Exception is thrown

View Answer

What is the difference between servlets and applets?^ i. Servlets execute on Server; Applets execute on browser^ ii. Servlets have no GUI; Applet has GUI^ iii. Servlets creates static web pages; Applets creates dynamic web pages^ iv. Servlets can handle only a single request; Applet can handle multiple requests

Options

A : i, ii, iii are correct

B : i, ii are correct

C : i, iii are correct

D : i, ii, iii, iv are correct

View Answer

What is used to get class name in reflection?

Options

A : getClass().getName()

B : getClass().getFields()

C : getClass().getDeclaredFields()

D : new getClass()

View Answer

Which method is used to get three-letter abbreviation for locale's country in servlets?

Options

A : Request.getISO3Country()

B : Locale.getISO3Country()

C : Response.getISO3Country()

D : Local.retrieveISO3Country()

View Answer

Which of the following code is used to get an attribute in a HTTP Session object in servlets?

Options

A : session.getAttribute(String name)

B : session.alterAttribute(String name)

C : session.updateAttribute(String name)

D : session.setAttribute(String name)

View Answer

Annotations more Online Exam Quiz

Design Patterns

Java Beans

JDBC

JSP

JSP Elements

Servlet

Session Management

Web application

Abrasive Jet Machining - Introduction and Machining system

Abrasive Water Jet Machining - Introduction