HTML MCQ With Answers
HTML is an abbreviation for HyperText Markup Language. It is the standard go-to language to make web pages and is used to make the general structure of a website/webpage. HTML informs the web browser on how to display the content of the website when the user loads it. HTML consists of a series of elements, which label pieces of content as “heading”, “paragraph”, “link”, etc.
A standard HTML file is shown below:
<!DOCTYPE html>
<html>
<head>
<title>Title Page</title>
</head>
<body>
<h1>Heading Line</h1>
<p>Paragraph Lines</p>
</body>
</html>From the above code, the components of an HTML file document is as explained below:
- <!DOCTYPE html> acts as a declaration that this document is an HTML5 document.
- <html> element is the root element of the HTML page.
- <head> element contains metadata for the HTML page.
- <title> tag produces a title for the webpage we are currently rendering(our HTML page).
- <body> defines the body of the document, and is basically a container for all the contents which is visible in the HTML page like hyperlinks, headings, titles, paragraphs, etc.
- <h1> tag is basically a heading. The ‘1’ represents the size of the heading, 1 being the largest and 6 being the smallest.
- <p> tag basically defines a paragraph.
The general syntax for an HTML element is defined by a start tag, an end tag, and some content enclosed within it. For some HTML elements, the end tag is not needed.
Important Links
- HTML Cheat Sheet
- HTML Interview Questions
- HTML Features
- HTML IDE
- HTML Books
- HTML vs XML
- HTML vs HTML5
- HTML vs XHTML
- HTML vs CSS
- HTML vs Javascript
HTML MCQs
Which of the following colors contain equal amounts of RBG?
White
Gray
Black
All of the above
What is the correct syntax to write an HTML comment?
<!-- Comment -->
// Comment
# Comment
/* Comment */
What is the effect of the <b> tag?
It converts the text within it to bold font.
It is used to write black-colored font.
It is used to change the font size.
None of the above.
What is the function of the HTML style attribute?
It is used to add styles to an HTML element.
It is used to uniquely identify some specific styles of some element.
Both A and B.
None of the above.
What is the select tag used for?
Creates a combo box.
Select some attributes and change their style.
Change text font.
None of the above.
What is the smallest header in HTML by default?
h1
h2
h6
h4
What is the speciality about the <small> and <big> tags in HTML?
They work on anything.
They can be used for text only.
They can be repeated.
None of the above.
What tag is used to render an image on a webpage?
img
src
image
None of the above
Which attribute is used to provide a unique name to an HTML element?
id
class
type
None of the above
Which HTML element is used to define description data?
<li>
<ol>
<dd>
<dl>
Which HTML tag is called the root element of an HTML document?
<html>
<body>
<title>
<head>
Which HTML tag is used to set up a Javascript-like client-side scripting language?
<script>
<select>
<anchor>
None of the above
Which of the following are examples of block-level elements in HTML?
<div>
<p>
<h1>
All of the above
What is meant by an empty tag in HTML?
There is no such concept of an empty tag in HTML
An empty tag does not require a closing tag
An empty tag cannot have any content within it
None of the above
Which of the following is correct about HTML?
HTML uses User Defined Tags.
HTML uses tags defined within the language.
Both A and B.
None of the above.
Which of the following is the correct syntax for using the HTML style attribute?
<tagname style = “property: value;”>
<tagname style = “property;”>
<tagname style >
None of the above
Which of the following is true about HTML tags?
Are case sensitive
Are not case sensitive
Are in uppercase
Are in lowercase
Which of the following properties is used to change the font of text?
font-family
font-size
text-align
None of the above
Which of the following tags doesn’t require a closing tag?
<br>
<hr>
Both A and B
None of the above
Which of the following tags is used to add a row to a table in HTML?
<tr>
<td>
<th>
None of the above
Which of the following tags is used to indicate the page’s start and endpoints?
<body>
<html>
<head>
<doctype>
Which of the following things are necessary to create an HTML page?
A text editor.
Web Browser
Both A and B
None of the above
Which property allows an image link to show a text label?
alt
str
alternative
None of the above
Which property is used to set border colors in HTML?
border-color
border
Both A and B
None of the above
Which property is used to set colors in HTML?
color
background-color
font-color
text-color
The most basic part of any HTML page is?
ASCII Text
Binary Text
Text
None of the above
Colors are defined in HTML using?
RGB Values
HEX Values
RGBA values
All of the above
How are quotations defined in HTML?
<quote>
<block>
<blockquote>
None of the above
How is black color represented in terms of RGB values?
RGB(0, 0, 0)
RGB(100, 100, 100)
RGB(100, 100, 0)
RGB(100, 0, 0)
How many characters can be written in 1KB?
1048
1024
1000
None of the above
How many sizes of headers are available in HTML by default?
5
1
3
6
How to create an ordered list in HTML?
<ul>
<ol>
<href>
<b>
How to display preformatted text in HTML?
<p>
<pre>
<hr>
All of the above
How to set a font for a whole page?
<targetfont>
<defaultfont>
<font>
None of the above
HTML files are saved by default with the extension?
.html
.h
.ht
None of the above
If a background image is smaller than the screen on which it is being displayed, what will occur on the webpage?
The blank space will be shown in black.
The image will be stretched
The image will be repeated
The image won’t be displayed
The CSS inside HTML elements used alongside style attribute is called?
Inline CSS
Internal CSS
External CSS
None of the above
The default value of the BORDER attribute is?
1pixel
2pixel
4pixel
8pixel
Apart from <i> tag, which of the following tag is used to render a text in italics?
<em>
<strong>
<b>
None of the above
We enclose HTML tags within?
{ }
< >
! !
None of the above
What are some valid character sets available?
UTF-8
ANSI
ASCII
All of the above
What are the attributes used to change the size of an image?
Width and height
Big and Small
Top and bottom
None of the above
What are the main components of the front end of any working website?
HTML, CSS, Javascript.
HTML only.
Javascript only.
Node.js.
What are the properties of block-level elements?
It always starts on a new line.
It always takes the full width available.
It has a top and bottom margin.
All of the above.
What are the types of lists available in HTML?
Ordered, Unordered Lists.
Bulleted, Numbered Lists.
Named, Unnamed Lists.
None of the above.
What are the types of unordered lists in HTML?
Circle, square, disc.
Triangle, Square, disc.
Triangle, Circle, Disc.
All of the above.
What are those objects called which are used for storing data on the client provided by the HTML local storage?
Windows.localStorage
Window.sessionStorage
Both A and B
None of the above
What does the abbreviation HTML stand for?
HyperText Markup Language.
HighText Markup Language.
HyperText Markdown Language.
None of the above.
What does the Alpha value in RGBA represent?
Opacity value for a color.
The shade of a color.
Both A and B.
None of the above.
What does the Alpha value of 0.0 represent?
Fully Opaque.
Fully Transparent.
50% transparent.
None of the above.