HTML5 Mostly Asked Interview Questions
HTML5 Mostly Asked Interview Questions
ChatGPT said:
ChatGPT
Basic Level:
1.
2.
3.
4.
1. <header>
2. <footer>
3. <article>
4. <section>
5. <aside>
6. <nav> These elements improve code readability and SEO.
5.
6.
7.
8.
9.
html
10.
11.
Copy code
12.
13.
<audio controls>
<source src="audiofile.mp3"
type="audio/mpeg"></audio>
14.
15.
16.
What is the difference between <b> and <strong> or <i> and <em>?
17.
1. <b> and <i> are for styling only (bold and italic).
2. <strong> and <em> add semantic meaning (strong importance and emphasis).
Intermediate Level:
1.
2.
3.
4.
1. Cookies are sent with every server request and have size limitations.
2. localStorage/sessionStorage are client-side only and allow larger storage.
5.
1. email
2. number
3. date
4. datetime-local
5. range
6. color
Example:
html
Copy code
<input type="email" placeholder="Enter your email">
7.
8.
9.
10.
html
Copy code
<input list="browsers"><datalist id="browsers">
<option value="Chrome">
<option value="Firefox"></datalist>
Advanced Level:
html
Copy code
<picture>
<source media="(min-width: 800px)" srcset="large.jpg">
<img src="default.jpg" alt="Description"></picture>
html
Copy code
<div data-id="123" data-name="Rupa"></div>
1. What is the difference between <script> with and without the defer/async
attribute?
defer: Executes scripts in order after the HTML document is fully parsed.
async: Executes scripts immediately as they are downloaded.
1.
2.
3.
4.
Geolocation API
WebSockets API
Drag and Drop API
Web Workers
Offline Storage with IndexedDB
4o
You said:
yes
ChatGPT said:
ChatGPT
Great! Please let me know which specific question you'd like a detailed explanation or
example for, and I'll elaborate. If you'd prefer, I can go through each one step-by-step.
4o
You said:
ChatGPT
1.
How does the <canvas> element differ from the <svg> element?
2.
o Discuss performance differences, scalability, and use cases for bitmap vs. vector
graphics.
3.
4.
o How Shadow DOM encapsulates styles and DOM structure in Web Components.
5.
What is the difference between <section> and <div>? When would you
use each?
6.
7.
o Explain the use of manifest files (deprecated) and modern techniques like Service
Workers and IndexedDB.
9.
10.
o Discuss semantic tags, ARIA roles, and microdata for structured content.
11.
What is the purpose of the srcset attribute in the <img> tag? How does it
improve performance?
12.
13.
14.
o Example of creating editable regions in web pages and its use in CMS.
15.
16.
17.
Explain how the Geolocation API works in HTML5. What are the key
methods?
18.
19.
What is the difference between localStorage and IndexedDB? When
would you use each?
20.
o Compare their use cases for simple key-value pairs vs. complex structured data.
Scenario-Based Questions:
1.
How would you create a custom modal component using HTML5 and
CSS3 without JavaScript?
2.
o Expect to explain the use of <dialog> and CSS features like :target.
3.
Describe how you would use HTML5 to build a progressive web app
(PWA).
4.
5.
6.
7.
What challenges might you face when using the <iframe> element in
modern web development?
8.
9.
How would you optimize the rendering of a complex HTML5 web page?
10.
o Topics to cover: lazy loading, responsive design, efficient use of <script> tags
with defer/async, and performance audits.
1.
2.
3.
4.
o Explain how to use the <template> element and populate it with JavaScript.
5.
6.
7.
8.
9.
10.
4o
You said:
more
ChatGPT said:
ChatGPT
Conceptual Questions:
1.
2.
3.
4.
5.
6.
7.
o Describe real-time communication, low latency, and examples like chat apps.
9.
10.
1.
2.
3.
What are HTML5 custom elements? How do you define and use them?
4.
5.
6.
7.
What is the Fetch API, and how does it improve over XHR in HTML5?
How does lazy loading work for images and iframes in HTML5?
What are critical rendering paths, and how can you optimize them in
HTML5?
o Cover how HTML, CSS, and JavaScript are parsed and how to minimize render-
blocking.
o Discuss caching strategies like cache-first, network-first, and their role in PWAs.
How would you optimize a large HTML5 table for better performance?
o Cover Cross-Site Scripting (XSS), Content Security Policy (CSP), and sandboxing.
o How servers deliver content based on the Accept header and browser
preferences.
How would you implement a real-time data update using HTML5 APIs?
o Combine HTML5 lazy loading, Intersection Observer API, and event listeners.
How would you debug rendering issues caused by HTML5 semantic tags?
o Profile with browser dev tools, optimize DOM rendering, and reduce HTTP requests.