Choose the correct statement of HTML
A. In traditional XHTML close tag for some elements is optional but not encouraged
B. In traditional HTML close tag for some elements is optional but not encouraged
C. None of the mentioned
D. In both traditional XHTML and HTML close tag for some elements is optional
Answer: Option B
Solution (By Examveda Team)
Option B is the correct answer.In traditional HTML, the closing tag for certain elements is optional according to the HTML specification. For example, elements such as <li>, <p>, <tr>, and <td> may omit their closing tags because browsers can infer where the element ends. However, omitting closing tags is generally not encouraged since explicitly closing elements improves code readability, maintainability, and compatibility.
Why Option A is incorrect:
In XHTML, every element must be properly closed because XHTML is based on XML. Omitting a closing tag results in an invalid XHTML document. Therefore, it is incorrect to say that closing tags are optional in traditional XHTML.
Why Option C is incorrect:
Option C states "None of the mentioned". This is incorrect because Option B correctly describes the behavior of traditional HTML regarding optional closing tags.
Why Option D is incorrect:
Option D claims that closing tags are optional in both HTML and XHTML. This is false because only HTML allows certain closing tags to be omitted. XHTML follows strict XML syntax, which requires every element to have a corresponding closing tag or to be written as a self-closing element where appropriate.
Therefore, Option B is the correct answer because traditional HTML permits omission of closing tags for some elements, whereas XHTML requires all elements to be properly closed.

It can be D