Explain the purpose of each of the HTTP request types when used with a RESTful web service.?
The purpose of each of the HTTP request types, when used with a RESTful web service, is as follows: GET: Retrieves data from the server (should only retrieve data and should have no other effect). POST: Sends data to the server for a new entity. It is often used when uploading a file or submitting a completed web form. PUT: Similar to POST, but used to replace an existing entity. PATCH: Similar to PUT, but used to update only certain fields within an existing entity. DELETE: Removes data from the server. TRACE: Provides a means to test what a machine along the network path receives when a request is made. As such, it simply returns what was sent. OPTIONS: Allows a client to request information about the request methods supported by a service. The relevant response header is Allow and it simply lists the supported methods. (It can also be used to request information about the request methods supported by the server where the service resides by using a * wildcard in the URI.) HEAD: Same as the GET method for a resource, but returns only the response headers (i.e., with no entity-body). CONNECT: Primarily used to establish a network connection to a resource (usually via some proxy that can be requested to forward an HTTP request to TCP and maintain the connection). Once established, the response sends a 200 status code and a “Connection Established” message.
What is doctype? Why do u need it?
Doctype is an instruction to the browser to inform about the version of html document and how browser should render it. It ensures how element should be displayed on the page by most of the browser. And it also makes browser's life easier. otherwise, browser will guess and will go to quirks mode. Moreover, doctype is required to validate markup.
What is the role of protected access specifier?
If a class member is protected then it is accessible in the inherited class. However, outside both the private and protected members are not accessible.