HTML Tables: 19 MCQs with answers
All 19 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 8 questions
Q1. Which HTML element is used to define a table row?
BeginnerShow answer & explanation
<tr>
The element defines a table row; defines a data cell, a header cell, and the table itself.
Q2. Which element is used to define a table header cell?
BeginnerShow answer & explanation
<th>
defines a header cell, which is typically bold and centered by default.
Q3. What is the purpose of the <caption> element in a table?
BeginnerShow answer & explanation
To provide a title or description for the table
The element provides a title or description for the table, improving accessibility and context.
Q4. What is the default border value for an HTML table if no border attribute is specified?
BeginnerShow answer & explanation
0
By default, tables have no border; you must add the border attribute or CSS to show borders.
Q5. Which attribute is used to define the number of columns a table should have?
BeginnerShow answer & explanation
None; columns are defined by cells in rows
HTML tables do not have a 'cols' attribute; columns are implicitly defined by the number of cells in each row.
Q6. What is the correct HTML for adding a caption to a table?
BeginnerShow answer & explanation
<caption>Monthly Sales</caption>
The element is placed directly inside the element to provide a title.
Q7. Which element is used to define a data cell in a table?
BeginnerShow answer & explanation
<td>
stands for table data and is used for standard cells containing data.
Q8. What is the default alignment of text in a <th> element?
BeginnerShow answer & explanation
Center
By default, text is centered and bold, unlike which is left-aligned by default.
Building up · 9 questions
Q9. Which attribute is used to merge two or more columns in a table cell?
IntermediateShow answer & explanation
colspan
The colspan attribute specifies how many columns a cell should span horizontally.
Q10. Which attribute is used to merge two or more rows in a table cell?
IntermediateShow answer & explanation
rowspan
The rowspan attribute specifies how many rows a cell should span vertically.
Q11. Which element is used to group the body content of a table?
IntermediateShow answer & explanation
<tbody>
groups the main data rows of a table, helping with structure and styling.
Q12. Which element is used to group the header content of a table?
IntermediateShow answer & explanation
<thead>
is used to group the header rows of a table, typically containing elements.
Q13. Which element is used to group the footer content of a table?
IntermediateShow answer & explanation
<tfoot>
groups the footer rows of a table, often used for summaries or totals.
Q14. What is the purpose of the scope attribute on a <th> element?
IntermediateShow answer & explanation
To associate a header cell with a row or column
The scope attribute indicates whether a header cell applies to a row (scope="row") or column (scope="col"), improving accessibility.
Q15. Which of the following is a best practice for creating accessible tables?
IntermediateShow answer & explanation
Using <th> with scope attributes for header cells
Using with scope attributes helps screen readers understand the table structure, making it accessible.
Q16. The <tfoot> element must appear after all <tr> elements in the table.
IntermediateShow answer & explanation
False
In HTML5, can appear before or after , but it must be after and can be before or after ; it is not required to be at the end.
Q17. The border attribute is deprecated in HTML5 for tables.
IntermediateShow answer & explanation
True
The border attribute is deprecated in HTML5; CSS is recommended for styling borders.
Topper level · 2 questions
Q18. Which attribute was used in older HTML to specify the space between cell borders?
AdvancedShow answer & explanation
cellspacing
The cellspacing attribute (deprecated in HTML5) controlled the space between cells; CSS border-spacing is now preferred.
Q19. Which attribute was used in older HTML to specify the space inside a cell between the content and the cell border?
AdvancedShow answer & explanation
cellpadding
The cellpadding attribute (deprecated in HTML5) controlled the space inside cells; CSS padding is now preferred.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages