G2
G2
Which of the following attributes is mandatory for the <img> tag when using the
<picture> element for responsive images?
A) alt
B) src
C) type
D) srcset
MARKS: 1.5
ANSWER: A
3. In CSS, which of the following units is relative to the font size of the root
element?
A) em
B) px
C) rem
D) pt
MARKS: 1.5
ANSWER: C
4. Which of the following form input types automatically validates the input to
ensure it is a valid email address?
A) <input type="email">
B) <input type="text">
C) <input type="url">
D) <input type="tel">
MARKS: 1.5
ANSWER: A
5. How do you specify that a form element is mandatory before submission in HTML5?
A) validate
B) required
C) must
D) mandatory
MARKS: 1
ANSWER: B
6. What is the correct order of the CSS box model (from inside out)?
A) Content, Padding, Border, Margin
B) Margin, Border, Padding, Content
C) Padding, Content, Margin, Border
D) Content, Border, Padding, Margin
MARKS: 1.5
ANSWER: A
9. What happens if you do not set the method attribute in the <form> tag?
A) The form defaults to the GET method
B) The form defaults to the POST method
C) The form will not submit
D) The browser will throw an error
MARKS: 1.5
ANSWER: A
11. Which of the following pseudo-classes is used to target elements that display
some change when put the cursor over them?
A) :hover
B) :focus
C) :visited
D) :active
MARKS: 1.5
ANSWER: A
12. How do you make an element take up the full width of its parent element?
A) width: 100%;
B) display: block;
C) display: inline-block;
D) position: absolute;
MARKS: 1.5
ANSWER: A
14. In HTML, which element is used to define a navigation link or section that is
considered the primary navigation of the page?
A) <nav>
B) <aside>
C) <section>
D) <menu>
MARKS: 1.5
ANSWER: A
15. Which of the following is a valid example of creating an internal CSS style
rule?
A) <link rel="stylesheet" href="style.css">
B) <style> <h1 { color: blue; }>
C) <div style="color: blue;">Content</div>
D) <style> #tester {font-size: 3xl;} </style>
MARKS: 1.5
ANSWER: D
16. Which of the following correctly sets a default option in a <select> element,
even if no option is selected by the user?
A) Add the default attribute to the <select> tag
B) Add the selected attribute to the default <option> tag
C) Add the value="default" to the <select> tag
D) Add disabled to all other options except the default
MARKS: 1.5
ANSWER: B
17. Which unit is relative to the font size of the element in CSS?
A) px
B) em
C) pt
D) in
MARKS: 1.5
ANSWER: B
18. In HTML5, which element is used to display multiple <source> elements for
different media types, such as images?
A) <picture>
B) <source>
C) <video>
D) <object>
MARKS: 1.5
ANSWER: A
19. Which of the following is a correct example of using the media attribute in a
<source> tag to load an image for devices with a screen width of 1000px or more?
A) <source srcset="large.jpg" media="(min-width: 1000px)">
B) <source src="large.jpg" media="(min-width: 1000px)">
C) <source media="screen and (max-width: 1000px)" srcset="large.jpg">
D) <source src="large.jpg" sizes="1000px">
MARKS: 1.5
ANSWER: A
20. Which input type allows the user to enter both date and time values in an HTML
form?
A) <input type="time">
B) <input type="datetime-local">
C) <input type="date">
D) <input type="week">
MARKS: 1.5
ANSWER: B