RESTful Services MCQs

RESTful Services MCQs

Our experts have gathered these RESTful Services MCQs through research, and we hope that you will be able to see how much knowledge base you have for the subject of RESTful Services by answering these 50+ multiple-choice questions.
Get started now by scrolling down!

1: When you wish to read a collection of “Foo” via a RESTful API, which is most appropriate?

A.   POST /api/foos

B.   PUT /api/foos

C.   DELETE /api/foos

D.   GET /api/foos

2: A RESTful Web Service URI should map to __________________?

A.   (All of these)

B.   a file on the disk

C.   a method on a class

D.   an entity or resource

3: In the context of a web service, a RESTful API should...

A.   (none of these are correct)

B.   Make individual resources available at unique URIs

C.   Make individual reources available at the same URI

4: Which HTTP method should be used to update a resource in a RESTful Web Service?

A.   POST

B.   DELETE

C.   PUT

D.   GET

5: When you wish to read a single “Foo” via a RESTful API, which is most appropriate?

A.   PUT /api/foos/123

B.   DELETE /api/foos/123

C.   POST /api/foos/123

D.   GET /api/foos/123

6: When you wish to delete an existing “Foo” via a RESTful API, which is most appropriate?

A.   DELETE /api/foos/123

B.   GET /api/foos/123

C.   PUT /api/foos/123

D.   POST /api/foos/123

7: Identify the method which is not predefined in HTTP specification

A.   FIND

B.   POST

C.   PUT

D.   GET

8: Which request would best describe removing an user in a RESTful Web Service?

A.   DELETE /users/1

B.   GET /users/delete?id=1

C.   PUT /users/delete/1

D.   POST /users/1

9: What happens if Restful resources are accessed by multiple clients?

A.   Multiple clients can safely access Restful resources concurrently

B.   XML protocol will be used to access clients

C.   SOAP service will be implemented

D.   Synchronization will be made to the Restful resource request

10: RESTful web services are designed with ____ in mind.

A.   Peer to peer communications

B.   Encrypted communications

C.   Client-server communications

D.   Raw socket data transfer communications

11: Which is a true statement in the basic REST design principle that uses HTTP request methods to update resources?

A.   To create a resource on the server, use EXECUTE

B.   To create a resource on the server, use POST

C.   To create a resource on the server, use CREATE

D.   To create a resource on the server, use ADD

12: Consider a RESTful resource available on the URI /posts. Which is the correct HTTP method used to create a new entry?

A.   GET

B.   PUT

C.   POST

D.   HEAD

13: REST is an acronym for representational state transfer

A.   True

B.   False

14: When you wish to create a new “Foo” via a RESTful API, which is most appropriate?

A.   PUT /api/foos

B.   POST /api/foos

C.   DELETE /api/foos

D.   GET /api/foos

15: What is the advantage of including Cache control and Last-Modified (a date value) HTTP response header?

A.   Improves performance by reducing the requests for duplicate resources

B.   Includes links to subordinate resources to keep them connected

C.   Resources organized by date for using hierarchical syntax

D.   Avoids query strings

16: What are the prerequisites for an application to interact with a resource?

A.   Identifier of the resource and Action required

B.   Well managed cache control

C.   Code on demand

D.   Format of the presentation

17: When you wish to update an existing “Foo” via a RESTful API, which is most appropriate?

A.   DELETE /api/foos/123

B.   POST /api/foos/123

C.   GET /api/foos/123

D.   PUT /api/foos/123

18: Which of the following is true of RESTful Web Service?

A.   No transfer of XML

B.   Use HTTP methods explicitly

C.   Inconsistent with protocol definition

D.   Caters to any client in one language

19: Which data formats can be transfered through RESTful Web Services?

A.   Any format

B.   JSON

C.   XML

D.   Haml

20: True of False? REST, being an architectural style, does not concern implementation details

A.   True

B.   False

21: What is the key difference between RESTful web services and SOAP web services?

A.   REST uses HTTP protocol for producing or consuming web services while SOAP uses XML

B.   SOAP is transport protocol specific whereas REST is transport protocol neutral

C.   SOAP can be cached and REST cannot be cached

D.   SOAP is more lightweight as compared to REST

22: Identify the item which is not an intermediary for communication in REST

A.   Proxies

B.   Firewalls

C.   Gateways

D.   Viruses

23: Which is the preferred method of determining the format of the data being transfered in a RESTful request?

A.   Extension in URI. E.g. /users.json

B.   HTTP Content-Type header

C.   A string containing MIME-Type in the HTTP body

D.   Inference from the HTTP method used

24: Which of the following best describes a RESTful service?

A.   Web Services with focus on system resources and transfer of state of resource over http by a wide range of clients written in different languages

B.   An application protocol for distributed, collaborative, hypermedia information systems.

C.   Structured text that uses hyperlinks between nodes containing text to exchange or transfer hypertext

