Web-Development-Applications Exam Questions & Answers
WGU Web Development Applications (KVO1) • WGU
100% money-back guarantee
Sample Web-Development-Applications Questions
Practice with real exam-style questions, each with the verified correct answer and explanation.
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
A web designer inserts an image into a web page.
Which CSS attribute should this designer use to ensure that there is one of pixel of space between the line image and the surrounding elements?
To ensure that there is one pixel of space between the image and the surrounding elements, the margin property should be used.
CSS Margin Property: The margin property is used to create space around elements, outside of any defined borders.
Usage Example:
img {
margin: 1px;
}
In this example, the margin: 1px; rule sets a margin of 1 pixel around the image, creating the desired space.
MDN Web Docs on Margin
W3C CSS Specification on Margin
What should be used to request and Update data in the background?
AJAX (Asynchronous JavaScript and XML) is used to request and update data in the background without reloading the web page.
AJAX Overview:
Purpose: Allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes.
Benefits: Provides a smoother user experience by avoiding full page reloads.
Example:
Using XMLHttpRequest:
var xhr = new XMLHttpRequest();
xhr.open('GET', 'data.json', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
console.log(data);
}
};
xhr.send();
MDN Web Docs - AJAX
W3Schools - AJAX Introduction
What binds to an `` element and specifies a list of predefined choices?
> ''The `<datalist>` element contains a list of `<option>` elements that represent suggested options for an `<input>` element. When the input has a `list` attribute pointing to a `<datalist>`, users see a dropdown of predefined suggestions.''
Example:
```html
<input list='colors'>
<datalist id='colors'>
<option value='Red'>
<option value='Blue'>
</datalist>
```
* MDN Web Docs: datalist element
* HTML Living Standard: Forms elements
---
Which formats does the
Choose 2 answers.
The
WAV: Supported in all major browsers; uses PCM encoding and is uncompressed.
Ogg (Ogg Vorbis): An open-source, patent-free audio format. Supported in Firefox, Chrome, and Opera.
MP3: Widely supported but not included in this question.
M4A and MPEG-4 Audio may or may not play consistently depending on the container and encoding, but they're less standardized across all HTML5 implementations.
WMA (Windows Media Audio): Not supported by HTML5 natively and requires proprietary plugins.
''The audio element supports formats such as MP3, WAV, and Ogg, depending on the browser. Other formats like WMA and M4A are not guaranteed to work reliably.''
HTML5 Specification (Audio section)
MDN Web Docs --
W3Schools -- HTML5 Audio Tag
Get access to all 136 verified questions with detailed answers.
Unlock All Web-Development-Applications Questions