ANSWERS 100% CORRECT} ()
(Verified by Experts)
1. What should be added first when embedding CSS in a single web page as an
internal style sheet?
a) A <link> element to the <head> section
b) A <style> element to the <head> section
c) A <script> element to the <body> section
d) A <div> element with class “style”
Rationale:- Internal CSS is placed inside a <style> element within
the <head> section of the HTML document.
2. What is the first character a developer should use for an id selector in CSS?
a) #
b) .
c) :
d) *
Rationale:- The hash symbol # is used to select an element by its id attribute
(e.g., #header).
3. A developer has an image that needs to remain in the same place when the
page is scrolled. Which CSS positioning scheme should this developer use?
a) Static
b) Relative
c) Absolute
d) Fixed
Rationale:- position: fixed locks an element relative to the viewport, so it stays in
place during scrolling.
,4. A developer needs two pixels of space on the left side of content relative to
the border. Which CSS property should this developer use?
a) margin-left: 2px;
b) padding-left: 2px;
c) border-left: 2px;
d) left: 2px;
Rationale:- padding-left adds space between the content and the border inside the
element.
5. What immediately encloses the padding in the CSS box model?
a) Margin
b) Border
c) Content
d) Outline
Rationale:- In the CSS box model, from inside out: content → padding → border
→ margin.
6. What is the outermost box of the CSS box model?
a) Padding
b) Border
c) Margin
d) Content
Rationale:- The margin is the outermost layer, creating space between the element
and others.
7. Which markup positions an image so that the lower part of it is even with
the lower part of adjoining text?
a) <img src="sample.jpg" vertical-align="top">
b) <img src="sample.jpg" vertical-align="middle">
c) <img src="sample.jpg" vertical-align="baseline">
d) <img src="sample.jpg" vertical-align="bottom">
Rationale:- vertical-align: baseline aligns the bottom of the image with the
baseline of the surrounding text.
,8. Which syntax for a CSS class floats images to the right?
a) .floatright { float: left; margin: 7px; }
b) .floatright { float: right; margin: 7px; }
c) #floatright { float: right; margin: 7px; }
d) floatright { float: right; margin: 7px; }
Rationale:- The class selector .floatright with float: right moves the image to the
right; margin adds spacing.
9. Which CSS transition should be used on an image to make it ease in when a
user’s mouse hovers over that image?
a) transition-delay
b) transition-property
c) transition-timing-function
d) transition-duration
Rationale:- transition-timing-function: ease controls the speed curve, making the
transition start slowly, accelerate, then slow down.
10. Which CSS property should a developer use to specify the bottom of a 3D
element?
a) transform-style
b) backface-visibility
c) perspective-origin
d) transform-origin
Rationale:- perspective-origin defines the position from which the viewer is
looking at a 3D element, including the bottom.
11. A web designer creates the following animation by using CSS3:
#texteffect { position: relative; animation-name: scroll; animation-duration: 5s;
animation-timing-function: linear; animation-play-state: running; }
@keyframes scroll { from {left: 0px;} }
What is missing for the animation to actually move the element?
a) to {left: 100px;} inside the keyframes
b) to {left: 100px;} inside the keyframes (or any ending position)
c) animation-iteration-count: 1;
, d) display: block;
Rationale:- The keyframes only define a starting position (from {left:0px}). An
ending position (to {left:...}) is needed for movement.
12. What is a characteristic of a web page with responsive design?
a) Fixed width in pixels
b) The ability to resize to the screen size
c) Requires separate mobile site
d) Uses only absolute units
Rationale:- Responsive design uses fluid grids, flexible images, and media queries
to adapt to different screen sizes.
13. Which language provides dynamic content for a web page across all
browsers?
a) HTML
b) CSS
c) JavaScript
d) SQL
Rationale:- JavaScript is the client-side scripting language supported by all
modern browsers for dynamic behavior.
14. Which type of content should use an <aside>?
a) Main navigation menu
b) News feeds
c) Page footer
d) Primary article content
Rationale:- <aside> is for content tangentially related to the main content, such as
sidebars, pull quotes, or news feeds.
15. Which element should a developer use for a bulleted list?
a) <ol>
b) <ul>
c) <li>