HTML and CSS
HTML and CSS
A) 7head7
B) 7html7
C) 7title7
D) 7body7
Answer: B) 7html7
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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"
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
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
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
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
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
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
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