GSSP-Java

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

Question 6

Mark works as a Programmer for InfoTech Inc. He develops the following deployment descriptor code. A Secure Application ... Manager Admin Programmer Admin Employee Which of the following is a valid isUserInRole() method call that can be made if request is the HttpServletRequest request?

  1. request.isUserInRole("Programmer");
  2. request.isUserInRole("Manager");
  3. request.isUserInRole("Admin");
  4. request.isUserInRole("Employee");

Question 7

Which of the following methods of the EJBContext interface can be called by both the BMT and CMT beans? Each correct answer represents a complete solution. Choose all that apply.

  1. getCallerPrincipal()
  2. getRollbackOnly()
  3. getUserTransaction()
  4. isCallerInRole()

Question 8

Mark works as a Programmer for InfoTech Inc. He develops a deployment descriptor code that contains three valid elements. All of them constraining a Web resource Res1, the sub-element of the elements are as follows. Admin Manager Which of the following can access the resource Res1?

  1. Only Manager can access the resource.
  2. No one can access the resource.
  3. Everyone can access the resource.
  4. Only Admin can access the resource.

Question 9

Which of the following statements correctly describe the features of the singleton pattern? Each correct answer represents a complete solution. Choose all that apply.

  1. Singletons are used to control object creation by limiting the number to one but allowing the flexibility to create more objects if the situation changes.
  2. Singletons can only be stateless, providing utility functions that need no more information than their parameters.
  3. A singleton class may disappear if no object holds a reference to the Singleton object, and it will be reloaded later when the singleton is needed again.
  4. The behavior of a singleton can be obtained by static fields and methods such as java.lang.Math.sin(double).

Question 10

Which of the following deployment descriptor elements must contain the element as its mandatory sub-element?

  1. <user-data-constraint>
  2. <web-resource-collection>
  3. <auth-constraint>
  4. <login-config>