0

programming languages Online Quiz - 221

Description: programming languages Online Quiz - 221
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

In validate method of ActionForm , Parameters are ?

  1. HttpServletReuest reuest, HttpServletResponse response

  2. HttpServletReuest reuest,ActionMapping mapping

  3. ActionMapping mapping,HttpServletReuest reuest

  4. ActionMapping mapping,HttpServletResponse response


Correct Option: C

Other name of Struts 2 was

  1. WorkWeb 2

  2. WebWork 2

  3. Jstruts 2

  4. None of the above


Correct Option: B

The reset method on an ActionForm

  1. Sets all properties to their initial value

  2. Sets all properties to null

  3. Repopulates all properties from the request parameters

  4. None of the above


Correct Option: D

The validating init-param of the ActionServlet is used to

  1. Bypass calls to the ActionForm validate method

  2. Bypass validation of the Struts configuration file

  3. Generate an error message if an unknown message key is used

  4. None of Above


Correct Option: B

To prevent possible security issues with the tag, you should

  1. Call the reset method if validation fails

  2. Set the tag's redisplay property to false

  3. Set the tag's reset property to false

  4. Use a plain html tag instea


Correct Option: B

To localize Validator forms, you can

  1. Create separate configuration files for each locale

  2. Specify a locale for a form-set

  3. Either A or B

  4. None of Above


Correct Option: C

Which method is necessary for Action class?

  1. valuator()

  2. reset()

  3. findForward()

  4. execute()


Correct Option: D

The parameters passed into execute() method is?

  1. ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response.

  2. Mapping mapping, ActionForm form, ServletRequest request, ServletResponse response.

  3. ActionMapping mapping, Form form, ServletRequest request, ServletResponse response.

  4. ActionMapping mapping, ActionForm form, ServletRequest request, Response response.


Correct Option: A

Where key will generated?

  1. In Action class

  2. In ActionForm Class

  3. In ActionMapping Class

  4. In ActionServlet Class


Correct Option: C

The class instantiates ActionForm and puts it in appropriate scope based on scope tag?

  1. ActionServlet

  2. ReuestProcessor

  3. Action

  4. HttpReuest


Correct Option: B

reset() method signature in ActionForm ?

  1. public void reset(ActionMapping mapping, HttpServletReuest reuest)

  2. public ActionErrors reset(ActionMapping mapping, HttpServletReuest reuest)

  3. public ActionError reset(ActionMapping mapping, HttpServletReuest reuest)

  4. None of the above


Correct Option: A

AI Explanation

To answer this question, we need to understand the purpose of the reset() method in an ActionForm class.

The reset() method in an ActionForm class is used to reset the form fields to their default values. It is typically called before the form is displayed to the user or when the form is submitted without any input.

Now let's analyze each option:

A) public void reset(ActionMapping mapping, HttpServletRequest request) - This option is correct because it has the correct method signature for the reset() method in an ActionForm class. It takes two parameters: ActionMapping and HttpServletRequest. The ActionMapping parameter represents the mapping information for the current action, and the HttpServletRequest parameter represents the current HTTP request.

B) public ActionErrors reset(ActionMapping mapping, HttpServletRequest request) - This option is incorrect because the return type is ActionErrors, which is used to store any validation errors. The reset() method in an ActionForm class should have a void return type.

C) public ActionError reset(ActionMapping mapping, HttpServletRequest request) - This option is incorrect because the return type is ActionError, which represents a single validation error. The reset() method in an ActionForm class should have a void return type.

D) None of the above - This option is incorrect because option A is the correct answer.

Therefore, the correct answer is option A) public void reset(ActionMapping mapping, HttpServletRequest request). This option has the correct method signature for the reset() method in an ActionForm class.

Correct format?

  1. None of the above


Correct Option: A

Correct seuence of ActionForm execution?

  1. setter,reset

  2. Initialization,setter,reset

  3. setter,reset,Initialization

  4. reset,Initialization,setter


Correct Option: B

What does validate () method of ActionForm returns?

  1. ActionErrors

  2. ActionForward

  3. ActionMapping

  4. ActionError


Correct Option: A
Explanation:

To answer this question, the user needs to know about the validate() method of ActionForm in Java.

