10 exam-style questions with answers and explanations, straight from our 1,030-question bank. Tap an answer to check yourself. When you're ready, take the scored version in the free practice test.
The CHS-WDEV1 exam has 45 questions and runs 1 hours 30 minutes.
These 10 free CHS-WDEV1 questions are organized by exam domain, so you can see how each part of the CodeHS Web Development Level 1 blueprint is tested. Reveal the answer and explanation under each question.
Domain 1: JavaScript in HTML
Question 1
A reservation button contains a label. A developer attaches this listener after the markup has loaded:
<button id="reserve" type="button"><span id="label">Reserve</span></button>
<p id="trace"></p>
const button = document.getElementById("reserve");
const trace = document.getElementById("trace");
button.addEventListener("click", function (event) {
trace.textContent = this.id + " / " + event.target.id;
});
A user clicks directly on the span. No other listeners are present. What appears in the paragraph?
Show answer & explanation
Correct answer: B - reserve / label
Question 2
Two external classic scripts will be placed in the document head, before <p id="status"></p>. Both files load successfully and contain exactly the code shown.
labels.js:
function readyText() { return "Ready"; }
app.js:
document.getElementById("status").textContent = readyText();
The files must download while HTML parsing continues, then execute only after the paragraph exists, with the function available before it is called. Select the script pair that provides those guarantees.
Show answer & explanation
Correct answer: D - <script defer src="labels.js"></script>
<script defer src="app.js"></script>
Question 3
An editor expects a draft title change to leave the published title untouched:
const published = { title: "Spring Fair" };
const draft = published;
draft.title = "Summer Fair";
const displayedTitle = published.title;
What does displayedTitle contain, and why?
Show answer & explanation
Correct answer: A - "Summer Fair", because both variables refer to the same object.
Question 4
Visitors can suggest an event title. The title is untrusted plain text: entering <b>Open day</b> must display the angle brackets rather than create bold formatting. In the browser, titleText contains the submitted string and titleElement is the existing <h2> that must display it. Choose the operation that displays the submitted characters without interpreting them as HTML.
Show answer & explanation
Correct answer: C - Assign titleText to titleElement.textContent.
Domain 2: jQuery
Question 5
A task list's existing Archive button works, but an identical button added later inside #tasks does not. This setup runs once after the markup exists, using full jQuery 3.7.1:
<div id="tasks"><button class="archive" type="button">Archive</button></div>
function archive() {
$(this).text("Archived");
}
$("#tasks .archive").on("click", archive);
Replace the registration statement so a click changes the clicked button's label, including for buttons added later, without registering another listener after insertion.
Show answer & explanation
Correct answer: D - $("#tasks").on("click", ".archive", archive);
Question 6
A product card is partway through a width animation, with two more effects waiting in its fx queue. The site uses full jQuery 3.7.1, and $card contains that single element. A Cancel action must leave the card at its current intermediate width and prevent either waiting effect from starting. No other code changes the card or its queue. What call belongs in the Cancel handler?
Show answer & explanation
Correct answer: A - $card.stop(true, false);
Domain 3: Storing and Collecting Data
Question 7
A browser submits the entire form below using ordinary HTML form submission. No scripts or user edits change the controls, and validation succeeds.
<form action="/register" method="post">
<input type="text" id="displayName" value="Mina">
<input type="text" name="ticket" value="C14" readonly>
<input type="text" name="discount" value="STUDENT" disabled>
<input type="checkbox" name="updates" value="yes" checked>
<button type="submit">Register</button>
</form>
Which name/value pairs are included in the request body?
Show answer & explanation
Correct answer: A - ticket=C14&updates=yes
Question 8
A missing event is requested from an API. The browser's Network panel shows HTTP 404, with no network failure. Nevertheless, the page displays "Loaded" after this code runs:
<p id="status">Loading</p>
const status = document.getElementById("status");
fetch("/api/events/99")
.then(function (response) {
status.textContent = "Loaded";
})
.catch(function () {
status.textContent = "Unavailable";
});
The paragraph exists before the script runs. What explains the mismatch between the HTTP status and the displayed message?
Show answer & explanation
Correct answer: B - fetch() can fulfill for HTTP errors; this handler never checks response.ok.
Domain 4: How to Build and Maintain a Website
Question 9
A photographer's portfolio consists of HTML, CSS, JavaScript, and photographs. All filtering and animation run in the visitor's browser. There are no accounts, uploads, submitted forms, or server-side scripts. A proposed static-hosting plan serves these files over HTTPS and supports the photographer's domain. Which deployment decision meets these requirements without adding unnecessary infrastructure?
Show answer & explanation
Correct answer: C - Publish on the static plan; the browser will execute the gallery's JavaScript.
Question 10
Two campaigns send visitors to the same registration page. A session can contain more than one registration.
Campaign A: 480 eligible sessions; 36 confirmed registrations; 24 sessions containing at least one confirmed registration.
Campaign B: 300 eligible sessions; 27 confirmed registrations; 21 sessions containing at least one confirmed registration.
The team measures session conversion: the percentage of eligible sessions containing at least one confirmed registration, counting each session once. Based only on this observed measure, which statement belongs in the results summary?
Show answer & explanation
Correct answer: C - B led on this measure: 7.0% versus A's 5.0%.
That's 10 of 1,030
The full bank has 1,020 more CHS-WDEV1 questions with explanations.