MCQs on Tables for Structured Data | HTML

Master the essentials of HTML tables with this set of 30 multiple-choice questions (MCQs). Covering topics like creating tables, using table rows and cells, and merging cells with colspan and rowspan, this quiz will enhance your knowledge on structured data presentation.


MCQs:

Creating Tables (<table>)

  1. Which HTML element is used to create a table?
    • a) <list>
    • b) <table>
    • c) <tab>
    • d) <grid>
  2. To specify the width of a table, which attribute is used?
    • a) width
    • b) table-width
    • c) size
    • d) col-width
  3. How do you define the border of a table in HTML?
    • a) <table border=”1″>
    • b) <table style=”border: 1px”>
    • c) <table width=”1″>
    • d) <table border-style=”solid”>
  4. Which attribute is used to set the background color of a table?
    • a) bgcolor
    • b) background
    • c) color
    • d) style
  5. Which of the following defines the spacing between the cells in a table?
    • a) cellspacing
    • b) cellpadding
    • c) margin
    • d) padding
  6. How can you add a caption to a table?
    • a) <caption>Table Caption</caption>
    • b) <table caption=”Table Caption”>
    • c) <table><caption>Table Caption</caption></table>
    • d) <caption=”Table Caption”>
  7. What is the default border style of a table in HTML?
    • a) None
    • b) Solid
    • c) Dashed
    • d) Dotted
  8. How do you define a table row?
    • a) <row>
    • b) <tr>
    • c) <td>
    • d) <th>
  9. Which tag is used to define a table header cell?
    • a) <tr>
    • b) <th>
    • c) <td>
    • d) <head>
  10. Which tag is used to define a table data cell?
    • a) <td>
    • b) <th>
    • c) <tr>
    • d) <div>

Table Rows (<tr>), Data Cells (<td>), and Headers (<th>)

  1. What is the default alignment of text in a table header cell ()?
    • a) Left
    • b) Center
    • c) Right
    • d) Justify
  2. To add a table row, which tag is used?
    • a) <tr>
    • b) <td>
    • c) <table>
    • d) <row>
  3. Which of the following tags is used to group header content in a table?
    • a) <thead>
    • b) <tfoot>
    • c) <tbody>
    • d) <th>
  4. Which tag should be used for the footer section of a table?
    • a) <tfoot>
    • b) <tbody>
    • c) <thead>
    • d) <foot>
  5. If you want to make the text of a table header bold, what tag should you use?
    • a) <strong>
    • b) <b>
    • c) <th>
    • d) <em>
  6. What is the correct way to specify text alignment in a table cell?
    • a) <td align=”center”>
    • b) <td style=”align:center;”>
    • c) <td style=”text-align:center;”>
    • d) <td style=”alignment:center;”>
  7. Which tag is used to group the body of a table?
    • a) <tbody>
    • b) <tfoot>
    • c) <thead>
    • d) <tr>
  8. Which of the following defines a header row in a table?
    • a) <tr>
    • b) <th>
    • c) <thead>
    • d) <td>
  9. How do you align the text to the right in a table data cell ()?
    • a) <td align=”right”>
    • b) <td style=”text-align:right;”>
    • c) <td align=”end”>
    • d) <td right>
  10. Can a table have multiple headers?
    • a) Yes
    • b) No
    • c) Only one header is allowed
    • d) Depends on the browser

Merging Cells (colspan and rowspan)

  1. What does the colspan attribute do in a table?
    • a) Merges cells vertically
    • b) Merges cells horizontally
    • c) Defines the width of a cell
    • d) Defines the height of a cell
  2. Which of the following is used to merge cells vertically in a table?
    • a) colspan
    • b) rowspan
    • c) cell-merge
    • d) cellspan
  3. How do you specify that a table cell should span 3 columns?
    • a) <td colspan=”3″>
    • b) <td rowspan=”3″>
    • c) <td span=”3″>
    • d) <td width=”3″>
  4. How do you merge two rows in a table?
    • a) Use colspan
    • b) Use rowspan
    • c) Use both colspan and rowspan
    • d) Use merge attribute
  5. What is the default value of the colspan attribute?
    • a) 1
    • b) 0
    • c) 2
    • d) Undefined
  6. What happens if you set rowspan="2" in a table cell?
    • a) The cell will span two columns
    • b) The cell will span two rows
    • c) The table will have two rows merged
    • d) The table will have two columns merged
  7. Which attribute is used to merge table cells horizontally?
    • a) rowspan
    • b) colspan
    • c) merge
    • d) span
  8. If you merge cells using colspan="4", how many columns will the cell span?
    • a) 4
    • b) 3
    • c) 5
    • d) 1
  9. What will happen if colspan="2" is used in a table with more than 2 columns?
    • a) It will merge only 2 cells in the first row
    • b) It will merge the first 2 rows
    • c) The next cell will be blank
    • d) It will merge all cells
  10. Which of the following can be combined in the same table cell?
    • a) colspan and rowspan
    • b) only rowspan
    • c) only colspan
    • d) none of the above

Answer Table:

QnoAnswer (Option with the text)
1b) <table>
2a) width
3a) <table border=”1″>
4a) bgcolor
5a) cellspacing
6c) <table><caption>Table Caption</caption></table>
7a) None
8b) <tr>
9b) <th>
10a) <td>
11b) Center
12a) <tr>
13a) <thead>
14a) <tfoot>
15c) <th>
16c) <td style=”text-align:center;”>
17a) <tbody>
18b) <th>
19b) <td style=”text-align:right;”>
20a) Yes
21b) Merges cells horizontally
22b) rowspan
23a) <td colspan=”3″>
24b) Use rowspan
25a) 1
26b) The cell will span two rows
27b) colspan
28a) 4
29c) The next cell will be blank
30a) colspan and rowspan

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top