Are you ready?
9 questions to solve
Instructions
- This quiz goes to full-screen once you press the Start button.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
What is the problem in the following HTML code?
<p>1 < 10</p>
In the code above, the
<
character is not escaped using an HTML entity. This is desirable since <
has a special meaning in HTML — it's used to denote the start of an HTML tag. So, we should rather use <
. Hence, the correct choice is (C). For more info, refer to HTML Entities.Bob is new to HTML. His friend asked him to write a paragraph in HTML, reading the text 'The <pre> element is useful!'.
Bob writes the following HTML for the paragraph:
<p>The <pre> element is useful!</p>
Is his code correct?
Nope, Bob's code is incorrect. That's because he has literally expressed the given text in the source even though it contains the special characters
<
and >
. The part reading <pre>
in his code essentially gets treated as a <pre>
element. For more info, refer to HTML Entities.Which of the following correctly describes an HTML entity?
An HTML entity is a sequence of characters beginning with an ampersand (
&
). This means that choice (A) is correct. Furthermore, an entity is a sequence of characters that gets rendered as one single character in the output of HTML code. This means that choice (D) is correct. For more info, refer to HTML Entities.An HTML entity is sometimes also referred to as a ...
An HTML entity is also referred to as a character reference. Hence, the correct choice is (B). For more info, refer to HTML Entities.
Which of the following correctly represents an entity for the
<
character?The
<
entity represents the <
character. This goes with choice (A). For more info, refer to HTML Entities: Less-than (<
) and greater-than (>
).HTML entities can either be named or numeric. True or false?
Absolutely true. HTML entities can either be named, for e.g.
<
, or numeric, for e.g. <
. For more info, refer to HTML Entities: Numeric entities.If we know the decimal code point of a special character and want to denote it in HTML source code, how can we do so?
If we have the code point of a character at hand, we can easily denote it in HTML by using a numeric entity. In case the code point is in decimal, we use
&#code;
, and in case it's in hexadecimal, we use ode;
. Hence, the correct choice is (B). For more info, refer to HTML Entities: Numeric entities.How does the following paragraph get displayed in the browser?
<p>Less-than symbol: #x3c;</p>
The code point of the <
character is 60
in decimal and 3c
in hexadecimal.
Carefully notice the text
#x3c;
— it does NOT begin with &
and, therefore, doesn't denote an HTML entity. It gets displayed as it is in the output. This coincides with choice (D). For more info, refer to HTML Entities.How to represent the
&
character using an HTML entity?The
&
character is denoted using the &
named entity. This goes with choice (C). For more info, refer to HTML Entities: Ampersand (&
).