1z0-900

1z0-900 practice questions, page 4 of 6, with answer review and explanations.

Question 16

Which URL represents an invalid approach to pass a parameter to a REST resource?

  1. <base-url>/Employees?value=1
  2. <base-url>/Employees&value=1
  3. <base-url>/Employees/1
  4. <base-url>/Employees;value=1

Question 17

Given: If an exception is thrown inside the if block, what effect will it have on the transaction?

  1. The transaction will be committed.
  2. The transaction will be suspended.
  3. The transaction will be rolled back.

Question 18

Given the code fragments: What code should you add to the body of the updateEmployee method in order to save pending changes to the database?

  1. entityManager.merge(emp);
  2. Context. Ctx = new InitialContext(); UserTransaction utx = (UserTransaction)ctx.lookup("java:comp/UserTransaction"); utx.begin(); entityManager.merge(emp); utx.commit();
  3. entityManager.lock(emp); EntityManager.merge(emp);
  4. entityManager.getTransaction().begin(); entityManager.merge(emp); entityManager.getTransaction().commit();

Question 19

When handling a JSF request, your application code decided to redirect the call to another URL by using HTTP redirect. Which action should you take to correctly complete the handling of the JSF life cycle?

  1. Set the immediate="true" attribute on the command button that was used to perform this call.
  2. Invoke the dispatch() method on the ExternalContext object.
  3. Invoke the setCurrentPhaseId(RENDER_RESPONSE) method on the FacesContext object.
  4. Invoke the responseComplete() method on the FacesContext object.

Question 20

Given the code fragment: When the context root is requested http://host:port/context, how does the container resolve this mapping?

  1. thirdServlet handles the request.
  2. firstServlet handles the request.
  3. The container throws an error at startup.
  4. secondServlet handles the request.