1z0-900

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

Question 21

Given the code fragments: Which action completes this composite primary key implementation?

  1. Add @IdClass annotation at line 1.
  2. Add @Embeddable annotation at line 1 and replace both @Id annotations with @EmbeddedId annotations.
  3. Add @IdClass(ContactId.class) annotation at line 2.
  4. Add @Embeddable annotation at line 1 and @EmbeddedId(ContactId.class) at line 2.

Question 22

Given the code fragment: How can you apply DateConverter to the birthday field?

  1. by adding @Convert(to=Date.class) at line 3
  2. by invoking the setConverter(DateConverter.class) method on the EntityManager object
  3. by adding @Converter(autoApply=true) at line 1
  4. by adding @Convert((DateConverter.class)) at line 2

Question 23

Which class do you use to handle an incoming JSON Message as a stream?

  1. JsonReader
  2. JsonObjectBuilder
  3. JsonParser
  4. JsonObject

Question 24

Which two approaches would result in the current date being added to the output of a JSP? (Choose two.)

  1. <%= out.printIn(new java.util.Date()) %>
  2. <% out.printIn(new java.util.Date()); %>
  3. <%= new java.util.Date() %>
  4. <% System.out.printIn(new java.util.Date()); %>

Question 25

Given the code fragment: How are transactions managed?

  1. through a single shared transaction across the connection factory
  2. through a separate transaction per JMS Consumer
  3. through a single transaction for the entire JMS Topic
  4. through a single shared transaction in the JMS Context