Tables: <tr> MCQs Quiz | Class 10

This quiz tests your knowledge of the <tr> tag in HTML, which is fundamental for creating table rows. This quiz is for Class X Computer Applications (Code 165), Unit 2: HTML, specifically focusing on the topic ‘Tables: <tr> MCQs Quiz | Class 10’ and covering aspects related to the table row element. Answer the 10 questions below and then click ‘Submit Quiz’ to see your results. You can also download a PDF of your answers.

Understanding the <tr> Tag in HTML Tables

The <tr> tag, short for “table row”, is a fundamental element in HTML used to structure data into rows within a table. It acts as a container for table data cells (<td>) or table header cells (<th>), effectively defining a horizontal line of content in a table.

Key Concepts of the <tr> Tag:

  • Purpose: The primary role of <tr> is to create a new row within an HTML table. Every row in a table must be defined using this tag.
  • Parent Elements: A <tr> tag must always be placed inside a <table> element, or within table sectioning elements like <thead> (table header), <tbody> (table body), or <tfoot> (table footer).
  • Child Elements: The direct children of a <tr> tag can only be <td> (table data) or <th> (table header) elements. These cells define the content for each column within that specific row.
  • Structure: A typical table structure involves a <table> tag, containing one or more <tr> tags, each of which contains one or more <td> or <th> tags.
  • Styling: While older HTML versions supported attributes like align and valign on <tr> for horizontal and vertical alignment, these are now deprecated. Modern web development practices dictate using CSS for all styling, including row-specific alignment, padding, and background colors.

Example of <tr> Usage:

Here’s a simple HTML table demonstrating the use of <tr> along with <th> and <td>:

<table border="1">
  <thead>
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Row 1, Cell 1</td>
      <td>Row 1, Cell 2</td>
    </tr>
    <tr>
      <td>Row 2, Cell 1</td>
      <td>Row 2, Cell 2</td>
    </tr>
  </tbody>
</table>

Quick Revision Points:

  • <tr> defines a table row.
  • It is a direct child of <table>, <thead>, <tbody>, or <tfoot>.
  • Its children are <td> (table data) or <th> (table header).
  • It helps organize data horizontally in a tabular format.
  • Styling should be done using CSS, not deprecated HTML attributes.

Practice Questions:

  1. What is the full form of `` in HTML?
  2. Name two elements that can be direct children of a `` tag.
  3. If you want to add a new row to an existing table, which tag would you use?
  4. Explain why you should avoid using `align` or `valign` attributes directly on the `` tag.
  5. In the context of HTML tables, what is the hierarchical relationship between ``, ``, and `
    `?

    Author

    • CBSE Quiz Editorial Team

      Content created and reviewed by the CBSE Quiz Editorial Team based on the latest NCERT textbooks and CBSE syllabus. Our goal is to help students practice concepts clearly, confidently, and exam-ready through well-structured MCQs and revision content.