How do you write a comment in HTML?
A
// This is a comment B
<!-- This is a comment --> C
# This is a comment D
<comment>This is a comment</comment>
Analysis & Theory
HTML comments are written using `<!-- comment -->` syntax.
What happens to HTML comments in the browser?
A
They are displayed as text B
They are ignored and not displayed C
They cause an error D
They show up as a tooltip
Analysis & Theory
HTML comments are not displayed in the browser—they are ignored during rendering.
Can comments be used to hide parts of HTML code?
A
Yes B
No C
Only in HTML5 D
Only with JavaScript
Analysis & Theory
Yes, you can comment out parts of the HTML code to hide them from the browser.
Which of the following is a valid HTML comment?
A
<!-- Hide this --> B
// Hide this C
/* Hide this */ D
<! This is hidden >
Analysis & Theory
`<!-- comment -->` is the correct way to write HTML comments.
What is a common use of HTML comments?
A
To style text B
To add scripts C
To describe code or temporarily disable elements D
To improve performance
Analysis & Theory
Comments are used to explain code or disable specific parts during testing.
Is it possible to comment inside a tag, like `<p <!-- comment --> >`?
A
Yes, always B
Only with style tags C
No, it's invalid HTML D
Only in Internet Explorer
Analysis & Theory
Placing comments inside a tag is invalid and can break your HTML.
Can HTML comments span multiple lines?
A
No B
Yes, using `<!--` and `-->` around all lines C
Only in JavaScript D
Only with special editors
Analysis & Theory
HTML comments can span multiple lines by enclosing all lines within `<!--` and `-->`.
Which of the following will comment out a block of HTML code?
A
<!-- <h1>Hello</h1> --> B
// <h1>Hello</h1> C
/* <h1>Hello</h1> */ D
<comment><h1>Hello</h1></comment>
Analysis & Theory
To comment out HTML elements, use `<!--` before and `-->` after the block.
Are HTML comments visible in the page source?
A
No B
Only in old browsers C
Yes, always D
Only with JavaScript
Analysis & Theory
HTML comments are visible in the browser's page source (view source).
Which of the following is NOT true about HTML comments?
A
They are not rendered on the page B
They help document the code C
They increase loading time significantly D
They can hide code temporarily
Analysis & Theory
HTML comments do not significantly impact page load time unless excessively overused.