Struts2 Mock Test


Advertisements

This section presents you various set of Mock Tests related to Struts2. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

Struts2 Mock Test IV

Q 1 - Which of the following tag takes two or more lists as parameters and append them all together?

A - if and else tags.

B - iterator tags

C - merge tag

D - append tag

Answer : D

Explanation

These merge tag take two or more lists as parameters and append them all together.

Q 2 - Which of the following tag generates an iterator based on the val attribute supplied?

A - generator tag

B - iterator tags

C - merge tag

D - append tag

Answer : A

Explanation

These generator tag generates an iterator based on the val attribute supplied.

Q 3 - Which of the following tag enables developers to call actions directly from a JSP page by specifying the action name and an optional namespace?

A - generator tag

B - action tag

C - include tag

D - bean tag

Answer : B

Explanation

The action tag enables developers to call actions directly from a JSP page by specifying the action name and an optional namespace. The body content of the tag is used to render the results from the Action.

Q 4 - Which of the following tag is to be used to include a JSP file in another JSP page?

A - generator tag

B - action tag

C - include tag

D - bean tag

Answer : C

Explanation

The include tag will be used to include a JSP file in another JSP page.

Q 5 - Which of the following tag instantiates a class that conforms to the JavaBeans specification?

A - generator tag

B - action tag

C - include tag

D - bean tag

Answer : D

Explanation

The bean tag instantiates a class that conforms to the JavaBeans specification. This tag has a body which can contain a number of Param elements to set any mutator methods on that class. If the var attribute is set on the BeanTag, it will place the instantiated bean into the stack's Context.

Q 6 - Which of the following tag will allow you to format a Date in a quick and easy way?

A - date tag

B - param tag

C - property tag

D - push tag

Answer : A

Explanation

The date tag will allow you to format a Date in a quick and easy way.

Q 7 - Which of the following tag can be used to parameterize other tags?

A - date tag

B - param tag

C - property tag

D - push tag

Answer : B

Explanation

The param tag can be used to parameterize other tags.

Q 8 - Which of the following tag is used to get the property of a value, which will default to the top of the stack if none is specified?

A - date tag

B - param tag

C - property tag

D - push tag

Answer : C

Explanation

The property tag is used to get the property of a value, which will default to the top of the stack if none is specified.

Q 9 - Which of the following tag is used to push value on stack for simplified usage?

A - date tag

B - param tag

C - property tag

D - push tag

Answer : D

Explanation

The push tag is used to push value on stack for simplified usage.

Q 10 - Which of the following tag assigns a value to a variable in a specified scope?

A - set tag

B - text tag

C - url tag

D - push tag

Answer : A

Explanation

The set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a complex expression and then simply reference that variable each time rather than the complex expression. The scopes available are application, session, request, page and action.

Q 11 - Which of the following tag is used to render a I18n text message?

A - set tag

B - text tag

C - url tag

D - push tag

Answer : B

Explanation

The text tag is used to render a I18n text message.

Q 12 - Which of the following tag is used to create a URL?

A - set tag

B - text tag

C - url tag

D - push tag

Answer : C

Explanation

The url tag is used to create a URL.

Q 13 - Struts uses the DOJO framework for the AJAX tag implementation.

A - true

B - false

Answer : A

Explanation

Struts uses the DOJO framework for the AJAX tag implementation.

Answer : A

Explanation

org.springframework.web.context.ContextLoaderListener acts as Listener class in struts and spring integration.

Answer : B

Explanation

org.apache.struts2.dispatcher.FilterDispatcher acts as Dispatcher class in struts and spring integration.

Answer : C

Explanation

Both of the above statements are correct.

Q 18 - Struts2 is popular and mature web application framework based on the MVC design pattern.

A - true

B - false

Answer : A

Explanation

Struts2 is popular and mature web application framework based on the MVC design pattern.

Q 19 - Struts2 offers integrated profiling to debug and profile the application.

A - false

B - true

Answer : B

Explanation

Struts2 offers integrated profiling to debug and profile the application. In addition to this, Struts also offers integrated debugging with the help of built in debugging tools.

Q 20 - Tag markups in Struts2 can be tweaked using Freemarker templates.

A - true

B - false

Answer : A

Explanation

Tag markups in Struts2 can be tweaked using Freemarker templates. This does not require JSP or java knowledge. Basic HTML, XML and CSS knowledge is enough to modify the tags.

Q 21 - Struts2 promotes less configuration with the help of using default values for various settings.

A - true

B - false

Answer : A

Explanation

Struts2 promotes less configuration with the help of using default values for various settings. You don't have to configure something unless it deviates from the default settings set by Struts2.

Q 22 - Struts2 has a great support for multiple view options.

A - false

B - true

Answer : B

Explanation

Struts2 has a great support for multiple view options (JSP, Freemarker, Velocity and XSLT).

Q 23 - To use MVC with Struts, you have to be comfortable with the standard JSP, Servlet APIs and a large & elaborate framework.

A - false

B - true

Answer : B

Explanation

To use MVC with Struts, you have to be comfortable with the standard JSP, Servlet APIs and a large & elaborate framework.

Q 24 - With Struts applications, there is a lot more going on behind the scenes than with normal Java-based Web applications.

A - true

B - false

Answer : A

Explanation

With Struts applications, there is a lot more going on behind the scenes than with normal Java-based Web applications.

Q 25 - The web.xml configuration file is a J2EE configuration file that determines how elements of the HTTP request are processed by the servlet container.

A - false

B - true

Answer : B

Explanation

The web.xml configuration file is a J2EE configuration file that determines how elements of the HTTP request are processed by the servlet container.

Answer Sheet

Question Number Answer Key
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
struts_questions_answers.htm
Advertisements