0% found this document useful (0 votes)
119 views5 pages

Quiz 9

Uploaded by

rita.jiang889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views5 pages

Quiz 9

Uploaded by

rita.jiang889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Quiz 09 - REST Demo

Question 1 (1 point)
Saved
The annotations:
@Produces( MediaType.APPLICATION_JSON)
@Consumes( MediaType.APPLICATION_JSON)
will let the system know you are planning to use JSON for your
method.

They must only be placed on each appropriate methods.


Question 1 options:
a) True
b) False
Question 2 (1 point)
Saved
Which annotation is needed to define the path of a resource?
(Not sub paths)
Question 2 options:

a) @ApplicationPath on every method.

b) @ApplicationPath on the class.

c) @Path placed on every method.

d) @Path placed on the class.

Question 3 (1 point)
Saved
The annotation @RolesAllowed must be used on a method to
define roles that can access it. It cannot be replaced or used
in conjunction with programmatic role setup.
Question 3 options:
a) True
b) False
Question 4 (1 point)
Saved
What is/are true regarding MessageHolder?
Select 3 correct answer(s)
Question 4 options:

a) MessageHolder must always have string theMessage and LocalDateTime date.

b) The internal variables/methods inside MessageHolder represent what the final JSON will look like.

c) Names provided on the getters will affect the final names of JSON fields.

d) Instance of MessageHolder is the message that will be sent back to client in JSON format.

Question 5 (1 point)
Saved
Which annotation is needed to define the main path of your
REST application?
Question 5 options:

a) @ApplicationPath placed on every resource class.

b) @ApplicationPath placed on main class which extends the Application class.

c) @Path placed on main class which extends the Application class.


d) @Path placed on every resource class.

Question 6 (1 point)
Saved
Annotation @Path can be placed on what?
Question 6 options:

a) Class

b) Variables or fields

c) Method

Question 7 (1 point)
Saved
This is the primary class of a REST application. What is
missing?
public class RestMain {

public Map<String, Object> getProperties() { }

Question 7 options:

a) extends javax.ws.rs.core.Application

b) extends javafx.application.Application

c) No extends is needed.

d) implements jakarta.ws.rs.core.Application

Question 8 (1 point)
Saved
In what class do we need to add @DeclareRoles to declare
the roles we will use in our REST application?
Question 8 options:

a) @DeclareRoles can be placed anywhere.

b) It must only be placed in web.xml.

c) Main class that extends the Application class.

Question 9 (1 point)
Saved
When defining a sub resource like below:
@GET

@Path("{resourceId}")

public Response getForSpecificResource(int id) {

/*some code*/

What annotation is missing?


Question 9 options:

a) Nothing

b) @PathParam("resourceId")

Question 10 (1 point)
Saved
The class MessageHolder must always be created with the
exact variables below:
protected String theMessage;
protected LocalDateTime date;
Question 10 options:
a) True
b) False

You might also like