D.   A protocol specification for exchanging structured information in the implementation of Web Services in computer networks

25: RESTful web services must be stateful

A.   False

B.   True

26: As an idempotent method, which of the following should not happen when issuing a GET request to a RESTful Web Service?

A.   Return resource data

B.   Increment an internal counter

C.   Update a resource entry

D.   Log the request data

27: What determines the action to be executed on a RESTful request?

A.   HTTP Method

B.   Verb on URI

C.   Query string parameters

D.   Verb on request body

28: Which of the following best describe REST?

A.   a framework

B.   a standard

C.   (None of these)

D.   an architectural style

29: How can users log into RESTful API to see protected resources only?

A.   It depends on entitlement per Data Protection Act

B.   Since server is stateless, client has to provide all information to make request

C.   Encryption and Decryption technology addresses the need

D.   Users apply for permission to enable them to login

30: Statelessness is one of the formal constraint of REST Web Service, which feature is addressed due to absence of state on the server?

A.   Modifies components to meet changing needs while an application is running

B.   Uniform interface separates each client from the server

C.   A default page or resource is provided as a response

D.   Improves Web service performance as it removes the need to synchronize session data with an external application

A.   SOAP is a subset of REST that is stricter

B.   REST is a subset of SOAP that is stricter

C.   REST is an alternative to SOAP

D.   REST is the same as SOAP, except that REST does not specify that the format of interchange is XML

32: Which of the following cannot be considered a REST design principle

A.   (None of these)

B.   Stateless

C.   Makes use of standard HTTP methods

D.   Client-server separation

A.   False

B.   True

34: Suppose you're writing a REST resource for listing all coments made by an user. Which would be the most appropriate URI?

A.   /user/id?fields=comments

B.   /comments?user={id}

C.   /comments/user/{id}

D.   /users/{id}/comments

35: Which HTTP methods are considered "safe", meaning that the request should not produce side-effects or alter the server state?

A.   GET, POST, PUT and DELETE

B.   HEAD, GET, OPTIONS and TRACE

C.   HEAD, GET, PUT and OPTIONS

D.   HEAD, POST, GET and PUT

36: Identify which is not a formal REST constraint

A.   Master Data

B.   Cache Responses

C.   Stateless Principle

D.   Client-server

37: Which software architecture is used for designing and developing software with "RESTful" interfaces?

A.   Service Oriented Architecture

B.   Enterprise Architecture

C.   Software System Architecture

D.   Resource Oriented Architecture

38: PUTting to the following URI will do generally do what? /users/123/posts

A.   Replace the entire posts collection for the user 123.

B.   Fail to do anything

C.   Add a new post

39: True or False? It is a design flaw for RESTful Web Services to reveal data gradually, linking to additional resources on the response body.

A.   True

B.   False

40: True or False? In RESTful Web Services each URI can map to one or more resources.

A.   False

B.   True

41: What is the mechanism that mediates communication, coordination or cooperation among components like data streams known as?

A.   Configuration

B.   Pattern

C.   Connector

D.   Architecture

42: Who is responsible for tracking the application state on a system that communicates through a RESTful Web Service

A.   Both client and server

B.   (None of these)

C.   Server

D.   Client

43: Which of the following describe the correct way to let a client progress through states in a RESTful application?

A.   A link in the response body pointing to the next state

B.   There is no way to track states in RESTful applications

C.   (None of these)

D.   The server should track the state for the client

44: Which of the following is one of the interface constraints for REST that allows the server functionality to evolve independently?

A.   API (Application Programming Interface)

B.   HATEOAS (Hypertext As The Engine Of Application State)

C.   SOAP (Simple Object Access Protocol)

D.   WSS (Web Services Security)

45: How might HATEOAS principles be applied in a RESTful web service?

A.   Each response should include state of related resources

B.   (all of these are correct)

C.   Each response should include metadata about the resource, such as when the data is valid until

D.   Each response should include links to the other related resources

46: Which of the following should not be present in RESTful Web Services URIs?

A.   (All of these)

B.   Nouns

C.   Parameters. E.g. id, page, etc.

D.   Verbs

47: What is an appropriate HTTP response for issuing a GET request to /users/1/delete on a RESTful Web Service?

A.   500 Internal Server Error

B.   200 OK

C.   302 Found

D.   405 Method Not Allowed

48: Which is the foundational constraint in REST that defines the separation between service, consumer and the technical contract?

A.   URL

B.   Client server

C.   Media

D.   Cache

49: The process of determining which representation of a resource to respond with is called

A.   Resource Negotiation

B.   Content Negotiation

C.   Media Negotiation

D.   Representation Negotiation

50: What is the appropriate error response for a request that sends an entity in XML (with header `Content-Type: application/xml; charset=UTF-8`) when the server only understands JSON.

A.   406 Not Acceptable

B.   400 Bad Request

C.   200 OK with a resource that describes the error

D.   415 Unsupported Media Type