This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Working with Tables”.
1. Each cell of the table can be represented by using __________
a) <tr>
b) <td>
c) <th>
d) <thead>
View Answer
Explanation: td stands for table data, we can represent each cell of the table by using <td>, at the end we used </td> tag. But some browsers by default draw the lines around table. <tr> is used to indicate start of every row i.e. it stands for table row. The header information is present in <th> tag. <thead> tag contains the group of header.
2. For heading we can use ____________
a) <td>
b) <tr>
c) <thead>
d) <th>
View Answer
Explanation: <th> element is used for representing heading of column or a row. It works same as <td> element. If shell has no content we can use <th> element also there. We can use scope attribute for specifying the heading is for row or column. Usually content of <th> is represented in bold. <thead> tag contains the group of header. <tr> is used to indicate start of every row i.e. it stands for table row.
3. Headings of table lies inside ___________
a) <thead>
b) <tfoot>
c) <th>
d) <tbody>
View Answer
Explanation: Headings of the table lies inside <thead> element. Footer lies inside the <tfoot> element. The body of the table lies inside <tbody> element. <th> is used for giving heading to a row or a column. Every element must have closing tag also i.e. </thead>, </tfoot>, </tbody>
4. Which of the following is not the element associated with HTML table layout?
a) size
b) spanning
c) alignment
d) color
View Answer
Explanation: There are three elements in HTML table layout i.e. size, spanning and alignment. Layout type can be achieved by setting Rows elements layout attribute to Fixed or Auto. Auto attribute relies on browser compatibility whereas fixed layout relies on developer specification.
5. Which of the following element is not associated with a class attribute?
a) Row
b) <thead>
c) Column cell
d) Rows
View Answer
Explanation: Column cell, Row, and Rows are the container elements. They have a class attribute with the help of this we can apply special styling. Table alignment is also controlled style sheet classes. Text-align and vertical-align are the style attributes that align the content of the table.
6. For adding caption to the table we use ____________
a) <caption>
b) <thead>
c) <th>
d) <tr>
View Answer
Explanation: For adding caption to the table we use <caption> tag. It should be used just below the <table> tag.
Syntax is <table> <caption> Savings </caption> <tr> <th> saving </th><th>loss</th> </tr> <tr><td>$12</td>$45<td></td> </tr> </table>.
<thead> tag contains the group of header. <tr> is used to indicate start of every row i.e. it stands for table row. The header information is present in <th> tag.
7. border-spacing is given in _____________
a) pixels
b) cm
c) mm
d) inch
View Answer
Explanation: border-spacing and border-collapse are the two properties by which one can set the border and its styling in a table. We give its value in pixels.
table { border-collapse: collapse; border-spacing: 14px } th, td{ border: 12 px solid red; padding: 20px 13px; }
8. Borders can’t be applied on ________________
a) <th>
b) <td>
c) <tr>
d) <thead>
View Answer
Explanation: Borders can’t be applied on <tr> elements. It can’t be applied on table structural elements. For setting borders with <tr> element, border-collapse property should be set to collapse.
Syntax is table {border-collapse: collapse;} th, td{border-bottom: 2px dotted red; } tfoot tr:last-child td{border-bottom: 9 px;}
9. Which attribute defines numbers of columns in a group?
a) width=multi-length[CN].
b) span=number[CN].
c) scope=scope-name[CN].
d) headers=idrefs[CS].
View Answer
Explanation: span=number[CN] attribute’s value must be an integer and greater than 0. It specifies the number of columns in a group. When span attribute is not in use, colgroup defines a single column group containing one column. width=multi-length[CN] specifies default width of for every column. scope=scope-name[CN] specifies set of data cells for which going header cell gives header information. The headers=idrefs[CN] provides list of header cells that gives header information.
10. Which of the following does not specify a column width?
a) Fixed
b) Percentage
c) Proportional
d) Pixels
View Answer
Explanation: We can specify column width in three ways i.e. Percentage, Fixed, Proportional. Fixed width is given in pixels. Percentage specification is the percentage of horizontal space availability in the table. The proportional specification is the portions of fixed horizontal space required for the table.
11. Scope attribute can’t have the value __________
a) row
b) rowgroup
c) col
d) <head>
View Answer
Explanation: scope attribute defines a set of data cell. It is used in place of headers. This attribute can have one of the value among rowgroup, row, colgroup, col, rowgroup, and colgroup provides information of header cell of the corresponding row and column groups.
12. Which of the following is not the value for frame attribute?
a) above
b) void
c) none
d) box
View Answer
Explanation: Frame attribute gives information about which sides of the frame surrounding that table will be visible. The values that this attribute can take are lhs, rhs, box, border, vsides, hsides, below, above, void.
13. Which of the following is not the value for rules attribute?
a) vsides
b) rows
c) all
d) groups
View Answer
Explanation: The rules which will appear between cells of the table is specified by this attribute. It can take the values groups, none, rows, all and cols. None is the default value, rows are for appearance between rows only and cols is for columns only.
14. Which of the following is not the value for align attribute?
a) justify
b) char
c) middle
d) left
View Answer
Explanation: align attribute is the alignment of data and for justification of text in the cell. It can take the values left, right, justify, center, char. Justify is for double justifying the text, char is for aligning text around a particular character.
15. valign attribute does not take the value __________________
a) justify
b) middle
c) baseline
d) bottom
View Answer
Explanation: valign attribute is for specifying the vertical position of the data in a cell. It can take the values middle, top, baseline, bottom, Top is for the top of the cell’s data, middle is for the centered data, bottom is for the bottom of the cell, first text line occurs on the baseline which is common to all the cells.
Sanfoundry Global Education & Learning Series – HTML.
To practice all areas of HTML, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Practice Information Science MCQs
- Apply for Computer Science Internship
- Check Computer Science Books
- Practice MCA MCQs
- Practice Computer Science MCQs