



































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




































Question 1. Which HTML element defines the document type and ensures standards‑mode rendering?
A) <html>
B) <!DOCTYPE html>
C) <head>
D) <meta charset="utf-8">
Answer: B
Explanation: The declaration tells browsers to render the page in standards mode, which is required for modern HTML features. Question 2. In a semantic HTML layout, which element is most appropriate for a site’s primary navigation links?
A) <section>
B) <nav>
C) <aside>
D) <header>
Answer: B
Explanation: <nav> explicitly represents a block of navigation links, improving both accessibility and SEO. Question 3. Which attribute on an <input> element makes the field mandatory before form submission?
A) placeholder
B) required
C) autocomplete
D) pattern
Answer: B
Explanation: The required attribute forces the browser to block submission until the field is filled. Question 4. Which HTML element is best suited for embedding a video that should offer multiple source formats?
A) <audio>
B) <object>
C) <video>
D) <embed>
Answer: C
Explanation: The <video> element supports multiple <source> children, allowing the browser to pick the best format. Question 5. To create a table header that spans two columns, which attribute is used?
A) colspan
B) rowspan
C) scope
D) headers
Answer: A
Explanation: colspan defines how many columns a cell should occupy horizontally. Question 6. Which CSS selector matches any element that has a data‑status attribute equal to "active"?
A) [data-status="active"]
B) .data-status="active"
C) #data- status="active"
D) :data-status(active)
Answer: A
Explanation: Attribute selectors use square brackets and can test for exact values.
Question 7. In the cascade, which of the following has the highest specificity?
A) element selector (e.g., div)
B) class selector (e.g., .box)
C) ID selector (e.g., #main)
D) universal selector (*)
Answer: C
Explanation: ID selectors have a specificity score of 0‑ 1 ‑0, higher than class (0‑ 0 ‑1) and element (0‑ 0 ‑ 0 ‑1) selectors. Question 8. Which property controls the space between an element’s border and its content?
A) margin
B) padding
C) border-width
D) outline
Answer: B
Explanation: Padding sits inside the border, separating the border from the element’s content. Question 9. Which CSS positioning scheme removes an element from the normal flow and positions it relative to the viewport?
A) static
B) relative
C) absolute
D) fixed
Answer: D
Explanation: Fixed positioning anchors the element to the viewport, remaining stationary during scrolling. Question 10. Which unit is relative to the root element’s font size?
A) em
B) px
C) rem
D) %
Answer: C
Explanation: rem stands for “root em” and scales based on the font size of the html element. Question 11. The CSS color value “rgba(255,0,0,0.5)” represents which of the following?
A) Fully opaque red
B) Semi‑transparent red
C) Fully opaque blue
D) Semi‑transparent green
Answer: B
Explanation: rgba adds an alpha channel; 0.5 makes the red 50 % transparent. Question 12. Which meta tag is essential for responsive design on mobile devices?
A) <meta charset="utf-8">
B) <meta name="author">
C) <meta name="viewport" content="width=device-width, initial-scale=1">
D) <meta http‑equiv="X-UA-Compatible">
Answer: C
Explanation: The viewport meta tag tells browsers how to scale the page to the device width.
A
Explanation: The loading attribute accepts “lazy”, “eager”, or “auto” to control when the image is fetched. Question 19. In Flexbox, which property controls the alignment of items along the cross axis?
A) justify-content
B) align-items
C) flex-direction
D) align-self
Answer: B
Explanation: align-items aligns all flex items on the cross axis (perpendicular to the main axis). Question 20. Which Flexbox property allows a child element to grow and fill remaining space?
A) flex-basis
B) flex-shrink
C) flex-grow
D) order
Answer: C
Explanation: flex-grow defines the proportion of free space an item should take relative to its siblings. Question 21. If a flex container has flex-direction: column, what does justify-content align?
A) Horizontally (left‑right)
B) Vertically (top‑bottom)
C) Along the main axis, which is now vertical
D) Along the cross axis, which is now horizontal
Answer: C
Explanation: justify-content always aligns items on the main axis; with column direction, the main axis is vertical. Question 22. Which value for flex-wrap allows items to stay on a single line and shrink if necessary?
A) nowrap
B) wrap
C) wrap-reverse
D) inherit
Answer: A
Explanation: nowrap prevents wrapping; items will shrink to fit the container. Question 23. In a CSS Grid layout, what does the unit “fr” represent?
A) Fraction of the viewport width
B) Fraction of the available grid space
C) Fixed pixel value
D) Percentage of the container
Answer: B
Explanation: “fr” distributes free space among grid tracks proportionally. Question 24. Which property creates space between rows and columns in a grid without affecting the size of the tracks?
A) margin
B) gap
C) grid-gap
D)
spacing
Answer: B
Explanation: The gap (or grid-gap) property inserts consistent gutters between grid cells. Question 25. To place a grid item spanning from column line 2 to column line 5, which shorthand is correct?
A) grid-column: 2 / 5;
B) grid-column: span 3;
C) grid-column- start: 2; grid-column-end: 5;
D) Both A and C are correct
Answer: D
Explanation: Both the shorthand “grid-column: 2 / 5” and the longhand start/end declarations achieve the same result. Question 26. Which CSS property aligns a single grid item along its own block axis, overriding the container’s align-items?
A) align-self
B) justify-self
C) place-self
D) align-content
Answer: A
Explanation: align-self works on the individual grid item, similar to its Flexbox counterpart. Question 27. In accessibility, which ARIA attribute explicitly defines a region as a navigation landmark?
A) role="navigation"
B) aria-label="nav"
C) aria-hidden="true"
D) role="banner"
Answer: A
Explanation: role="navigation" informs assistive technologies that the element contains primary navigation links. Question 28. Which WCAG success criterion relates to providing text alternatives for non‑text content?
A) 1.1.1 Non‑text Content
B) 1.3.1 Info and Relationships
C) 2.4. Focus Order
D) 1.4.3 Contrast (Minimum)
Answer: A
Explanation: Success Criterion 1.1.1 requires alt text or other alternatives for images, videos, etc. Question 29. What is the recommended minimum contrast ratio for normal text according to WCAG AA?
A) 3:1
B) 4.5:1
C) 7:1
D) 5:1
Answer: B
Explanation: WCAG AA requires at least a 4.5:1 contrast ratio for regular‑size text. Question 30. Which HTML attribute improves keyboard navigation by defining a custom tab order?
A) tabindex
B) accesskey
C) role
D) aria-describedby
Answer: A
Explanation: tabindex sets the element’s position in the sequential focus order.
Question 37. Which Tailwind utility class applies a margin of 1 rem on all sides?
A) m- 4
B) m-1
C) p-4
D) mx-4
Answer: A
Explanation: Tailwind’s spacing scale maps 4 to 1 rem (0.25 rem × 4), so m-4 adds a 1 rem margin. Question 38. In Sass, which feature allows you to reuse a block of CSS with optional parameters?
A) @extend
B) @mixin
C) @function
D) @import
Answer: B
Explanation: @mixin defines reusable style snippets that can accept arguments. Question 39. Which CSS selector has higher specificity: .nav .item:hover or #header?
A) .nav .item:hover
B) #header
C) Both equal
D) Neither (specificity is same)
Answer: B
Explanation: #header has an ID selector (0‑ 1 ‑0), while .nav .item:hover has two class selectors and a pseudo‑class (0‑ 0 ‑3); IDs outrank classes. Question 40. Which HTML element should be used to group a set of related form controls and their labels?
A) <fieldset>
B) <section>
C) <div>
D) <form>
Answer: A
Explanation: <fieldset> semantically groups related controls and can be paired with <legend> for a caption. Question 41. What does the CSS property “object-fit: cover;” achieve on an <img> element?
A) Stretches the image to fill the container without preserving aspect ratio
B) Scales the image to fit inside the container while preserving aspect ratio
C) Fills the container, cropping excess while preserving aspect ratio
D) Centers the image without scaling
Answer: C
Explanation: object-fit: cover scales the image to fill the container and crops overflow, maintaining aspect ratio. Question 42. Which media query feature detects screens with a pixel density of at least 2 dppx?
A) resolution: 2dppx
B) min-resolution: 2dppx
C) device-pixel-ratio: 2
D) min-device-pixel-ratio: 2
Answer: B
Explanation: The min-resolution feature matches devices whose resolution meets or exceeds the specified value.
Question 43. Which HTML attribute on a <video> element enables native lazy loading?
A) preload="none"
B) loading="lazy"
C) autoplay
D) muted
Answer: B
Explanation: As of recent specifications, the loading attribute works for video and iframe elements, allowing lazy loading. Question 44. In CSS Grid, what does the shorthand “grid-template: 100px / 1fr 2fr;” define?
A) Row height of 100 px and two columns with fractional widths
B) Column width of 100 px and two rows with fractional heights
C) A single cell of 100 px by 1fr
D) Gap sizes between tracks
Answer: A
Explanation: The first value sets row tracks (100 px), the second defines column tracks (1fr and 2fr). Question 45. Which property would you use to change the order of flex items without altering the HTML source?
A) order
B) flex-order
C) position
D) z- index
Answer: A
Explanation: The order property determines the visual order of flex items within the container. Question 46. Which HTML element is appropriate for marking up a blockquote with a citation?
A) <cite>
B) <q>
C) <blockquote>
D) <section>
Answer: C
Explanation: <blockquote> denotes a longer quotation; a nested <cite> can provide the source. Question 47. Which CSS pseudo‑class matches an element that is the first child of its parent?
A) :first-of-type
B) :first-child
C) :nth-child(1)
D) :first
Answer: B
Explanation: :first-child selects an element that is the first child node, regardless of type. Question 48. Which attribute on a <form> element specifies the HTTP method used for submission?
A) action
B) method
C) enctype
D) target
Answer: B
Explanation: The method attribute takes values like “get” or “post” to define how form data is transmitted.
proportionally
B) Prevents the item from growing
C) Sets a fixed width of 0 px
D) Causes the item to shrink to zero when space is limited
Answer: A
Explanation: flex- basis defines the base size; setting it to 0 lets flex-grow determine the final size based on available space. Question 56. Which CSS selector targets every odd‑numbered list item?
A) li:nth- child(even)
B) li:odd
C) li:nth-of-type(odd)
D) li:nth-child(odd)
Answer: D
Explanation: nth-child(odd) selects elements with an odd index among their siblings. Question 57. Which HTML attribute defines a short hint that appears inside a form field before the user enters a value?
A) value
B) placeholder
C) title
D) label
Answer: B
Explanation: placeholder provides a brief example or instruction inside the input. Question 58. Which CSS property defines how an element’s background image is scaled and positioned within its container?
A) background-size
B) background-position
C) background-repeat
D) background-clip
Answer: A
Explanation: background-size controls scaling (e.g., cover, contain, specific dimensions). Question 59. Which ARIA state indicates that a collapsible element is currently expanded?
A) aria-expanded="true"
B) aria-hidden="false"
C) aria-controls
D) aria-live
Answer: A
Explanation: aria-expanded conveys the expanded/collapsed state of interactive widgets. Question 60. Which of the following is a recommended practice for improving perceived performance on mobile devices?
A) Load all JavaScript synchronously
B) Use a single large image sprite
C) Defer non‑critical CSS with media="print"
D) Serve uncompressed assets
Answer: C
Explanation: Deferring non‑critical CSS reduces render‑blocking resources, speeding up initial paint.
Question 61. Which CSS rule will make a container’s children wrap onto multiple lines when there isn’t enough space?
A) flex-wrap: nowrap;
B) flex-wrap: wrap;
C) flex- direction: column;
D) overflow: hidden;
Answer: B
Explanation: flex-wrap: wrap allows flex items to move onto new lines when needed. Question 62. In a responsive design, what does “breakpoint” refer to?
A) The moment a page crashes
B) A specific viewport width where layout changes are applied
C) The maximum file size for images
D) The height of the navigation bar
Answer: B
Explanation: Breakpoints are defined widths (or heights) at which CSS media queries adjust the layout. Question 63. Which HTML element is used to embed an SVG directly into the document?
A) <img>
B) <object>
C) <svg>
D) <canvas>
Answer: C
Explanation: The <svg> element allows inline SVG markup, providing full CSS styling and scripting. Question 64. Which CSS property controls the thickness of the line drawn around an element’s border?
A) border-width
B) border-style
C) border-color
D) outline
Answer: A
Explanation: border-width sets the width (thickness) of the border on all four sides. Question 65. Which media feature can be used to apply styles only when the device is in landscape orientation?
A) orientation: portrait
B) orientation: landscape
C) device- orientation: landscape
D) screen-orientation: landscape
Answer: B
Explanation: The orientation media feature accepts “portrait” or “landscape”. Question 66. Which of the following is the correct syntax for a CSS custom property (variable) named “primary-color”?
A) $primary-color: #ff0;
B) --primary-color: #ff0;
C) @primary-color: #ff0;
D) var-primary-color: #ff0;
Answer: B
Explanation: CSS variables are defined with two leading hyphens and accessed via var(--primary-color).
Question 73. Which HTML element is best suited for grouping a set of terms and definitions?
A) <dl>
B) <ul>
C) <ol>
D) <section>
Answer: A
Explanation: <dl> (definition list) contains <dt> (term) and <dd> (definition) pairs. Question 74. Which CSS rule will prevent a flex container from shrinking its items below their content size?
A) flex-shrink: 0;
B) flex-grow: 0;
C) min-width: 0;
D) overflow: hidden;
Answer: A
Explanation: flex-shrink: 0 disables the shrinking behavior for flex items. Question 75. Which media query feature can be used to detect users who have set “Reduce Motion” in their OS preferences?
A) prefers-reduced-motion: reduce
B) prefers-reduced-motion: no-preference
C) prefers-reduced-motion: reduce;
D) prefers- reduced-motion: reduce (true)
Answer: C
Explanation: The prefers-reduced-motion media feature accepts “reduce” or “no-preference”. Question 76. Which CSS property allows you to define how many columns a grid item should span?
A) grid-column-span
B) column-span
C) grid-column: span 2;
D) grid-area: span 2;
Answer: C
Explanation: Using “grid-column: span N” tells the item to occupy N columns. Question 77. Which HTML attribute on an <input type="email"> element triggers built‑in validation for a proper email format?
A) pattern
B) required
C) type="email"
D) autocomplete
Answer: C
Explanation: The type attribute “email” causes browsers to check that the entered value matches an email address pattern. Question 78. Which CSS property controls the distance between lines of text?
A) line- height
B) letter-spacing
C) word-spacing
D) text-indent
Answer: A
Explanation: line-height defines the vertical spacing between baselines of adjacent lines.
Question 79. Which HTML element should be used for a self‑contained piece of content that could be syndicated independently?
A) <section>
B) <article>
C) <aside>
D) <div>
Answer: B
Explanation: <article> represents an independent, reusable piece such as a blog post or news article. Question 80. Which CSS property can be used to create a “sticky” header that stays at the top after scrolling past it?
A) position: fixed;
B) position: absolute;
C) position: sticky;
D) float: top;
Answer: C
Explanation: position: sticky keeps the element in the normal flow until a threshold is reached, then fixes it. Question 81. Which attribute on a <link> element tells the browser that the linked stylesheet is for screen media only?
A) rel="stylesheet"
B) media="screen"
C) type="text/css"
D) href="style.css"
Answer: B
Explanation: The media attribute restricts the stylesheet to the specified media type. Question 82. Which CSS selector matches an element that is the last child of its parent?
A) :last-of-type
B) :nth-last-child(1)
C) :last-child
D) :nth- child(last)
Answer: C
Explanation: :last-child selects an element that is the final child node of its parent. Question 83. Which of the following is a valid way to import a Sass file into another Sass file?
A) @import "variables.scss";
B) @include "variables.scss";
C) @use "variables";
D) Both A and C are valid (depending on version)
Answer: D
Explanation: Older Sass uses @import; newer versions encourage @use. Both are syntactically correct. Question 84. Which HTML element should be used to indicate a navigation landmark that contains a list of links to other pages?
A) <section>
B) <nav>
C) <header>
D) <div>
Answer: B
Explanation: <nav> semantically defines a major set of navigation links.
Question 91. Which attribute on the <meta> tag defines the character encoding of the document?
A) charset="UTF-8"
B) name="charset"
C) http-equiv="Content- Type"
D) content="charset=UTF-8"
Answer: A
Explanation: charset specifies the document’s character set directly. Question 92. Which CSS function can be used to create a linear gradient background?
A) gradient-linear()
B) linear-gradient()
C) background- gradient()
D) gradient()
Answer: B
Explanation: linear-gradient() produces a gradient image that can be assigned to background-image. Question 93. Which HTML element is used to define a block of code that should be presented as pre‑formatted text?
A) <code>
B) <pre>
C) <samp>
D) <kbd>
Answer: B
Explanation: <pre> preserves whitespace and line breaks, displaying content exactly as written. Question 94. Which CSS property can be used to make text wrap only at explicit hyphenation points?
A) word-break: break-all;
B) hyphens: auto;
C) overflow-wrap: break-word;
D) text-wrap: normal;
Answer: B
Explanation: hyphens: auto enables automatic hyphenation according to language rules. Question 95. Which of the following is a correct way to declare a CSS variable that can be accessed globally?
A) :root { --main-color: #333; }
B) body { $main-color: #333; }
C) @global --main-color: #333;
D) * { --main-color: #333; }
Answer: A
Explanation: Declaring variables on the :root pseudo‑class makes them available throughout the document. Question 96. Which attribute on a <link> element tells browsers that the linked resource is a favicon?
A) rel="icon"
B) type="image/x-icon"
C) href="favicon.ico"
D) rel="shortcut icon"
Answer: A (rel="icon")
Explanation: rel="icon" identifies the linked file as the site’s favicon; rel="shortcut icon" is legacy but still works.
Question 97. Which CSS selector matches any element that has a class attribute containing the word “button” anywhere in its value?
A) .button
B) [class*="button"]
C) .[button]
D) :class(button)
Answer: B
Explanation: The *= attribute selector matches substrings within the attribute value. Question 98. Which HTML element should be used to contain a set of navigation links that appear only on small screens?
A) <nav class="mobile-only">
B) <section id="mobile-nav">
C) <div data-mobile-nav>
D) Any of the above as long as CSS hides/shows it
Answer: D
Explanation: The element type is less important than the appropriate ARIA role; using <nav> is semantic, but any element can be styled to appear only on small screens. Question 99. Which CSS property can be used to create a smooth transition when a button’s background color changes on hover?
A) transition: background-color 0.3s ease;
B) animation: hover-bg 0.3s;
C) effect: fade 0.3s;
D) change: background 0.3s;
Answer: A
Explanation: transition defines which property animates, its duration, and timing function. Question 100. Which HTML5 element is intended for grouping together a set of media controls such as play, pause, and volume?
A) <controls>
B) <menu>
C) <section>
D) <div> (with appropriate ARIA)
Answer: D (no specific element; developers use a with role="region" or ARIA toolbar)
Explanation: There is no dedicated HTML5 element for media controls; a generic container with appropriate ARIA roles is used. Question 101. Which CSS property determines how a flex container distributes extra space between items when justify-content is set to space-between?
A) align-content
B) gap
C) justify-content
D) flex-grow
Answer: C
Explanation: justify-content: space-between places the first item at the start, the last at the end, and distributes remaining space evenly between items.
A
Explanation: text-transform: capitalize converts the first character of each word to uppercase. Question 108. Which attribute on a <form> element defines the URL to which the form data will be submitted?
A) action
B) method
C) target
D) enctype
Answer: A
Explanation: The action attribute specifies the endpoint that processes the form submission. Question 109. Which CSS property would you use to create a two‑column layout where the left column is 250 px wide and the right column takes the remaining space?
A) grid- template-columns: 250px 1fr;
B) flex: 250px 1fr;
C) column-count: 2;
D) columns: 250px auto;
Answer: A
Explanation: In CSS Grid, defining columns as 250px and 1fr creates the desired fixed‑plus‑flex layout. Question 110. Which HTML element should be used to provide a caption for a <table>?
A) <caption>
B) <thead>
C) <title>
D) <summary>
Answer: A
Explanation: <caption> supplies a title or description for the table content. Question 111. Which CSS property controls the space between the border of a button and its text content?
A) margin
B) padding
C) border-spacing
D) outline
Answer: B
Explanation: Padding adds internal spacing inside the element, separating text from the border. Question 112. Which ARIA role is appropriate for a widget that allows users to select a value from a range, such as a slider?
A) role="slider"
B) role="progressbar"
C) role="range"
D) role="option"
Answer: A
Explanation: role="slider" identifies a draggable control that selects a value from a continuous range. Question 113. Which CSS property can be used to hide an element visually but keep it accessible to screen readers?
A) display: none;
B) visibility: hidden;
C) opacity:
0;
D) clip: rect(0 0 0 0); position: absolute; width: 1px; height: 1px;
Answer: D
Explanation: The combination of clipping and off‑screen positioning removes the element from visual flow while retaining it in the accessibility tree. Question 114. Which HTML attribute on an <img> tag provides a short description for users of assistive technologies?
A) title
B) alt
C) aria-label
D) description
Answer: B
Explanation: The alt attribute supplies alternative text read by screen readers. Question 115. Which CSS property defines the thickness of the line drawn around an element’s outline?
A) outline-width
B) border-width
C) stroke-width
D) outline- size
Answer: A
Explanation: outline-width sets the outline’s thickness, separate from the border. Question 116. Which of the following is a correct way to write a media query that targets only devices in portrait orientation?
A) @media (orientation: portrait) { … }
B) @media portrait { … }
C) @media (device-orientation: portrait) { … }
D) @media (orientation = portrait) { … }
Answer: A
Explanation: The orientation media feature accepts “portrait” or “landscape”. Question 117. Which CSS selector selects an element with the exact ID “nav‑primary”?
A) #nav-primary
B) .nav-primary
C) [id="nav-primary"]
D) Both A and C
Answer: D
Explanation: Both the ID selector (#nav-primary) and the attribute selector ([id="nav-primary"]) match the element. Question 118. Which HTML element is appropriate for marking up a term and its definition within a description list?
A) <dt> for the term, <dd> for the definition
B) <dl> for both
C) <definition>
D) <term>
Answer: A
Explanation: Within a <dl>, <dt> defines the term and <dd> provides its definition.