Key details for this exam, checked against the published exam outline
Each question shows the correct answer and an explanation of why it is right
Which History API object is called when a browser window's document history changes?
The onpopstate event is triggered in the window object when the active history entry changes, such as when the user navigates to a different page using the back or forward buttons in the browser.
History API and onpopstate:
Event: window.onpopstate
Description: This event is fired when the user navigates to a session history entry, i.e., when moving backwards or forwards in the browser history.
Example:
window.onpopstate = function(event) {
console.log('location: ' + document.location + ', state: ' + JSON.stringify(event.state));
};
Other Options:
A . Window, location: location is an object containing information about the current URL.
C . Window, name: name is a property to set or get the name of a window.
D . Window, open: open is a method to open a new browser window or tab.
MDN Web Docs - window.onpopstate
W3Schools - JavaScript History API
Given the following code:
![]()
Which type of user input does the developer request by specifying the pattern attribute?
The pattern attribute in the <input> element is used to specify a regular expression that the input's value must match for it to be considered valid. The given pattern -?\d{1,3}\.\d+ matches strings that represent decimal numbers with an optional negative sign, typically used for latitude and longitude values.
Pattern
-? allows for an optional negative sign.
\d{1,3} matches one to three digits.
\. matches a literal dot.
\d+ matches one or more digits.
Usage Example:
<input type='text' pattern='-?\d{1,3}\.\d+' placeholder='Enter latitude or longitude'>
This pattern ensures the input matches the format of latitude/longitude values.
MDN Web Docs on <input> pattern attribute
Regular Expressions Documentation
What represents the value of the pattern attribute of an input element in an HTML
The value of the pattern attribute in an input element is a regular expression. This regular expression is used to define what constitutes a valid value for the input.
Regular Expressions: Regular expressions (regex) are sequences of characters that define search patterns. They are commonly used for string matching and validation.
Usage Example:
<input type='text' pattern='\d{5}' placeholder='Enter a 5-digit number'>
Here, the pattern attribute value is a regular expression that validates a five-digit number.
MDN Web Docs on pattern
Regular Expressions Documentation
Given the following HTML:
```html
```
And the style:
```css
.example {
background: red;
}
```
Which line of code changes the background color of the `
> ''To apply styles at two distinct ranges (600--900px AND greater than 1100px), use two media queries separated by a comma. This results in a logical OR operation.''
>
> `@media (min-width: 600px) and (max-width: 900px), (min-width: 1100px)` is the correct logic.
* MDN Web Docs: Media Query Syntax and Multiple Conditions
* CSS Media Query Specification
---
Given the following code:

What is occurring?
The given code snippet demonstrates how JavaScript can manipulate the DOM to change the style of an element.
Code Analysis:
Given the HTML:
<h1 id='id1'>Blog Title</h1>
<button type='button' onclick='document.getElementById('id1').style.color = 'red''>Click Here</button>
When the button is clicked, the JavaScript code within the onclick attribute changes the color of the h1 element to red.
Option A: An event handler tracking keyboard strokes is incorrect because the event handler is tracking a mouse click, not keyboard strokes.
Option B: JavaScript is using the DOM to make a style change is correct because the onclick attribute contains JavaScript code that modifies the style of the h1 element.
Option C: In-line CSS is styling the <h1> tag is incorrect because the style change is done via JavaScript, not inline CSS.
MDN Web Docs - Document.getElementById()
W3Schools - JavaScript HTML DOM
136 questions covering all exam domains, starting from $20
4 domains from the WGU Web-Development-Applications exam outline, with approximate weightings. Every sample question above is tagged with the domain it comes from
Check code accuracy and test page performance. Build functional web forms with proper markup validation and inline error checking.
Make websites display correctly across all devices from desktops to mobile phones. Adjust layouts and maintain visual consistency across screen sizes.
Create properly structured pages with modern visual styling and basic interactivity. Build functional and standards-aligned web content with these three core technologies.
Create layouts that respond effectively to browser changes and mobile environments. Build designs that function well across all modern devices and applications.
Common questions about the exam itself