5 Most Commonly asked interview question on web development

1.What are Different HTTP requests in RESTful Webservices?

The purpose of each of the HTTP request types when used with a RESTful web service is as follows:
  1. GET: Retrieves data from the servers (should only retrieve data and should have no other effect).
  2. POST: Sends data to the server for a new entities. It is often used when uploading a file or submitting a completed web forms.
  3. PUT: Similar to POST, but used to replace an existing entities.
  4. PATCH: Similar to PUT, but used to update only certain fields within an existing entities.
  5. DELETE: Removes data from the servers.
  6. TRACE: Provides a means to test what a machine along the network path receives when a request is made. As such, it simply return what was sent.
  7. OPTIONS: Allows a client to requests 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 for the server where the service resides by using a * wildcard in the URI.)
  8. HEAD: Same as the GET method for a resource, but return only the response headers (i.e., with no entity-body).
  9. CONNECT: Primarily used to establish a network connection to a resources (usually via some proxy that can be requested to forward an HTTP request as TCP and maintain the connection). Once established, the response sends a 200 status code and a “Connection Established” message.

2.How many times the Ajax Request is Placed?

<code>function startAjaxQueue(){
  for (var i = 0; i &lt; 50; i++){
   executeAjaxCallAsync();
  }
}; </code>
Number of concurrent HTTP request and XmlHttpRequest is limited in all browsers. Specific limitations are different depending on browser type and versions.
For example, according to Mozilla Developer Network Firefox 3 limits the number of XMLHttpRequest connections per servers to 6 (previous versions limit this to 2 per server).
Having this mind, the number of concurrent HTTP requests created in this loop would never (by default) be larger than 6, and the browser would therefore execute this loop in chunks.

3.What are the Advantages of HTTP/2 over HTTP/1.1?

HTTP/2 provides decreased latency to improve page load speeds by supporting:
  • Data compression of HTTP headers
  • Server push technology
  • Loading of page elements in parallel over a single TCP connection
  • Prioritization of requests

4.What is CORS?

Cross-origin resource sharing (CORS) is a mechanisms that allows many resources (e.g., fonts, JavaScript, etc.) on a web page to be requested from another domains outside the domain from which the resource originated. It’s a mechanisms supported in HTML5 that manages XMLHttpRequest access to a domain different.
CORS adds new HTTP headers that provide access to permitted origin domain. For HTTP methods other than GET (or POST with certain MIME types), the specification mandates that browser first use an HTTP OPTIONS request header to solicit a list of supported (and available) methods from the server. The actual request can then be submitted. Server can also notify clients whether “credentials” (including Cookies and HTTP Authentication data) should be sent with requests.

5.Explain the difference between stateless and stateful protocols. Which type of protocol is HTTP? Explain your answer.

stateless communications protocol treats each request as an independent transactions. It therefore does not require the server to retain any session, identity, or status information spanning multiple request from the same source. Similarly, the requestor can not rely on any such information being retained by the responder.
In contrast, a stateful communication protocol is one in which the responder maintains “state” information (session data, identity, status, etc.) across multiple requests from the same source.
HTTP is a stateless protocol. HTTP does not require server to retain informations or status about each user for the duration of multiple requests.
Some web servers implement states using different methods (using cookies, custom headers, hidden form fields etc.). However, in the very core of every web application everything relies on HTTP which is still a stateless protocol that is based on simple request/response paradigm.
Take your time to comment on this article.
Previous
Next Post »

1 comments:

Click here for comments
gibsonherry
admin
23 October 2017 at 21:49 ×

This is the first time I came to this blog and I found some relevant stuff here. Basically I keen to know new parameters of writing every-time and sometime it become really very hard to find such kind of platform.
HPE ProLiant ML110 Gen9

Congrats bro gibsonherry you got PERTAMAX...! hehehehe...
Reply
avatar