1. Which tag is used to define the HTML document?
A) 7head7
B) 7html7
C) 7title7
D) 7body7
Answer: B) 7html7
2. What is the purpose of the 7head7 tag in HTML?
A) To define the visible content of the page.
B) To define the title and metadata of the document.
C) To include external content.
D) To specify background settings.
Answer: B) To define the title and metadata of the document.
3. Which tag is used to create a paragraph in HTML?
A) 7p7
B) 7para7
C) 7text7
D) 7h17
Answer: A) 7p7
4. Which HTML tag is used to create an ordered list?
A) 7ul7
B) 7ol7
C) 7li7
D) 7dl7
Answer: B) 7ol7
5. What is the default size of a heading (h1) in HTML?
A) 10px
B) 12px
C) Largest font size
D) 20px
Answer: C) Largest font size
6. Which tag is used to create a line break?
A) 7break7
B) 7br7
C) 7hr7
D) 7line7
Answer: B) 7br7
7. What is the function of the 7hr7 tag in HTML?
A) To create horizontal lines
B) To create line breaks
C) To insert comments
D) To separate paragraphs
Answer: A) To create horizontal lines
8. Which tag is used to comment out code in HTML?
A) 7! comment 7
B) // comment
C) / comment /
D) comment
Answer: A) 7! comment 7
9. Which of the following tags is used to define the title of the web page?
A) 7title7
B) 7h17
C) 7head7
D) 7meta7
Answer: A) 7title7
10. What is the purpose of the 7body7 tag in HTML?
A) To define the metadata
B) To link to external files
C) To display the content of the webpage
D) To specify the page layout
Answer: C) To display the content of the webpage
11. Which attribute is used to set the background color of a webpage?
A) color
B) bgcolor
C) backgroundcolor
D) bg
Answer: B) bgcolor
12. Which of the following is an invalid attribute for the 7img7 tag?
A) src
B) alt
C) width
D) font
Answer: D) font
13. What is the default value of the type attribute in the 7ul7 tag?
A) circle
B) square
C) disc
D) none
Answer: C) disc
14. Which attribute is used to define the font size in HTML?
A) size
B) fontsize
C) textsize
D) style
Answer: A) size
15. How do you make text bold in HTML?
A) 7b7
B) 7strong7
C) Both A and B
D) 7em7
Answer: C) Both A and B
16. Which of the following is the correct way to include an image in HTML?
A) 7img src="image.jpg"7
B) 7image src="image.jpg"7
C) 7img src="image.jpg" alt="image description"7
D) Both A and C
Answer: D) Both A and C
17. Which of the following is not a valid list element in HTML?
A) 7li7
B) 7ol7
C) 7dl7
D) 7list7
Answer: D) 7list7
18. Which of the following tags is used to define a description list in HTML?
A) 7dl7
B) 7ol7
C) 7ul7
D) 7list7
Answer: A) 7dl7
19. Which tag is used to define a table in HTML?
A) 7tr7
B) 7th7
C) 7td7
D) 7table7
Answer: D) 7table7
20. How can you change the font color in HTML?
A) Using the color attribute in a tag
B) Using the fontcolor attribute
C) Using the color CSS property
D) Both A and C
Answer: D) Both A and C
21. Which HTML tag is used to create an input field in a form?
A) 7input7
B) 7form7
C) 7textfield7
D) 7button7
Answer: A) 7input7
22. Which of the following is used to create a radio button in HTML?
A) 7input type="checkbox"7
B) 7input type="radio"7
C) 7input type="button"7
D) 7input type="text"7
Answer: B) 7input type="radio"7
23. Which tag is used to create a dropdown list in HTML?
A) 7list7
B) 7select7
C) 7dropdown7
D) 7input7
Answer: B) 7select7
24. Which attribute of the 7input7 tag specifies the password field?
A) password
B) type="password"
C) type="text"
D) password="true"
Answer: B) type="password"
25. Which of the following is the correct way to define a checkbox in HTML?
A) 7input type="checkbox"7
B) 7checkbox7
C) 7input type="check"7
D) 7check7
Answer: A) 7input type="checkbox"7
26. Which of the following is used to group options inside a 7select7 tag?
A) 7option7
B) 7optgroup7
C) 7optitem7
D) 7choice7
Answer: B) 7optgroup7
27. Which type of input control allows users to select one option from a list?
A) Textbox
B) Radio button
C) Checkbox
D) Combobox
Answer: B) Radio button
28. What is the default value of the 7input type="radio"7 element when no option is selected?
A) Checked
B) Unchecked
C) Disabled
D) Hidden
Answer: B) Unchecked
29. Which attribute of 7input7 defines the maximum allowed length of text?
A) maxlength
B) maxlength="100"
C) length
D) max
Answer: A) maxlength
30. What does the required attribute in HTML form fields do?
A) Marks the field as optional
B) Ensures the field is filled before submission
C) Provides default text
D) Validates the input type
Answer: B) Ensures the field is filled before submission
31. Which tag is used to embed audio in an HTML page?
A) 7audio7
B) 7embed7
C) 7sound7
D) 7media7
Answer: A) 7audio7
32. What attribute of the 7audio7 tag is used to specify the source file?
A) src
B) file
C) source
D) url
Answer: A)
src
33. Which tag is used to embed video content in an HTML page?
A) 7video7
B) 7movie7
C) 7embed7
D) 7source7
Answer: A) 7video7
34. Which attribute in the 7video7 tag specifies the video file source?
A) src
B) file
C) source
D) link
Answer: A) src
35. Which attribute allows looping in the 7audio7 and 7video7 tags?
A) loop
B) repeat
C) autoplay
D) backloop
Answer: A) loop
36. Which tag is used to link an external CSS file to an HTML document?
A) 7css7
B) 7style7
C) 7link7
D) 7script7
Answer: C) 7link7
37. Which of the following is a valid CSS property for changing the font size?
A) fontsize
B) fontsizechange
C) textsize
D) size
Answer: A) fontsize
38. Which CSS property is used to set the background color of an element?
A) color
B) bgcolor
C) backgroundcolor
D) background
Answer: C) backgroundcolor
39. Which of the following is used to centeralign text in CSS?
A) align: center;
B) textalign: center;
C) centeralign: true;
D) text: center;
Answer: B) textalign: center;
40. Which of the following is the correct CSS property for setting the border style?
A) borderstyle
B) border
C) outlinestyle
D) styleborder
Answer: A) borderstyle
41. Which attribute is used to merge cells horizontally in a table?
A) colspan
B) rowspan
C) span
D) cellspan
Answer: A) colspan
42. Which tag is used to define a table row in HTML?
A) 7tr7
B) 7row7
C) 7td7
D) 7th7
Answer: A) 7tr7
43. Which tag is used to define a header cell in an HTML table?
A) 7th7
B) 7td7
C) 7header7
D) 7head7
Answer: A) 7th7
44. Which tag is used to define a data cell in an HTML table?
A) 7td7
B) 7data7
C) 7tr7
D) 7cell7
Answer: A) 7td7
45. What is the purpose of the 7table7 tag in HTML?
A) To create a table layout
B) To display text in rows and columns
C) To store tabular data
D) All of the above
Answer: D) All of the above
Links and Anchors
46. Which HTML tag is used to define a hyperlink?
A) 7link7
B) 7a7
C) 7anchor7
D) 7href7
Answer: B) 7a7
47. Which attribute of the 7a7 tag is used to specify the destination of the link?
A) src
B) href
C) link
D) url
Answer: B) href
48. What is the purpose of the target="_blank" attribute in the 7a7 tag?
A) Open the link in a new tab
B) Open the link in the same tab
C) Open the link in a popup
D) Change the text of the link
Answer: A) Open the link in a new tab
49. What does the mailto: protocol do in a hyperlink?
A) Opens the link in an email client
B) Links to a page with a form for email submission
C) Downloads the email client
D) Links to a webpage with instructions for sending an email
Answer: A) Opens the link in an email client
50. Which of the following is the correct way to link to a webpage from another webpage?
A) 7a href="page.html"7Click here7/a7
B) 7link href="page.html"7Click here7/link7
C) 7a page="page.html"7Click here7/a7
D) 7a href="page"7Click here7/a7
Answer: A) 7a href="page.html"7Click here7/a7
51. Which CSS property is used to change the font of a text element?
A) fontfamily
B) fontstyle
C) fontsize
D) All of the above
Answer: D) All of the above
52. Which of the following properties defines the width of an element in CSS?
A) width
B) size
C) dimension
D) maxwidth
Answer: A) width
53. Which tag is used to embed a JavaScript file in an HTML document?
A) 7script7
B) 7js7
C) 7javascript7
D) 7include7
Answer: A) 7script7
54. Which of the following tags is used to display bold text without altering its meaning?
A) 7b7
B) 7strong7
C) 7em7
D) 7i7
Answer: B) 7strong7
55. Which attribute is used to specify a background image for a webpage?
A) backgroundimage
B) bgimage
C) image
D) backgroundurl
Answer: A) backgroundimage
56. Which of the following is the correct way to specify a color in CSS?
A) color: red;
B) color: FF0000;
C) color: rgb(255, 0, 0);
D) All of the above
Answer: D) All of the above
57. What is the purpose of the float property in CSS?
A) To float elements to the left or right of a container
B) To create a floating box
C) To align elements to the center
D) To make the element transparent
Answer: A) To float elements to the left or right of a container
58. Which of the following is the correct CSS property to set the background color of an
element?
A) backgroundcolor
B) bgcolor
C) color
D) background
Answer: A) backgroundcolor
59. What does the position: absolute; property do in CSS?
A) Positions the element based on the nearest positioned ancestor
B) Positions the element in relation to the browser window
C) Fixes the elements position on the page
D) Both A and B
Answer: D) Both A and B
60. Which property in CSS is used to add space between the content and the border of an
element?
A) padding
B) margin
C) borderspacing
D) paddingspacing
Answer: A) padding
61. Which of the following is not a valid HTML5 element?
A) 7header7
B) 7footer7
C) 7section7
D) 7div57
Answer: D) 7div57
62. Which HTML element is used to define a section of a page that contains a footer?
A) 7footer7
B) 7footersection7
C) 7section7
D) 7footerdiv7
Answer: A) 7footer7
63. What is the purpose of the 7!DOCTYPE html7 declaration?
A) Defines the document type as HTML
B) Specifies the HTML version being used
C) Initializes JavaScript code
D) Both A and B
Answer: D) Both A and B
64. Which HTML tag is used to specify the documents character encoding?
A) 7meta7
B) 7encoding7
C) 7charset7
D) 7head7
Answer: A) 7meta7
65. In HTML, which attribute is used to provide alternative text for an image?
A) alt
B) title
C) src
D) desc
Answer: A) alt
66. Which of the following elements is used to create a section of navigation links?
A) 7nav7
B) 7header7
C) 7section7
D) 7link7
Answer: A) 7nav7
67. What tag is used to represent the main content of an HTML document?
A) 7main7
B) 7content7
C) 7section7
D) 7body7
Answer: A) 7main7
68. Which HTML tag is used to define a container for footer content?
A) 7footer7
B) 7bottom7
C) 7footercontent7
D) 7end7
Answer: A) 7footer7
69. What is the correct syntax for using an inline CSS style in an HTML element?
A) 7div style="color:blue;"7
B) 7div css="color:blue;"7
C) 7div77style="color:blue;"77/div7
D) 7div class="colorblue"7
Answer: A) 7div style="color:blue;"7
70. Which of the following is the correct way to set a background color in CSS?
A) backgroundcolor: red;
B) background:red;
C) color: background;
D) Both A and B
Answer: D) Both A and B
71. What is the purpose of the 7aside7 tag in HTML?
A) To create a section of content that is related to the main content
B) To create a sidebar
C) To define a navigation section
D) To add extra content at the end of the page
Answer: A) To create a section of content that is related to the main content
72. Which attribute is used to define the character encoding for a webpage?
A) charset
B) encoding
C) meta
D) type
Answer: A) charset
73. In HTML5, which element is used to represent a specific piece of content or article?
A) 7section7
B) 7article7
C) 7div7
D) 7header7
Answer: B) 7article7
74. Which HTML5 element is used to group header content?
A) 7header7
B) 7head7
C) 7section7
D) 7nav7
Answer: A) 7header7
75. Which of the following is used to specify that a form field should be automatically filled in by
the browser?
A) autocomplete="off"
B) autocomplete="on"
C) autofill="true"
D) formfill="true"
Answer: B) autocomplete="on"
76. Which tag is used to define a document header in HTML5?
A) 7header7
B) 7top7
C) 7head7
D) 7footer7
Answer: A) 7header7
77. Which HTML5 tag is used for defining a form input to collect email addresses?
A) 7input type="email"7
B) 7input type="text"7
C) 7email7
D) 7input type="text"7
Answer: A) 7input type="email"7
78. Which HTML tag is used for defining metadata in a webpage?
A) 7meta7
B) 7metadata7
C) 7info7
D) 7description7
Answer: A) 7meta7
79. Which HTML tag defines a container for a list of hyperlinks?
A) 7ul7
B) 7ol7
C) 7nav7
D) 7a7
Answer: C) 7nav7
80. Which HTML tag is used to define the document type?
A) 7!DOCTYPE html7
B) 7html7
C) 7head7
D) 7meta7
Answer: A) 7!DOCTYPE html7
81. Which HTML tag is used to define a metadata description for search engines?
A) 7meta name="description" content="description"7
B) 7meta charset="UTF8"7
C) 7meta name="keywords" content="HTML, CSS, JavaScript"7
D) 7meta name="viewport" content="width=devicewidth"7
Answer: A) 7meta name="description" content="description"7
82. What is the purpose of the viewport meta tag in HTML5?
A) To control the layout on mobile devices and ensure responsiveness
B) To set the viewport dimensions for a specific page
C) To define the text zoom level in mobile browsers
D) To control the number of browser windows
Answer: A) To control the layout on mobile devices and ensure responsiveness
83. In HTML, which of the following tags can be used to include a favicon (website icon)?
A) 7link rel="icon" href="favicon.ico"7
B) 7img src="favicon.ico"7
C) 7favicon src="favicon.ico"7
D) 7icon href="favicon.ico"7
Answer: A) 7link rel="icon" href="favicon.ico"7
84. What does the contenteditable attribute do in HTML?
A) Specifies that the content of an element is editable by the user
B) Makes the entire webpage editable
C) Only allows text elements to be edited
D) Enables copypaste operations on the element
Answer: A) Specifies that the content of an element is editable by the user
85. Which HTML5 element is used to define a list of options that can be chosen by the user in a
form?
A) 7optgroup7
B) 7option7
C) 7select7
D) 7choices7
Answer: B) 7option7
86. What is the correct way to embed an external JavaScript file in an HTML document?
A) 7script href="file.js"77/script7
B) 7script src="file.js"77/script7
C) 7js src="file.js"77/js7
D) 7link rel="script" href="file.js"7
Answer: B) 7script src="file.js"77/script7
87. In HTML5, which of the following elements is used to define a navigation bar?
A) 7header7
B) 7nav7
C) 7footer7
D) 7section7
Answer: B) 7nav7
88. Which of the following is the correct way to specify the character encoding in an HTML5
document?
A) 7meta charset="UTF8"7
B) 7meta httpequiv="ContentType" content="text/html; charset=UTF8"7
C) 7meta charset="ISO88591"7
D) Both A and B
Answer: D) Both A and B
89. Which HTML5 element is used to embed a YouTube video or other embedded media?
A) 7video7
B) 7iframe7
C) 7embed7
D) 7object7
Answer: B) 7iframe7
90. What is the correct syntax to add a comment in an HTML5 document?
A) 7! This is a comment 7
B) / This is a comment /
C) // This is a comment
D) This is a comment
Answer: A) 7! This is a comment 7
91. Which HTML5 element is used to define a section in a webpage that is semantically a
sidebar?
A) 7aside7
B) 7section7
C) 7div7
D) 7nav7
Answer: A) 7aside7
92. In an HTML form, which input type is used to create a field for entering a date?
A) 7input type="datetime"7
B) 7input type="date"7
C) 7input type="calendar"7
D) 7input type="time"7
Answer: B) 7input type="date"7
93. Which HTML tag defines a blocklevel quote or a citation?
A) 7blockquote7
B) 7q7
C) 7cite7
D) 7quote7
Answer: A) 7blockquote7
94. Which HTML tag is used to define a piece of important text?
A) 7strong7
B) 7b7
C) 7important7
D) 7i7
Answer: A) 7strong7
95. What is the purpose of the required attribute in an HTML form?
A) It makes the form field mandatory before submitting
B) It specifies a validation pattern
C) It enables the user to select multiple options
D) It prefills the form field with default data
Answer: A) It makes the form field mandatory before submitting
96. What is the correct way to insert a line break in a table cell?
A) 7br7
B) 7td77br77/td7
C) 7tr77br77/tr7
D) 7td77/br77/td7
Answer: B) 7td77br77/td7
97. Which HTML element is used to specify the title of a document?
A) 7meta7
B) 7head7
C) 7title7
D) 7header7
Answer: C) 7title7
98. Which HTML tag is used to represent a horizontal rule (line) that visually separates content?
A) 7hr7
B) 7br7
C) 7separator7
D) 7line7
Answer: A) 7hr7
99. What is the correct syntax to create a link that opens in a new window/tab?
A) 7a href="https://example.com" target="_blank"7Link7/a7
B) 7a href="https://example.com" open="new"7Link7/a7
C) 7a href="https://example.com" target="_new"7Link7/a7
D) 7a href="https://example.com" newwindow="true"7Link7/a7
Answer: A) 7a href="https://example.com" target="_blank"7Link7/a7
100. Which of the following is a valid way to create a table with alternating row colors using
CSS?
A) Use the nthchild selector in CSS
B) Use the alternatingrows property
C) Use JavaScript to alternate the row colors
D) HTML tables do not support alternating row colors
Answer: A) Use the nthchild selector in CSS