Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Web Developer Interview Questions and Answers

Ques 36. What is the purpose of the 'role' attribute in HTML?

The 'role' attribute is used to define the purpose or type of an element for accessibility, helping assistive technologies interpret content.

Example:

Unchecked

Is it helpful? Add Comment View Comments
 

Ques 37. Explain the concept of 'WebSockets' and how they differ from HTTP.

WebSockets provide a full-duplex communication channel over a single, long-lived connection, enabling real-time communication between the client and server, unlike the request-response nature of HTTP.

Is it helpful? Add Comment View Comments
 

Ques 38. What is the purpose of the 'fetch' API in JavaScript?

The 'fetch' API is used to make HTTP requests and handle responses in a more flexible and modern way compared to the traditional 'XMLHttpRequest'.

Example:

fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data));

Is it helpful? Add Comment View Comments
 

Ques 39. Explain the concept of 'Cross-site Scripting (XSS)' and how to prevent it.

XSS is a security vulnerability where attackers inject malicious scripts into web pages. To prevent it, developers should sanitize user input, use proper encoding, and implement Content Security Policy (CSP).

Is it helpful? Add Comment View Comments
 

Ques 40. What is the purpose of the 'transition' property in CSS?

The 'transition' property is used to create smooth transitions between different property values, allowing for animation effects.

Example:

div {
  transition: width 2s, height 2s;
}

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2025 WithoutBook