Sample questions
Question 1Medium
- < font face="verdana"> this is some text!
- < face="verdana">this is some text! </face>
- any of the above
- none of the above
Answer: A. < font face="verdana"> this is some text!
Explanation
<font face="verdana"> sets the font of the text (this is old HTML; CSS is used today). The other options do not form a valid tag.
Step-by-step solution
- The font face is set with the face attribute on the font tag.
- The correct form is the font tag with face set to verdana.
- Option B has no font tag, so it is wrong.
- The answer is < font face="verdana"> this is some text!
Why the other options are wrong
- B. Face is not a tag and there is no font element, so the attribute is misplaced.
- C. Any of the above is wrong because option B is invalid.
- D. Option A is correct, so none of the above is wrong.
Tip: Font face is an attribute of the font tag.
Question 2Medium
When is the External style used?
- if a unique style is to be applied to one single occurrence of an element.
- if one single document has a unique style.
- when the style is applied to many pages.
- None of the above
Answer: C. when the style is applied to many pages.
Explanation
external style sheet is ideal when the style is applied to many pages.
<head>
< link rel="stylesheet" type="text css" href="mystyle.css">
<head>
Step-by-step solution
- An external style sheet is one CSS file linked from many pages.
- It is best when the same style is used across many pages.
- Options A and B are for one element or one document only.
- So the correct answer is option C.
Why the other options are wrong
- A. A unique style for one element is an inline style.
- B. A unique style for one document is an internal style sheet.
Tip: External sheets keep one style file for the whole site, so one change updates all pages.
Question 3Medium
How to make stop marquee text on mouse over?
ONMOUSEOVER="this.stop();"ONMOUSEOVER="stop();"MOUSEOVER="this.stop();"- None of the above
Answer: A. ONMOUSEOVER="this.stop();"
Explanation
This example allows the user to stop the marquee when they hover over the marquee with their cursor (i.e. onmouseover). The marquee then continues when the user hovers away from the marquee (i.e.onmouseout).
Step-by-step solution
- A marquee stops when the mouse is over it using the onmouseover event.
- The stop method is called on the element with this.stop.
- Option B calls stop without this, so it does not refer to the marquee.
- Option C uses mouseover, which is not the event attribute name.
- So the correct answer is option A.
Why the other options are wrong
- B. Stop without this does not refer to the marquee element.
- C. MOUSEOVER is not the event attribute; the correct one is onmouseover.
Tip: Event attributes start with on, such as onmouseover, and the handler calls this to refer to the element.
Question 4Medium
How to define marked or highlighted text?
- <h> tag
- <del> tag
- <mark> tag
- None of the above
Answer: C. <mark> tag
Explanation
<mark> defines marked or highlighted text. <h> is not a tag, and <del> marks deleted text.
Step-by-step solution
- Highlighted text is marked with the mark tag.
- Option A is the h tag, which is a heading tag.
- Option B is the del tag, which marks deleted text.
- So the correct answer is option C, the mark tag.
Why the other options are wrong
- A. The h tag is for headings, not highlighting.
- B. The del tag marks deleted text, not highlighted text.
Tip: Match the tag to its meaning: mark is highlight, del is deleted, ins is inserted, h is heading.
Question 5Medium
How you align paragraph to left?
- < p align="left">This is left aligned
- < p align=right">this is left align
- < p="left">this is left align
- < p="right">this is right align
Answer: A. < p align="left">This is left aligned
Explanation
This works when you have multiple lines in your paragraph and you want to justify all the lines so that they can look more nice.
Step-by-step solution
- The align attribute on the p tag sets how the paragraph lines are aligned.
- Option A writes it as p align='left' with the correct value and quotes.
- So the correct answer 0 aligns the paragraph to the left.
Why the other options are wrong
- B. The value is right, so it aligns the text to the right, and the quote is malformed.
- C. The p tag has no p attribute; the syntax is wrong.
- D. This sets right alignment with wrong syntax, so it does not align left.
Tip: Left is the default alignment. The align attribute is old; CSS text-align is the modern way.
Question 6Medium
How to set font size to 3 and font color to red?
- < font size="3" color="red">This is some text!
- < font ="3","red"> This is some text!
- < font size="3"><color="red"> This is some text!</color>
- None of the above
Answer: A. < font size="3" color="red">This is some text!
Explanation
<font size="3" color="red">This is some text!</font> sets the font size to 3 and the font color to red. The correct syntax uses double quotes for both attributes.
Step-by-step solution
- The font tag sets size with the size attribute and colour with the color attribute.
- Option A writes size 3 and color red inside the opening font tag, which is correct.
- Option B has no attribute names, so it is malformed.
- Option C puts a color tag inside the font tag, which is not valid.
- So the correct answer is option A.
Why the other options are wrong
- B. The attributes have no names and the syntax is invalid.
- C. Color is not a tag, so the nested markup is invalid.
- D. Option A is correct, so none of the above is wrong.
Tip: Set font attributes inside the opening font tag with name equals value, in quotes.
Question 7Medium
How to add specified amount of white space to paragraph?
- <p style="margin: 20px">
- <p style="WHITESPACE: 20px">
- <p="margin:20px">
- All of above
Answer: A. <p style="margin: 20px">
Explanation
margin adds white space around an element, outside its border. It goes in the style attribute as margin: 20px.
Step-by-step solution
- Space outside an element is set with the margin property.
- Inline style goes in the style attribute, written as margin: 20px.
- Option A does exactly that, so it is the correct answer.
Why the other options are wrong
- B. WHITESPACE is not a CSS property; the property is margin.
- C. The style attribute name is missing, so the tag is invalid.
- D. Options B and C are wrong, so all of above is wrong.
Tip: Outside space is margin; inside space is padding.
Question 8Medium
How to set marquee direction to upwards?
- < marquee direction="up" >
- < marquee direction="down" >
- < marquee direction="left" >
- None of the above
Answer: A. < marquee direction="up" >
Explanation
The correct syntax for setting the marquee direction to upwards is '< marquee direction="up" >'. This will make the text scroll from bottom to top.
Step-by-step solution
- The marquee element's direction attribute sets the way the text scrolls.
- The values are left, right, up and down.
- direction="up" scrolls the text upwards, so the answer is the first option.
Why the other options are wrong
- B. direction="down" scrolls the text downwards.
- C. direction="left" scrolls the text to the left.
- D. The up option exists, so 'None of the above' is wrong.
Tip: Marquee is an old, non-standard HTML element, but it still appears in exam questions.
Question 9Medium
How to set marquee tags direction left to right?
- < marquee direction="right">
- < marquee direction ="left">
- < marquee direction="left to right">
- None of the above
Answer: A. < marquee direction="right">
Explanation
< marquee direction="right"> will change marquee texts direction left to right.
Step-by-step solution
- The marquee direction attribute sets the way the text moves.
- The default direction is left, which moves text from right to left.
- Setting direction to right moves the text from left to right.
- So the answer is option A, direction right.
Why the other options are wrong
- B. Left is the default and moves text from right to left, the opposite of what is asked.
- C. Left to right is not a valid value; the value is right.
- D. Option A is correct, so None of the above is wrong.
Tip: Marquee direction defaults to left; use right to reverse it.
Question 10Medium
How to set marquee background color?
- < marquee bgcolor="black"></marquee>
- < marquee background="black"></marquee>
- < marquee color="black"></marquee>
- None of the above
Answer: A. < marquee bgcolor="black"></marquee>
Explanation
This tag will make black background color of the marquee text.
Step-by-step solution
- The background colour of a marquee is set with the bgcolor attribute.
- Option A uses bgcolor with the value black, which is correct.
- Option B uses background, which is not a marquee attribute.
- Option C uses color, which sets text colour, not background colour.
- So the correct answer is option A.
Why the other options are wrong
- B. The background attribute is not used for marquee colour.
- C. The color attribute sets text colour, not the background.
Tip: Bgcolor sets background colour on many old tags; color sets text colour.
Practise all 21 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 →