






































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 126. Which CSS property is used to create a two‑dimensional layout grid? A) display: flex; B) display: grid; C) display: block; D) display: inline; Answer: B Explanation: display:grid activates the CSS Grid Layout, allowing rows and columns to be defined. Question 127. In a CSS Grid container, what does the value repeat(4, 1fr) for grid-template- columns do? A) Creates 4 columns each 1 pixel wide B) Creates 4 columns each taking an equal fraction of the remaining space C) Creates 4 rows of equal height D) Repeats the same column definition four times without spacing Answer: B Explanation: 1fr represents one fraction of the free space; repeating it four times yields four equal columns. Question 128. Which HTML element is most appropriate for a site’s primary navigation list? A) <section> B) <nav> C) <aside> D) <header> Answer: B
Explanation: <nav> semantically denotes a block of major navigation links. Question 129. Which attribute on the <video> tag indicates that the video should start playing automatically? A) autoplay B) muted C) controls D) preload Answer: A Explanation: The autoplay attribute tells the browser to start playback as soon as it can. Question 130. Which CSS selector matches any <input> element that is disabled? A) input[disabled] B) input:disabled C) .disabled D) Both A and B are valid Answer: D Explanation: Attribute selector [disabled] and pseudo‑class :disabled both target disabled inputs. Question 131. Which JavaScript method returns an iterator of key/value pairs from a Map object? A) map.entries() B) map.keys() C) map.values() D) map.pairs()
Answer: A Explanation: The Set constructor takes an iterable; an array of values creates a Set with those elements. Question 135. Which CSS property adds space inside an element’s border? A) margin B) padding C) border-spacing D) gap Answer: B Explanation: Padding is the interior space between the content and the border. Question 136. Which HTML element is used to define a short inline code snippet? A) <pre> B) <code> C) <samp> D) <kbd> Answer: B Explanation: <code> semantically represents a fragment of computer code. Question 137. Which JavaScript operator checks whether a variable is an instance of a particular class? A) instanceof
B) typeof C) isA D) classof Answer: A Explanation: The instanceof operator returns true if the prototype chain includes the constructor’s prototype. Question 138. Which CSS value for overflow hides excess content without providing scrollbars? A) visible B) hidden C) scroll D) auto Answer: B Explanation: overflow:hidden clips the content that exceeds the element’s box. Question 139. Which HTML5 element is intended for self‑contained content that could be syndicated independently? A) <section> B) <article> C) <aside> D) <nav> Answer: B Explanation: <article> represents a standalone composition such as a blog post or news story.
Explanation: The child combinator (>) selects immediate children; .container refers to the div with that class. Question 143. Which HTML attribute on an <input type="email"> ensures the user cannot submit the form without entering a value? A) required B) placeholder C) pattern D) autocomplete Answer: A Explanation: The required attribute forces the field to have a value before form submission. Question 144. Which JavaScript statement correctly creates a shallow copy of an array using the spread operator? A) const copy = [...original]; B) const copy = original...; C) const copy = original.slice(); D) Both A and C are correct Answer: D Explanation: Both the spread syntax and slice() without arguments produce shallow copies. Question 145. Which CSS property is used to create a multi‑column layout? A) column-count B) columns C) column-gap
D) Both A and B can initiate columns Answer: D Explanation: column-count sets the number of columns; the shorthand columns can set count and gap together. Question 146. Which HTML element is used to embed a JavaScript module? A) <script type="module"> B) <script defer> C) <script async> D) <module> Answer: A Explanation: type="module" tells the browser to treat the script as an ES6 module. Question 147. Which JavaScript method returns an array of the own enumerable property names of an object? A) Object.keys(obj) B) Object.values(obj) C) Object.entries(obj) D) obj.propertyNames() Answer: A Explanation: Object.keys lists the object's own enumerable keys. Question 148. Which CSS selector matches an element with an attribute data-state equal to “active”? A) [data-state="active"]
Question 151. Which CSS property defines the distance between the border and adjacent elements? A) margin B) padding C) border-spacing D) outline Answer: A Explanation: Margin creates space outside the border, separating the element from its neighbors. Question 152. Which HTML attribute on a <link> element specifies the relationship of the linked resource? A) rel B) href C) type D) media Answer: A Explanation: rel defines the relationship, such as "stylesheet" for CSS files. Question 153. Which JavaScript function can be used to pause execution for a specific time within an async function? A) await setTimeout(() => {}, 2000) B) await new Promise(r => setTimeout(r, 2000)) C) sleep(2000) D) delay(2000) Answer: B
Explanation: Wrapping setTimeout in a Promise and awaiting it creates a delay in async code. Question 154. Which CSS pseudo‑class applies styles to the first child of its parent element? A) :first-child B) :first-of-type C) :nth-child(1) D) Both A and C are correct Answer: D Explanation: :first-child and :nth-child(1) target the same element. Question 155. Which HTML element is used to embed a third‑party widget such as a Twitter timeline? A) <iframe> B) <object> C) <embed> D) All of the above can be used, but <iframe> is most common Answer: D Explanation: Any of these elements can embed external content; iframe is the typical choice for widgets. Question 156. Which CSS property controls the thickness of a text underline? A) text-decoration-thickness B) text-underline-width C) text-decoration-width D) underline-size
C) defered D) load Answer: A Explanation: defer loads the script in parallel and executes it after parsing, preserving order. Question 160. Which JavaScript method returns a new array containing only the unique values from an original array? A) Array.from(new Set(array)) B) array.unique() C) array.distinct() D) new Set(array).toArray() Answer: A Explanation: Converting the array to a Set removes duplicates; Array.from turns the Set back into an array. Question 161. Which CSS property sets the background image positioning? A) background-position B) background-align C) background-origin D) background-attach Answer: A Explanation: background-position defines where the background image is placed within the element. Question 162. Which HTML element is used to define a navigation link that points to the top of the page?
A) <a href="#"> B) <a href="/#"> C) <a href="javascript:void(0);"> D) <a href="index.html#top"> Answer: D (or A also works but D is explicit) Explanation: Using an anchor with a fragment identifier (#top) navigates to the element with id="top". Option A works but typically scrolls to top only when no fragment is present. Question 163. Which JavaScript operator is used to concatenate strings? A) + B) & C). D) concat() Answer: A Explanation: The + operator joins strings (and also performs numeric addition when both operands are numbers). Question 164. Which CSS property controls the order in which flex items are displayed, overriding the source order? A) order B) flex-order C) display-order D) position-order Answer: A
C) corner-radius D) table-roundness Answer: A Explanation: border-radius applies to any element, including table cells, rounding their corners. Question 168. Which HTML attribute on the <input type="range"> element defines the minimum selectable value? A) min B) start C) low D) from Answer: A Explanation: The min attribute sets the lowest value the slider can represent. Question 169. Which JavaScript syntax creates a promise that resolves with the value 42 after a 3 ‑second delay? A) new Promise(res => setTimeout(() => res(42), 3000)) B) Promise.resolve(42).delay(3000) C) setTimeout(() => Promise.resolve(42), 3000) D) async function(){ await 3000; return 42; } Answer: A Explanation: The executor receives the resolve function; setTimeout calls it after 3000 ms. Question 170. Which CSS selector matches any element that is the last child of its parent?
A) :last-child B) :last-of-type C) :nth-last-child(1) D) Both A and C are correct Answer: D Explanation: :last-child and :nth-last-child(1) target the same element. Question 171. Which HTML element is used to define a grouping of form controls for better accessibility? A) <fieldset> B) <formgroup> C) <section> D) <div> Answer: A Explanation: <fieldset> groups related controls and can contain a <legend> for description. Question 172. Which JavaScript method returns a string representation of an array’s elements separated by commas? A) array.toString() B) array.join() C) array.concat() D) Both A and B (join without arguments defaults to commas) Answer: D Explanation: Both toString and join (without a separator) produce a comma‑separated string.
Explanation: Both Array.isArray and instanceof Array correctly identify arrays; the third option can give false positives. Question 176. Which CSS property defines the space between columns in a multi‑column layout? A) column-gap B) column-spacing C) column-separator D) column-margin Answer: A Explanation: column-gap sets the gap between columns. Question 177. Which HTML element is used to provide a list of navigation links that are not part of the main site navigation? A) <aside> B) <nav> C) <section> D) <footer> Answer: A Explanation: <aside> holds tangential content, often including secondary navigation. Question 178. Which JavaScript method can be used to convert a NodeList to an Array without using Array.from? A) [].slice.call(nodeList) B) nodeList.toArray() C) nodeList.map()
D) nodeList.splice(0) Answer: A Explanation: Using Array.prototype.slice (or .call) on a NodeList creates a shallow array copy. Question 179. Which CSS property allows you to rotate an element 45 degrees clockwise? A) transform: rotate(45deg); B) rotate: 45deg; C) transform: rotateZ(45); D) orientation: 45deg; Answer: A Explanation: The rotate() function within transform takes an angle; 45deg rotates clockwise. Question 180. Which HTML element is used to embed a vector graphic directly in the markup? A) <svg> B) <canvas> C) <img> with src="image.svg" D) <object> with type="image/svg+xml" Answer: A Explanation: <svg> defines Scalable Vector Graphics inline. Question 181. Which JavaScript method removes the last element from an array and returns it? A) pop() B) shift() C) splice(-1,1)