Top Interview HTML Questions For Capgemini

Top Basic HTML Interview Questions and Answers for Capgemini

 

Introduction

Preparing for an HTML interview at Capgemini? HTML (HyperText Markup Language) is the backbone of web development, defining the structure and layout of web pages. Capgemini assesses candidates on HTML fundamentals, semantic elements, forms, multimedia, accessibility, and best practices.

This blog compiles the most frequently asked HTML interview questions in Capgemini interviews, covering essential topics for freshers and experienced professionals.

Comprehensive list of basic and advanced questions
Practical examples and explanations
Helpful for technical interviews at Capgemini

📌 Save this page and revise these important HTML interview questions before your Capgemini interview! 🚀


Top Basic HTML Interview Questions and Answers

1. What is HTML?

Answer: HTML (HyperText Markup Language) is the standard language used to create web pages. It structures web content using elements like headings, paragraphs, images, links, tables, and forms.


2. What are the different types of HTML elements?

Answer:

  • Block-level elements – Take up the full width (e.g., <div>, <p>, <h1>).
  • Inline elements – Occupy only the space required (e.g., <span>, <a>, <b>).
  • Self-closing elements – Do not require a closing tag (e.g., <img>, <input>, <br>).

3. What is the difference between HTML and HTML5?

Answer:

FeatureHTMLHTML5
Multimedia SupportLimitedSupports <audio> and <video>
Semantic ElementsNot well-definedIntroduces <article>, <section>, <nav>
Form EnhancementsBasic form fieldsNew input types like email, date, range
GraphicsUses external pluginsSupports <canvas> and <svg>

4. What are semantic elements in HTML?

Answer: Semantic elements give meaning to the content. Examples include:

  • <header> – Represents the top section of a webpage.
  • <nav> – Defines navigation links.
  • <section> – Groups related content.
  • <article> – Represents independent content.
  • <footer> – Defines the bottom section of a webpage.

5. What is the difference between id and class attributes in HTML?

Answer:

Featureidclass
UniquenessUnique for each elementCan be used on multiple elements
UsageIdentifies a single elementGroups similar elements
Example<div id="header"><div class="content">

6. What is the difference between <div> and <span>?

Answer:

ElementDescription
<div>A block-level container used for layout
<span>An inline element used for styling small text portions

Example:

<div style="background: lightgray;">Block Element</div>  
<span style="color: red;">Inline Element</span>

7. What are the different types of lists in HTML?

Answer:

  • Ordered List (<ol>) – Numbered list.
    <ol>
        <li>Item 1</li>
        <li>Item 2</li>
    </ol>
    
  • Unordered List (<ul>) – Bullet points.
    <ul>
        <li>Item A</li>
        <li>Item B</li>
    </ul>
    
  • Definition List (<dl>) – Terms and definitions.
    <dl>
        <dt>HTML</dt>
        <dd>HyperText Markup Language</dd>
    </dl>
    

8. What is the difference between <thead>, <tbody>, and <tfoot> in an HTML table?

Answer:

TagDescription
<thead>Groups the header content of a table
<tbody>Contains the main content of the table
<tfoot>Represents the footer section of a table

Example:

<table>
    <thead>
        <tr><th>Name</th><th>Age</th></tr>
    </thead>
    <tbody>
        <tr><td>Alice</td><td>25</td></tr>
    </tbody>
    <tfoot>
        <tr><td colspan="2">Footer</td></tr>
    </tfoot>
</table>

9. What is the purpose of the <meta> tag in HTML?

Answer: The <meta> tag provides metadata about a webpage.

Example:

<meta name="description" content="HTML interview questions for Capgemini">
<meta name="keywords" content="HTML, interview, Capgemini">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

10. What is an HTML iframe?

Answer: An <iframe> embeds another webpage within a webpage.

Example:

<iframe src="https://www.example.com" width="600" height="400"></iframe>

11. What are HTML forms, and what elements do they contain?

Answer: HTML forms allow user input. Common elements include:

  • <input> – User input field
  • <textarea> – Multi-line text field
  • <select> – Dropdown list
  • <button> – Submit button

Example:

<form action="/submit" method="POST">
    <input type="text" name="name" placeholder="Enter name">
    <button type="submit">Submit</button>
</form>

12. What are new input types introduced in HTML5?

Answer:

  • email – Validates email input
  • url – Validates URLs
  • number – Accepts numeric input
  • date – Displays a date picker
  • range – Creates a slider

Example:

<input type="email" placeholder="Enter your email">
<input type="date">

13. What is the purpose of the alt attribute in images?

Answer: The alt attribute provides alternative text for images, improving accessibility and SEO.

Example:

<img src="logo.png" alt="Company Logo">

14. What is the difference between absolute, relative, and root-relative URLs?

Answer:

URL TypeExampleDescription
Absolutehttps://example.com/page.htmlComplete URL including domain
Relativepage.htmlRelative to the current page
Root-relative/folder/page.htmlStarts from the website root

15. What is the download attribute in the <a> tag?

Answer: It allows users to download a file instead of opening it.

Example:

<a href="file.pdf" download>Download PDF</a>

This list of HTML interview questions for Capgemini covers fundamental and advanced topics to help you prepare effectively. 🚀

Leave a Reply

Your email address will not be published. Required fields are marked *