Sample questions
Question 1Medium
How many kinds of cells are present in the table?
- 1
- 2
- 3
- 4
Answer: B. 2
Explanation
There are two types of cells are present in the table:-
1>header cell 2> data cell.
Step-by-step solution
- A table has header cells, made with th, and data cells, made with td.
- Standard HTML has no other kind of table cell.
- So there are 2 kinds of cells, and the correct answer 1 (2) is right.
Why the other options are wrong
- A. 1 is wrong, because header cells and data cells are two kinds.
- C. 3 kinds do not exist; the only two are header and data cells.
- D. 4 kinds do not exist in standard HTML tables.
Tip: Th is for headings and td is for data. Those are the two cell types.
Question 2Medium
Which tag is used to align table caption to the top?
- < caption align="top">
- < caption="top">
- < caption place="top">
- None of these.
Answer: A. < caption align="top">
Explanation
The caption is located at the top of the table.
< caption align="top">Latest news</caption>
Step-by-step solution
- The caption tag gives the title of a table.
- The align attribute with the value top places the caption above the table.
- So the correct answer 0, caption with align='top', is right.
Why the other options are wrong
- B. Caption is not an attribute name, so this is not valid.
- C. Place is not a valid attribute; the correct attribute is align.
- D. Option A is valid, so none of these is wrong.
Tip: Caption align can be top or bottom. Use align on caption, not a made-up attribute.
Question 3Medium
Which Specifies the number of columns to be spanned by this cell.
- Rowspan
- Colspan
- Tablespan
- None of these
Answer: B. Colspan
Explanation
colspan Specifies the number of columns to be spanned by this cell. The default value is "1".
Step-by-step solution
- Colspan is an attribute used in HTML tables.
- It defines how many columns a single cell should span across.
- The default value for colspan is 1 if not specified.
- This directly answers the question about spanning columns.
- Therefore, the correct answer is Colspan.
Why the other options are wrong
- A. Rowspan spans rows down, not columns, so it answers a different question.
- C. Tablespan is not a valid HTML attribute; the column-spanning one is colspan.
- D. None of these is wrong, because Colspan is the correct attribute.
Tip: Remember: colspan merges cells across columns, rowspan merges them down rows.
Question 4Medium
Which tag is used to define table?
- <table>
- <tab>
- <t>
- None of these
Answer: A. <table>
Explanation
<table> tag is used to define table.
Step-by-step solution
- The HTML tag for a table is <table>.
- <tab> and <t> are not HTML tags.
Why the other options are wrong
- B. <tab> is not an HTML tag.
- C. <t> is not an HTML tag.
- D. <table> is a valid tag, so 'None of these' is wrong.
Tip: The table tag is paired with a closing </table> tag.
Question 5Medium
How to set table width in percentage?
- < table width="50%">
- < width="50%">
- < table="50%">
- None of these.
Answer: A. < table width="50%">
Explanation
< table width="50%"> will set table width to 50% of its original width.
Step-by-step solution
- The width attribute goes on the table tag.
- A percentage width is relative to the space available.
- So the answer is table width 50%, option A.
Why the other options are wrong
- B. No table tag is given, so the browser does not know which element to size.
- C. Table is used as an attribute name here, and width is missing.
- D. Option A is correct, so None of these is wrong.
Tip: Set width on the table tag, with a percent or pixel value.
Question 6Medium
How to show right and left outside borders?
- < table frame="hside">
- < table frame="above">
- < table frame="below">
- < table frame="vsides">
Answer: D. < table frame="vsides">
Explanation
The left and right outside borders are shown.
e.g.
< TABLE BORDER=8 FRAME=VSIDES RULES=NONE>
Step-by-step solution
- The frame attribute of a table controls which outside borders are drawn.
- Vsides draws the left and right outside borders.
- So frame='vsides' (option D) is the correct answer.
Why the other options are wrong
- A. Hside is not a valid value; hsides draws only the top and bottom borders.
- B. Above draws only the top border.
- C. Below draws only the bottom border.
Tip: Frame values: void, above, below, hsides, vsides, lhs, rhs and box. vsides means the vertical sides.
Question 7Medium
Which table attribute defines the pixel space between cells?
- Cell padding
- Cell spacing
- Width
- Border
Answer: B. Cell spacing
Explanation
Cell spacing defines the pixel space between table cells.
Step-by-step solution
- Cell spacing sets the gap between table cells in pixels.
- It controls the empty space outside each cell but inside the table.
- This attribute directly defines the pixel space between cells.
- Other attributes like border or padding affect different parts of the cell.
- The correct answer is Cell spacing.
Why the other options are wrong
- A. Cell padding sets the space inside each cell, between its border and content, not between cells.
- C. Width sets the size of the table or column, not the gap between cells.
- D. Border sets the outline of the table, not the space between cells.
Tip: Remember: Cell spacing controls the space between cells, not inside them.
Question 8Medium
How to show top and bottom outside borders?
- < table frame="box">
- < table frame="above">
- < table frame="below">
- < table frame="hsides">
Answer: D. < table frame="hsides">
Explanation
The top and bottom outside borders are shown.
e.g.
< TABLE BORDER=8 FRAME=HSIDES RULES=NONE>
Step-by-step solution
- The frame attribute on a table sets which outside borders show.
- The value hsides shows the top and bottom borders only.
- Box shows all four sides, above shows only the top, and below shows only the bottom.
- So the correct answer is option D, hsides.
Why the other options are wrong
- A. Box shows all four outside borders, not only top and bottom.
- B. Above shows only the top border.
- C. Below shows only the bottom border.
Tip: Frame values: void none, above top, below bottom, hsides top and bottom, vsides left and right, box all four.
Question 9Medium
How to set frame only to the top of table?
- < table frame="box">
- < table frame="above">
- < table frame="below">
- < table frame="vsides">
Answer: B. < table frame="above">
Explanation
The option 'above' specifies that the frame should be applied only to the top of the table, which matches the requirement of the question.
Step-by-step solution
- Frame attribute sets borders around tables.
- The 'above' value adds a border only to the top.
- Other options add borders to different sides or all sides.
- So, < table frame="above"> is correct.
Why the other options are wrong
- A. This adds a box border around all sides of the table.
- C. This adds a border only to the bottom of the table.
- D. This adds borders to left and right sides only.
Tip: Use frame="above" for top border only.
Question 10Medium
How to show right hand side border?
- < table frame="above">
- < table frame="below">
- < table frame="vsides">
- < table frame="rhs">
Answer: D. < table frame="rhs">
Explanation
The right outside border is shown.
< TABLE BORDER=8 FRAME=RHS RULES=NONE>
Step-by-step solution
- The frame attribute controls which outside borders a table shows.
- frame="rhs" shows only the right-hand side border.
- frame="above" shows only the top and frame="below" only the bottom border.
- So frame="rhs" is the correct answer.
Why the other options are wrong
- A. Above draws only the top border.
- B. Below draws only the bottom border.
- C. Vsides draws both the left and right borders, not only the right one.
Tip: HTML table frame values: void, above, below, hsides, lhs, rhs, vsides, box, border.
Practise all 34 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →