GSSP-Java

GSSP-Java practice questions, page 7 of 11, with answer review and explanations.

Question 31

Which of the following fields must be present in the login page when using the form-based authentication? Each correct answer represents a part of the solution. Choose two.

  1. j_login
  2. j_password
  3. get_pw
  4. j_pw
  5. j_username
  6. user_pw

Question 32

Mark works as a Programmer for InfoTech Inc. He wants to define the security constraint for an application that allows users with the role of Manager access to the POST method of all resources with the URL pattern /acme/Manager/*, and also allow users with the role of Editor access to the POST method of all resources with the URL pattern /acme/Editor/*. Which of the following code will be used to declare the security element?

  1. <security-constraint> <web-resource-collection> <web-resource-name>Manager</web-resource-name> <url-pattern>/acme/Manager/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Manager</role-name> </auth-constraint> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>Editor</web-resource-name> <url-pattern>/acme/Editor/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Editor</role-name> </auth-constraint> </security-constraint>
  2. <security-constraint> <web-resource-collection> <web-resource-name>Manager</web-resource-name> <url-pattern>/acme/Manager/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Manager</role-name> </auth-constraint> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Editor</role-name> </auth-constraint> </security-constraint>
  3. <security-constraint> <web-resource-collection> <web-resource-name>Manager</web-resource-name> <url-pattern>/acme/Manager/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Manager</role-name> </auth-constraint> <auth-constraint> <role-name>Editor</role-name> </auth-constraint> </security-constraint>
  4. <security-constraint> <web-resource-collection> <web-resource-name>Manager</web-resource-name> <url-pattern>/acme/Manager/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <web-resource-collection> <web-resource-name>Editor</web-resource-name> <url-pattern>/acme/Editor/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Manager</role-name> </auth-constraint> </security-constraint>

Question 33

Which of the following sub-elements specifies which users in specified roles are permitted access to a resource collection?

  1. <user-data-constraint>
  2. <web-resource-collection>
  3. <url-pattern>
  4. <auth-constraint>

Question 34

In which of the following directories will files be searched when the classpath is specified by the syntax below.-classpath uc\JavaFiles\NewFiles;uc\ServletFiles;.;

  1. The current directory, the NewFiles directory, and the ServletFiles directory
  2. The current directory, the uc directory, the NewFiles directory, and the ServletFiles directory
  3. The current directory, the uc directory, the JavaFiles directory, the NewFiles directory, and the ServletFiles directory
  4. The uc directory, the JavaFiles directory, the NewFiles directory, and the ServletFiles directory

Question 35

Which of the following is the appropriate deployment descriptor elements entry for the code given below? @RunAs("admin") @Stateless public class StudentBean implements Student { //more code ... }

  1. <enterprise-beans> ... <session> . <ejb-name>Student</ejb-name> ... <security-identity> <run-as> <method-permission>admin</method-permission> </run-as> </security-identity> ... </session> .. </enterprise-beans>
  2. <enterprise-beans> ... <session> . <ejb-name>Student</ejb-name> ... <security-identity> <run-as> <role-name>admin</role-name> </run-as> </security-identity> ... </session> .. </enterprise-beans>
  3. <enterprise-beans> ... <session> . <ejb-name>Student</ejb-name> ... <security-identity> <run-as> < security-role-ref>admin</ security-role-ref> </run-as> </security-identity> ... </session> .. </enterprise-beans>
  4. <enterprise-beans> ... <session> . <ejb-name>Student</ejb-name> ... <security-identity> <run-as>admin</run-as> </security-identity> ... </session> .. </enterprise-beans>