10 free sample questions from a bank of 63, with the correct answers and explanations. No signup required — start practising right now.
1You need to develop a chat application, which allows the display of emoticons and images together with text messages.
How should you configure a WebSocket endpoints to receive both text and binary messages?
Create two @onMessage methods in the same endpoint with appropriate parameter types.
Define the @onMessage methods in your endpoint with Object as parameter and check the actual type in your code.
You can achieve this only by creating separate WebSocket endpoints for each message type.
Create two @onMessage methods, each with appropriate decoder attribute in the same endpoint.
Answer: A
2Given the code fragment from a Facelet page: On Line 1, you ae asked to insert a search box that displays the text "Search Here" via a placeholder.
Assume searchMB is a valid Managed Bean.
Which two options enable you to create a search box with a placeholder attribute on Line 1? (Choose two.)
Answer:
3Given the code fragment: Which method should be used on line 3 to enable default validation mechanism?
u.setProperty(String, Object)
u.setProperty(Schema)
u.setEventHandler(ValidationEventHandler)
u.setAdapter(XmlAdapter)
Answer: D
4How do you specify a default error page in your web.xml file?
/general-error.html
* /general-error.html
* /general-error.html
/general-error.html
Answer: B
5Given the code fragment: And - Which two steps, when performed independently, enable the index.xhtml page to print the following text: The Id is 12345? (Choose two.)
Replace line 2 with: @Inject public void setAcc(Account acc)
Replace line 3 with: @Inject public Account getAcc()
Replace line 1 with: @Inject private Account acc;
Replace line 3 with: public @Inject Account getAcc()
Replace line 1 with: private @Inject Account acc;
Replace line 2 with: public void setAcc(@Inject Account acc)
Answer: D, F
6Given: How often does the submitted task run?
need more details to determine
once
as many times as you like
based on a schedule
Answer: A
7Given: What code needs to be added to line 1 for MyMapper bean instances to be correctly passivated?
@Stateless @PassivationCapable
@Stateless
@Stateful @PassivationCapable
@Stateful
Answer: D
8Which URL represents an invalid approach to pass a parameter to a REST resource?
/Employees?value=1
/Employees&value=1
/Employees/1
/Employees;value=1
Answer: D
9Given: If an exception is thrown inside the if block, what effect will it have on the transaction?
The transaction will be committed.
The transaction will be suspended.
The transaction will be rolled back.
Answer: C
10Given the code fragments: What code should you add to the body of the updateEmployee method in order to save pending changes to the database?