HTML Questions and Answers - Fundamentals-1

1. How we can add a background color in HTML?
a) <marquee bg color: "red">
b) <marquee bg-color = "red">
c) <marquee bgcolor = "red">
d) <marquee color = "red">

Answer: c
Explanation: The bgcolor attribute is used to set the background color of an HTML element.

2. Which of the following statement is true?
a) SVG needs scripts to draw elements
b) In canvas, drawing is done with pixels
c) SVG don’t support to event handlers
d) Canvas Contains built-in animations

Answer: b
Explanation: In SVG drawing is done with vectors and it support event handlers. Canvas doesn’t contain any built-in-animations and drawing is done with pixels.

3. A program in HTML can be rendered and read by -
a) Web browser
b) Server
c) Interpreter
d) None of the above

Answer: a
Explanation: HTML programs can be read and rendered by the web browser. A web browser can support several web pages.

4. What if one does not use the doctype in the starting of HTML document?
a) Browser stops working
b) Browser crashes after showing the page
c) Browser finds the document in quirky mode
d) Browser finds a document in standard mode

Answer: c
Explanation: If the browser finds in the starting of an HTML document it sets the document in standard mode but if one does not use a doctype, the browser goes to quirky mode. In this mode, certain content will not be displayed as per one wrote that. So, it is always recommended to write a doctype at the very start of the HTML document.

5. Which of the following about HTML in incorrect?
a) HTML can be used for creation of web pages.
b) HTML is a Markup language.
c) HTML is a programming language.
d) HTML is not a programming language.

Answer: c
Explanation: HTML is not a programming language.

6. Which of the following is the corret statement for HTML?
a) Exo is a cloud-based ide that offers collaboration and deployment features
b) Exo does not support java and python
c) Exo supports javascript and html5
d) Both a and c

Answer: d
Explanation: Exo provides a free, cloud-based IDE that offers collaboration and deployment features. In addition to HTML5 and JavaScript, it supports the development of Java, Ruby, and Python applications.

7. Which of the following is the attribute that is used to set a global identifier for a microdata item?
a) key
b) id
c) itemclass
d) itemid

Answer: d
Explanation: Itemid allows a vocabulary to define a global identifier for a microdata item, for example an ISBN number on a book.

8. In order to display the contents as follows:
Headings- HTML
Sub-heading- Elements
Sub-sub-headings- Heading tags
Which one of the following options will be most preferred as tags for each of the above line respectively?
a) <h1>,<h2>,<h3>
b) <h3>,<h2>,<h1>
c) <h6>,<h5>,<h4>
d) <h5>,<h3>,<h1>

Answer: a
Explanation: In HTML, the content between the heading tags <h1> and </h1> has the biggest size and it keeps on decreasing as we move towards <h6>.

9. With respect to the HTML code given below, which line will have the highest font size?
<!DOCTYPE html>
<h1 style="font-size:15px;">Heading 1</h1>
<h3 style="font-size:30px;">Heading 3</h3>
<h5 style="font-size:20px;">Heading 5</h5>
a) Heading 1
b) Heading 3
c) Heading 5
d) All of the above

Answer: b
Explanation: The browser will modify the size of the fonts of headings as per the size given in the attribute font-size.

10. On execution of below HTML code, size of World will be equal to size of which HTML tag?
<!DOCTYPE html>
a) h1
b) h2
c) h3
d) h4

Answer: a
Explanation: Property of the text World will be determined by the innermost tag i.e, <h1>