HTML Tables MCQs
HTML Tables MCQs : This section focuses on "table" in Html. These Multiple Choice Questions (mcq) should be practiced to improve the Html skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which HTML tag is used to define a table?
A. <tb>
B. <tl>
C. <table>
D. <tab>
View Answer
Ans : C
Explanation: Contents written between <table> and <table> are organised in the form of table with the help of <tr>,<th> or <td> tags.
2. With the help of which tag, is a row defined in HTML?
A. <row>
B. <table-row>
C. <tablerow>
D. <tr>
View Answer
Ans : D
Explanation: Row in a table is defined using <tr>. The content written between <tr> and </tr> is considered to be in single row.
3. Choose the correct option.
A. <th> is used for defining the heading of a table.
B. By default, contents written between <th> and </th> are bold and centered.
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: <th> is used for table header and it is by default bold and centered.
4. By using which of the following options, the border of table can be collapsed?
A. border-collapse:collapse
B. table-border:collapse
C. border:collapse
D. table-border-collapse:collapse
View Answer
Ans : A
Explanation: In order to collapse the border of a table, border-collapse: collapse; can be used inside <style> tag.
5. Fill in the blanks with the help of options given below in order to get the following table when the below code is executed.
<!DOCTYPE html>
<html>
<body>
<table border="2">
<tr>
<th>Name</th>
<th>Phone no</th>
</tr>
<tr>
<td ______________>John</td>
<td>9898989898</td>
</tr>
<tr>
<td>9876543210</td>
</tr>
</body>
</html>
Name Phone no
John 9898989898
9876543210
A. colspan= "1"
B. colspan= "2"
C. rowspan= "1"
D. rowspan= "2"
View Answer
Ans : D
Explanation: rowspan is used to merge two or more rows into one. Since here rowspan=2, so it will merge two rows into one.
6. In order to add space of 20px between cell content and its border of a table in html, which one of the following option is appropriate?
A. th,td{ padding: 20px;}
B. table{ margin:20px; }
C. table{ border : 20px;}
D. table{ padding: 20px; }
View Answer
Ans : A
Explanation: In order to add space between contents and its border, we use padding.
7. Which one of the following tags is used to add caption to a table?
A. <table-caption>
B. <tcaption>
C. <caption>
D. <tc>
View Answer
Ans : C
Explanation: <caption> adds caption to a table.
8. Which one of the following can be used to define the spacing between the cells of a table?
A. border-spacing
B. spacing
C. cell-spacing
D. table-spacing
View Answer
Ans : A
Explanation: By setting the value of border-spacing, we can adjust the spacing between the cells of a table.
9. By default, the content written between
and | are placed at center. How can it be put at left side of the cell of the table?
A. th{ align: left; }
B. th{ text-align: left; }
C. th { font-align:center; }
D. It cannot be done.
View Answer
Ans : B
Explanation: text-align is used to set the alignment of the text.
10. Fill in the blanks with the help of options given below in order to get the following table when the below code is executed.
<!DOCTYPE html>
<html>
<body>
<table border="2">
<tr>
<th>Name</th>
<th ____________>Phone no</th>
</tr>
<tr>
<td>John</td>
<td>9898989898</td>
<td>9876543210</td>
</tr>
</body>
</html>
Name Phone no
John 9898989898 9876543210
A. colspan= "1"
B. colspan= "2"
C. rowspan= "2"
D. rowspan= "2"
View Answer
Ans : B
Explanation: colspan is used to merge two or more columns into one. Since, here colspan=2, so it will merge two columns into one.
Also check :
Discussion