Learn HTML MCQs

Prepare HTML MCQs (Multiple choice Questions) for exam and job interviews.

Which HTML attribute is used to specify the character encoding for a web page?

1) charset

2) encoding

3) lang

4) code

Answer : charset

What is the purpose of the `<meta>` tag in HTML?

1) To provide metadata about the HTML document

2) To include scripts

3) To link stylesheets

4) To define the viewport

Answer : To provide metadata about the HTML document

Which attribute specifies an alternate text for an image?

1) alt

2) title

3) src

4) href

Answer : alt

What does the `<script>` tag do in HTML?

1) Defines a script

2) Links to a script

3) Styles a document

4) Defines a header

Answer : Defines a script

What is the correct HTML element for defining the document type?

1) <doctype>

2) <html>

3) <head>

4) <meta>

Answer : <!DOCTYPE>

Which HTML element is used to define an interactive control in a web form?

1) <input>

2) <button>

3) <form>

4) <submit>

Answer : <input>

What is the default value of the `type` attribute for the `<input>` tag?

1) text

2) submit

3) button

4) checkbox

Answer : text

Which tag is used to include JavaScript in an HTML document?

1) <script>

2) <javascript>

3) <js>

4) <include>

Answer : <script>

What does the `<title>` tag define in HTML?

1) The main heading of a document

2) The title of the document

3) The character set

4) The style of the document

Answer : The title of the document

Which attribute is used to specify the size of an `<input>` element?

1) size

2) length

3) width

4) height

Answer : size