RESTful Mock Test


Advertisements

This section presents you various set of Mock Tests related to RESTful Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

RESTful Mock Test III

Q 4 - Which of the following HTTP Status code means OK, shows success?

A - 200

B - 201

C - 204

D - 304

Answer : A

Explanation

HTTP Status Code 200 means OK, shows success.

Q 5 - Which of the following HTTP Status code means CREATED, when a resource is successful created using POST or PUT request?

A - 200

B - 201

C - 204

D - 304

Answer : B

Explanation

HTTP Status Code 201 means CREATED, when a resource is successful created using POST or PUT request.

Q 6 - Which of the following HTTP Status code means NO CONTENT, when response body is empty for example, a DELETE request?

A - 200

B - 201

C - 204

D - 304

Answer : C

Explanation

HTTP Status Code 204 means NO CONTENT, when response body is empty for example, a DELETE request.

Q 7 - Which of the following HTTP Status code means NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests?

A - 200

B - 201

C - 204

D - 304

Answer : D

Explanation

HTTP Status Code 304 means NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests.

Q 8 - Which of the following HTTP Status code means BAD REQUEST, states that invalid input is provided e.g. validation error, missing data?

A - 400

B - 401

C - 404

D - 409

Answer : A

Explanation

HTTP Status Code 400 means BAD REQUEST, states that invalid input is provided e.g. validation error, missing data.

Q 9 - Which of the following HTTP Status code means FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights?

A - 400

B - 403

C - 404

D - 409

Answer : B

Explaination

HTTP Status Code 403 means FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights.

Q 10 - Which of the following HTTP Status code means NOT FOUND, states that method is not available?

A - 400

B - 401

C - 404

D - 409

Answer : C

Explanation

HTTP Status Code 404 means NOT FOUND, states that method is not available.

Q 11 - Which of the following HTTP Status code means CONFLICT, states conflict situation while executing the method for example, adding duplicate entry?

A - 400

B - 401

C - 404

D - 409

Answer : D

Explanation

HTTP Status Code 409 means CONFLICT, states conflict situation while executing the method for example, adding duplicate entry.

Q 12 - Which of the following HTTP Status code means INTERNAL SERVER ERROR, states that server has thrown some exception while executing the method?

A - 500

B - 401

C - 404

D - 409

Answer : A

Explanation

HTTP Status Code 500 means INTERNAL SERVER ERROR, states that server has thrown some exception while executing the method.

Answer : C

Explanation

JAX-RS stands for JAVA API for RESTful Web Services.

Q 16 - Which of the following annotation of JAX RS API is used to annotate a method to get the relative path of the resource class/method?

A - @Path

B - @GET

C - @PUT

D - @POST

Answer : A

Explanation

@Path - Relative path of the resource class/method.

Q 17 - Which of the following annotation of JAX RS API is used to annotate a method used to fetch resource?

A - @Path

B - @GET

C - @PUT

D - @POST

Answer : B

Explanation

@GET − HTTP Get request, used to fetch resource.

Q 18 - Which of the following annotation of JAX RS API is used to annotate a method used to create resource?

A - @Path

B - @GET

C - @PUT

D - @POST

Answer : C

Explanation

@PUT − HTTP Get request, used to create resource.

Q 19 - Which of the following annotation of JAX RS API is used to annotate a method used to create/update resource?

A - @Path

B - @GET

C - @PUT

D - @POST

Answer : D

Explanation

@POST − HTTP Get request, used to create/update resource.

Q 20 - Which of the following annotation of JAX RS API is used to annotate a method used to delete resource?

A - @DELETE

B - @HEAD

C - @Produces

D - @Consumes

Answer : A

Explanation

@DELETE − HTTP Get request, used to delete resource.

Q 21 - Which of the following annotation of JAX RS API is used to get status of method availability?

A - @DELETE

B - @HEAD

C - @Produces

D - @Consumes

Answer : B

Explanation

@HEAD − HTTP HEAD request, used to get status of method availability.

Q 22 - Which of the following annotation of JAX RS API states the HTTP Response generated by web service?

A - @DELETE

B - @HEAD

C - @Produces

D - @Consumes

Answer : C

Explanation

@Produces − States the HTTP Response generated by web service, for example APPLICATION/XML, TEXT/HTML, APPLICATION/JSON etc.

Q 23 - Which of the following annotation of JAX RS API states the HTTP Request type?

A - @DELETE

B - @HEAD

C - @Produces

D - @Consumes

Answer : D

Explanation

@Consumes − States the HTTP Request type, for example application/x-www-form-urlencoded to accept form data in HTTP body during POST request.

Q 24 - Which of the following annotation of JAX RS API binds the parameter passed to method to a value in path?

A - @PathParam

B - @QueryParam

C - @MatrixParam

D - @HeaderParam

Answer : A

Explanation

@PathParam − Binds the parameter passed to method to a value in path.

Q 25 - Which of the following annotation of JAX RS API binds the parameter passed to method to a query parameter in path?

A - @PathParam

B - @QueryParam

C - @MatrixParam

D - @HeaderParam

Answer : B

Explanation

@QueryParam − Binds the parameter passed to method to a query parameter in path.

Answer Sheet

Question Number Answer Key
1 C
2 C
3 C
4 A
5 B
6 C
7 D
8 A
9 B
10 C
11 D
12 A
13 C
14 C
15 C
16 A
17 B
18 C
19 D
20 A
21 B
22 C
23 D
24 A
25 B
restful_questions_answers.htm
Advertisements