The validate() method of ActionForm is used to validate the form data submitted by the user. It returns an object of the ActionErrors class, which contains a list of errors that occurred during the validation process.

Therefore, the correct answer is:

The Answer is: A. ActionErrors

If validate="false" in struts-config.xml action tag?

  1. Validate() method of ActionForm called automatically

  2. Validate() method of Action called automatically

  3. Validate() method of ActionForm Not Called automatically

  4. None Of the above


Correct Option: C

AI Explanation

To answer this question, we need to understand the purpose of the validate attribute in the `tag of thestruts-config.xml` file in the Struts framework.

The validate attribute is used to specify whether the validate() method of the associated ActionForm class should be automatically called before executing the action.

When the validate attribute is set to "true", the validate() method of the associated ActionForm class is called automatically. This allows for server-side validation of the form inputs before processing the action.

On the other hand, when the validate attribute is set to "false", the validate() method of the associated ActionForm class will not be called automatically. This means that the server-side validation of the form inputs will not be performed before executing the action.

Based on this understanding, let's go through each option:

Option A) Validate() method of ActionForm called automatically This option is incorrect because when validate="false", the validate() method of the ActionForm class is not called automatically.

Option B) Validate() method of Action called automatically This option is incorrect because the validate() method of the Action class is not directly related to the validate attribute in the `tag. Thevalidate()method of theActionclass is responsible for implementing any additional validation logic specific to the action, and it is not affected by thevalidate` attribute.

Option C) Validate() method of ActionForm Not Called automatically This option is correct. When validate="false", the validate() method of the associated ActionForm class will not be called automatically.

Option D) None of the above This option is incorrect because option C is the correct answer.

Therefore, the correct answer is C. The validate() method of the ActionForm class is not called automatically when validate="false" in the `tag of thestruts-config.xml` file.

How to trigger validate () method of ActionForm?

  1. validate="false"

  2. validate="true"

  3. validate="yes"

  4. validate="no"


Correct Option: B

AI Explanation

To trigger the validate() method of an ActionForm, you need to set the validate attribute to "true".

Explanation of each option:

A. validate="false": This option will not trigger the validate() method of the ActionForm. It disables the validation process.

B. validate="true": This option will trigger the validate() method of the ActionForm. It enables the validation process.

C. validate="yes": This option is not a valid attribute value for the validate attribute. It will not trigger the validate() method.

D. validate="no": This option is not a valid attribute value for the validate attribute. It will not trigger the validate() method.

Therefore, the correct answer is B) validate="true". This option enables the validation process and triggers the validate() method of the ActionForm.

Struts Framework is well suited for application of ____ size

  1. Small

  2. Any

  3. Average

  4. Verysmall


Correct Option: B

AI Explanation

To answer this question, you need to understand the characteristics and features of the Struts Framework.

The Struts Framework is an open-source framework that is well-suited for developing web applications. It follows the Model-View-Controller (MVC) architectural pattern, which helps in separating the different layers of an application.

The Struts Framework is designed to be flexible and scalable, making it suitable for applications of different sizes. It provides various features like request handling, validation, data binding, and error handling, which can be utilized in applications of any size.

Therefore, the correct answer is:

B) Any - The Struts Framework is well-suited for applications of any size.

To specify an ActionMapping to use when a request doesn't match any other mapping, you can

  1. Use an asterisk for the path property

  2. Set the "default" property of the mapping to "true"

  3. Set the "unknown" property of the mapping to "true"

  4. Set the "missing" init-param of the ActionServlet to the mapping's path


Correct Option: C

How can we retrieve keyed values from a previously defined resource bundle?

  1. Using

  2. Using

  3. Using

  4. Using


Correct Option: A

Which is correct execute method of Action class?

  1. public void execute(ActionMapping mapping, ActionForm form, HttpServletReuest reuest, HttpServletResponse response) throws IOException

  2. public ActionForward execute (ActionMapping mapping, ActionForm form, ServletReuest reuest, ServletResponse response) throws Exception

  3. public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletReuest reuest, HttpServletResponse response) throws Exception

  4. public ActionForward execute (ActionMapping mapping, ActionForm form, ServletReuest reuest, ServletResponse response) throws SevletException, IOExpection.


Correct Option: C
- Hide questions