Engineering Questions with Answers - Multiple Choice Questions

MCQs on Web Caching

1 - Question

What does REST stand for?
a) Represent State Transfer
b) Representational State Transfer
c) Representing State Transfer
d) Representation State Transfer

View Answer

Answer: b
Explanation: REST stands for Representational State Transfer and is a software architecture style in which the server sends a representation of the state of the resource that it requests. It provides interoperability between the systems.




2 - Question

Which of the following protocol is used by Restful web services as a medium of communication between client and server?
a) HTTP
b) FTP
c) Gopher
d) TELNET

View Answer

Answer: a
Explanation: Restful web services make use of HTTP protocol as a medium of communication between client and server. The REST architecture was known as the HTTP object model back in the year 1994.




3 - Question

Which of the following is not a good practice to create a standard URI for a web service?
a) Maintain Backward Compatibility
b) Use HTTP Verb
c) Using spaces for long resource names
d) Use lowercase letters

View Answer

Answer: c
Explanation: We must use hyphens (-) or underscores (_) instead of spaces to represent long resource names. It may lead to the resource to be less recognizable for the system if we use spaces instead.




4 - Question

Which of the following HTTP methods should be idempotent in nature?
a) OPTIONS
b) DELETE
c) POST
d) HEAD

View Answer

Answer: b
Explanation: DELETE operation should be idempotent, means their result will always same no matter how many times these operations are invoked. Also, the PUT operation is supposed to be idempotent.




5 - Question

Which of the following directive of Cache Control Header of HTTP response indicates that resource is cachable by only client and server?
a) Public
b) Private
c) Nocache/nostore
d) Maxage

View Answer

Answer: b
Explanation: Private directive indicates that resource is cachable by only client and server; no intermediary can cache the resource. But if we use the public directive, it indicates that the resource may be cachable by any intermediary component.




6 - Question

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

View Answer

Answer: b
Explanation: HTTP Status Code 201 means CREATED, when a resource is successful created using POST or PUT request. The code 200 means success i.e. OK, code 204 means NO CONTENT, and the code 304 means NOT MODIFIED.




7 - Question

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

View Answer

Answer: c
Explanation: @PUT is the HTTP request that is used to create resource and also define a complete resource path. @POST may also be used to create a resource but it won’t define a resource path i.e. an accessing medium.




8 - Question

Which of the following annotation of JAX RS API binds the parameter passed to method to a HTTP matrix parameter in path?
a) @PathParam
b) @QueryParam
c) @MatrixParam
d) @HeaderParam

View Answer

Answer: c
Explanation: @MatrixParam is the annotation that binds the parameter passed to method to a HTTP matrix parameter in path, while @QueryParam binds to a query parameter, @PathParam binds to a value and @HeaderParam binds to the HTTP header in the path.




9 - Question

In REST architecture, a REST Server simply provides access to resources and REST client accesses and presents the resources.
a) False
b) True

View Answer

Answer: b
Explanation: In REST architecture, a REST Server simply provides access to resources and REST client accesses and presents the resources. It is popularly used because it makes efficient use of the bandwidth and can be cached for better performance and scalability.




10 - Question

POST operation should be idempotent.
a) True
b) False

View Answer

Answer: b
Explanation: POST operation can cause different result so they are not idempotent. The DELETE and PUT operations are idempotent as they invoke the same result every time they are called.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners