A web designer writes the following CSS3 style: @keyframes image { from { opacity: 0.0; } to { opacity: 1.0; } } img { animation-name: image; animation-duration: 5s; } How do images on the page appear after the page loads?
-
A
Invisible, and then they appear immediately after five seconds
-
B
Visible, and then they gradually disappear over a five-second interval
-
C
Visible, and then they disappear immediately after five seconds
-
D
Invisible, and then they gradually appear over a five-second interval
Reveal answer details
Close answer details
Correct answerD
ExplanationOpacity begins at 0.0, which makes each image invisible, and ends at 1.0, which makes it fully visible. The animation duration is five seconds, so the browser interpolates between those values throughout that interval. The images therefore gradually appear over five seconds rather than changing only at the end.
Essential menu items currently appear only when a user hovers over a small icon. Which redesign supports keyboard, pointer, and touch users?
-
A
Keep hover and add a touchstart-only handler.
-
B
Enlarge the hover region and remove keyboard focus.
-
C
Use a semantic button with activation, focus, and a usable target size.
-
D
Inspect the user-agent string and create separate menus.
Reveal answer details
Close answer details
Correct answerC
ExplanationA semantic button supplies an interactive control that can receive focus and supports standard keyboard activation as well as pointer and touch input. Providing a usable target size also makes activation practical without requiring precise hovering. This design exposes the menu through a persistent control instead of a hover-only interaction.
Which History API object is called when a browser window's document history changes?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe window.onpopstate event-handler property is called when navigation activates a different entry in the current document's session history. Code assigned to it can respond to backward or forward history movement. Window.location identifies the current location, while window.open creates or accesses a browsing context.
What does a computer use to read and execute JavaScript code?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationAn interpreter processes JavaScript instructions and carries out their behavior in the execution environment. This is the role needed to read the program and run its statements. A compiler translates code into another form, while a validator merely checks whether code conforms to expected syntax or rules.
Given the following HTML code:  Which line of code should replace the first line to ensure that users can pause and restart the video?
-
A
<video width="360" height="270" autoplay>
-
B
<video width="360" height="270" controls>
-
C
<video width="360" height="270" loop>
-
D
<video width="360" height="270" poster>
Reveal answer details
Close answer details
Correct answerB
ExplanationAdding the controls Boolean attribute to <video width="360" height="270" controls> makes playback controls available to the user. Those controls provide the actions needed to pause the current playback and start it again. The other attributes govern automatic playback, repetition, or a poster image rather than exposing interactive playback controls.
The page must stop known-invalid submissions, but values can change after edit-time checks and crafted requests can bypass the page. Which validation plan meets both requirements?
-
A
Trust the earlier field checks for every later submission.
-
B
Validate on submission and mark the request as server-approved.
-
C
Validate only on the server after allowing every browser submission.
-
D
Recheck on submission and independently validate on the server.
Reveal answer details
Close answer details
Correct answerD
ExplanationRechecking in the browser at submission time catches values that changed after earlier edit-time checks and stops known-invalid submissions. Server validation must still run independently because a crafted request can bypass all page logic. The two checks cover different boundaries: immediate browser feedback and authoritative request handling.
Which markup ensures that the data entered are either a five-digit ZIP code or an empty string?
-
A
`<input class="[0-9]{5}">`
-
B
`<input type="number" value="5">`
-
C
`<input required min="5" max="5">`
-
D
`<input pattern="\d{5}">`
Reveal answer details
Close answer details
Correct answerD
ExplanationThe pattern attribute applies a regular expression to the input value. In \d{5}, \d represents a digit and {5} requires exactly five occurrences, so a nonempty accepted value has five digits. Because the input does not have required, an empty value is also permitted.
In what order are the values printed? Code: let status = "starting"; Promise.resolve("ready").then(value => { status = value; console.log(status); }); console.log(status);
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationThe final console.log(status) runs synchronously after the Promise callback is scheduled, so it reads the initial value and prints starting. The then callback runs afterward as a queued Promise reaction, changes status to ready, and prints the updated value. The order is starting, then ready.
What color is the paragraph text under these rules? Markup: <p id="note" class="alert">Notice</p> CSS: p { color: black !important; } #note { color: red; } .alert { color: blue !important; }
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationDeclarations marked !important take precedence over ordinary declarations, so the red id rule is excluded despite its high specificity. The remaining important rules are the black type selector and blue class selector. Because a class selector is more specific than a type selector, the paragraph text is blue.
Question 10
Single choice
Which code segment places text to the right of an image whose file name is `blue.png`?
-
A
`<img src="/vcedump/questions/original/blue.png/images" style="float: left; margin: 5px;" />`
-
B
`<img src="/vcedump/questions/original/images/blue.png" style="float: left; margin: 5px;" />`
-
C
`<img src="/vcedump/questions/original/images/blue.png" style="float: right; margin: 5px;" />`
-
D
`<img src="/vcedump/questions/original/blue.png/images" style="float: right; margin: 5px;" />`
Reveal answer details
Close answer details
Correct answerB
ExplanationThe <img src="/vcedump/questions/original/images/blue.png" style="float: left; margin: 5px;" /> segment gives the img element the correct src path to the blue.png file in the images directory. Its style floats the image left, allowing following text to flow on the right, and the margin adds separation around the image.
Question 11
Single choice
Which global attribute prepares an element for input when a page loads?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationThe autofocus attribute requests that an eligible element receive input focus automatically when the page loads. This prepares the control for immediate keyboard entry without requiring the user to select it first. The required attribute governs whether a value must be supplied, not which element initially receives focus.
Question 12
Single choice
A web designer evaluates the following CSS rule: .head { color: #0000ff; } Which element is selected as a result?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationIn CSS, a selector beginning with a period selects elements by class name. Therefore, .head matches the div carrying class="head" and applies the blue color declaration to it. A head type selector would omit the period, while an element with id="head" would be selected with a number sign.
Question 13
Single choice
What binds to an `<input>` element and specifies a list of predefined choices?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationA <datalist> defines predefined choices that can be associated with an <input>. The input's list attribute refers to the datalist's id, and option elements provide the suggested values. This preserves a text-entry control while presenting the user with a list of available choices.
Question 14
Single choice
Dashboard cards must align to shared rows and columns, with both track sizes controlled explicitly. Which layout system directly models this requirement?
-
A
CSS Grid with row and column tracks
-
B
Flexbox in a wrapping row
-
C
Absolute positioning from the viewport
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationCSS Grid is a two-dimensional layout system: it defines row tracks and column tracks within the same grid. Cards can therefore align to shared boundaries in both directions while each track's size is explicitly controlled. A wrapping flex row primarily distributes items along one dimension and does not directly establish shared row and column tracks.
Question 15
Single choice
Given the following HTML:
```html
<div class="example">Example</div>
```
And the style:
.example {background: red;
}Which line of code changes the background color of the `<div>` when the width is between 600 and 900 pixels or more than 1,100 pixels?
-
A
@media screen and (max-width: 1100px) and (min-width: 600px) { div.example { background: yellow; } }
-
B
@media screen and (max-width: 900px) and (min-width: 600px), (min-width: 1100px) { div.example { background: yellow; } }
-
C
@media screen and (max-width: 900px) and (min-width: 600px) { div.example { background: yellow; } }
-
D
@media screen and (max-width: 900px) and (min-width: 600px), (max-width: 1100px) { div.example { background: yellow; } }
Reveal answer details
Close answer details
Correct answerB
ExplanationA comma separates two media queries and acts as an OR. The first query uses screen with min-width: 600px and max-width: 900px, covering the bounded interval. The second uses min-width: 1100px, covering the upper range; either match changes the example div's background.
Question 16
Single choice
Which application programming interface (API) should a developer use to store data on a user's local device?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe File system API is intended to create and manage file-based data on the user's local device. That directly addresses persistent local storage of application data. The History API manages navigation history, Canvas draws graphics, and drag and drop governs user interaction rather than providing a local data store.
Question 17
Single choice
Which 3D transform affects the distance between the z-plane and the user?
-
A
matrix3d(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16)
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe perspective(n) transform establishes the viewing distance between the user and the z-plane. Changing that distance changes how strongly depth is perceived: a shorter perspective distance produces a more pronounced 3D effect, while a longer distance appears flatter. Rotation changes orientation, and Y scaling changes vertical size rather than viewing distance.
Question 18
Single choice
What does declaring <! DOCTYPE html> indicate to the browser?
-
A
The code is written in HTML4.
-
B
The code is written in HTML5.
-
C
The file extension is HTML4.
-
D
The file extension is HTML5.
Reveal answer details
Close answer details
Correct answerB
ExplanationThe declaration <!DOCTYPE html> identifies the document as HTML5 and tells the browser to interpret it using standards mode. It describes the markup language expected in the document; it does not set or report a filename extension. The shorter HTML doctype is the form associated with HTML5 code.
Question 19
Single choice
Given the following code: What does the console display as output?
-
A
-
B
-
C
Reveal answer details
Close answer details
Correct answerB
ExplanationBoth a and b are assigned quoted values, so they hold strings rather than numbers. With string operands, the plus operator performs concatenation: the characters "8" are followed by "6". Variable c consequently contains "86", which is what the console displays.
Question 20
Single choice
Which language should a developer use to create a border with rounded corners on a web page using in-line markup?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationCSS3 provides the border-radius property used to round an element's corners. It can be placed directly in an element's style attribute when inline styling is required. HTML5 supplies page structure, while CSS controls visual properties such as borders and corner shape.
Question 21
Single choice
Which code segment creates a slider field that accepts a numeric value ranging from 1 through 10?
-
A
`<input type="range" name="sat-level" max="10">`
-
B
`<input type="range" name="sat-level" min="1" max="10">`
-
C
`<input type="number" name="sat-level" min="1" max="10">`
-
D
`<input type="number" name="sat-level" max="10">`
Reveal answer details
Close answer details
Correct answerB
ExplanationA slider is created by an <input> whose type is range. In <input type="range" name="sat-level" min="1" max="10">, min establishes the lower bound and max establishes the upper bound. The name sat-level identifies the field when its value is submitted.
Question 22
Single choice
Which technique should a developer use for text-based hyperlink on mobile web page?
-
A
Padding the clickable area around the link
-
B
-
C
Deploying graphical links
-
D
Using dynamic page elements neat the link
Reveal answer details
Close answer details
Correct answerA
ExplanationTouch input is less precise than a mouse pointer, so a text link needs a sufficiently large target. Padding the clickable area around the link enlarges the region that responds to a tap without requiring larger link text. This makes the hyperlink easier to activate accurately on a mobile screen.
Question 23
Single choice
Which of the following is considered a best practice when designing a mobile website?
-
A
Access to multiple link layers
-
B
Targeted site content
-
C
A link to the full site
-
D
Navigation links requiring scrolling
Reveal answer details
Close answer details
Correct answerC
ExplanationA mobile presentation may simplify or omit material to fit a smaller screen. Providing a link to the full site preserves a path to content or capabilities that are not included in that streamlined presentation. Users can therefore choose the mobile experience for convenience without being prevented from reaching the complete site when their task requires it.
Question 24
Single choice
What should a developer correct before revalidating after a code validator reports multiple errors in code?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationThe first reported error should be corrected before validation is run again because an early syntax or structural problem can cause the validator to misinterpret later code. That single defect may generate several secondary messages. Fixing it first and revalidating reveals which later reports represent independent problems.
Question 25
Single choice
One canvas shape must be rotated, but the next shape must use the original coordinate system. Which sequence isolates the transformation?
-
A
beginPath(), rotate(), draw, closePath(), draw
-
B
save(), rotate(), draw, restore(), draw
-
C
rotate(), draw, fill(), draw
-
D
rotate(), draw, beginPath(), draw
Reveal answer details
Close answer details
Correct answerB
Explanationsave() records the canvas context state, including its current transformation. After rotate(), the first drawing uses the rotated coordinate system. restore() reinstates the saved state and removes that rotation's effect, allowing the following drawing to use the original coordinate system.
|