Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free WGU Web Development Foundations Web-Development-Foundation Exam Questions

Last updated: · 12 practice questions with answers and explanations

Page: 1 / 8 Total 77 questions

Want more questions? Get Premium Access.

Question 1

New Single answer

Topic: HTML

Skill tested: Applies semantic HTML elements and attributes to structure accessible page content.

A nonprofit is rebuilding its event page. The page has a site-wide navigation area, one prominent event heading, several paragraphs, and a related-information panel that can be understood independently of the main event description. The team wants the markup to express these roles clearly, rather than relying on generic containers and CSS classes. Which structure is most appropriate for the page content?

Correct Answer: C. Place the navigation in a , the event content in with an , and the independent panel in .
Explanation:

The landmarks describe the content's purpose: identifies navigation, contains the page's primary content, and is suitable for related content that is separate from the main narrative. An provides a real heading rather than merely visual emphasis. The other structures assign landmark elements roles that do not match their content, or use generic sections and bold text instead of appropriate heading semantics.

Question 2

New Single answer

Topic: HTML

Skill tested: Distinguishes document metadata in the head from rendered content in the body.

A small retailer is preparing a product page. Its browser tab must show the product name, the page must use UTF-8, and visitors must see a product heading and description. A developer placed all four items in the document but is unsure which belong in the head and which belong in the body. The page must remain a valid, conventional HTML document without using markup merely to make text appear in the tab. Which arrangement best meets the requirements?

Correct Answer: B. Put and a UTF-8 declaration in ; put the visible heading and description in .
Explanation:

The holds document metadata, including the page title and character-encoding declaration. The holds the content rendered as part of the page, such as the product heading and description. Putting visible content in the head or moving into the body confuses metadata with document content; placing everything in the head does not create the intended conventional page structure.

Question 3

New Single answer

Topic: HTML

Skill tested: Uses native form attributes to associate labels with controls and constrain input.

A clinic is adding a simple appointment request form. Each input must have a visible label that remains correctly associated with its control, and the email field must use browser-provided email input behavior. The developer wants to avoid relying on placeholder text as the only label and does not need custom JavaScript validation. Which implementation best satisfies the requirements?

Correct Answer: A. Give each input a unique id, set the corresponding to that id, and use type="email" for the email control.
Explanation:

A label's for attribute associates it with the form control whose id matches; unique IDs prevent ambiguous associations. The email control's type="email" provides the appropriate native input semantics and browser behavior without requiring custom validation code. A placeholder is not a substitute for a persistent label. Reusing an ID undermines reliable association, and a field name or legend does not perform the specified label-to-control association.

Question 4

New Single answer

Topic: XML

Skill tested: Creates well-formed XML using a single root and correctly nested, quoted markup.

A supplier sends a catalog fragment that must be accepted by a basic XML parser before it is transformed into the retailer's product data. The retailer requires one document root, matching start and end tags, properly nested elements, and quoted attribute values. The fragment does not need a schema or a particular data model beyond product entries. Which two fragments are well-formed XML? Select TWO.

Correct Answer: C. Desk
Explanation:

A has a single root, quoted attribute value, and properly nested matching tags. D also has one root and uses valid self-closing product elements with quoted attributes. B is malformed because XML attribute values must be quoted. C closes product before closing its nested name, violating proper nesting. E closes the root before the second product, leaving that product outside the single root element.

Question 5

New Multiple answers

Topic: XML

Skill tested: Maps repeated XML elements to collections and nested elements to structured data.

An inventory integration receives XML with one root, several repeated elements, and each item containing an and . A downstream application uses ordinary data structures: a list of item records, with each record holding a string SKU and an integer quantity. The integration must preserve the repeated entries and their field groupings; flattening everything into one text string would lose the relationships. Which two mappings best preserve the document's structure? Select TWO.

Correct Answer: A. Represent each as one record or object containing its and fields.; E. Represent all elements as a list or array of item records.
Explanation:

Each repeated is one logical entity, so its child elements belong together in a record or object. Because multiple items may occur under the root, the collection of those records maps naturally to a list or array. Parallel unassociated lists can lose which quantity belongs to which SKU. Treating the document as opaque text discards its structure, while keeping only the first item loses valid repeated data.

Question 6

New Single answer

Topic: XML

Skill tested: Distinguishes XML well-formedness from application-specific schema validation.

A publisher's feed importer successfully parses an XML file, but a business rule requires every to contain exactly one and a numeric . The current document has well-matched tags and a single root, but one book has no price. The publisher asks whether adding an XML declaration alone will make the parser reject this file. What is the most accurate response?

Correct Answer: A. No; well-formedness checks syntax, while a schema or application-level validation must enforce the required title and price constraints.
Explanation:

Well-formedness concerns XML syntax, such as correct nesting, matching tags, and a single root. It does not, by itself, impose an application's required elements, occurrence counts, or data types. A schema or explicit application-level validation can check the title and price requirements. An XML declaration identifies aspects of the document but does not automatically add these business rules; having a root also does not guarantee required children.

Question 7

New Single answer

Topic: Cascading Style Sheets (CSS)

Skill tested: Calculates the CSS box model dimensions for content-box and border-box sizing.

A designer specifies a card whose CSS width must occupy exactly 320 CSS pixels, including its padding and border. The card has 20 pixels of padding on each side and a 2-pixel border on each side. The stylesheet currently uses the default box-sizing behavior, so the rendered outer width exceeds the design specification. The team wants the width declaration itself to remain 320 pixels and does not want to change the padding or border. Which change best meets the requirement?

Correct Answer: A. Set box-sizing: border-box on the card.
Explanation:

With border-box, the declared 320-pixel width includes the content, padding, and border, so the outer width remains 320 pixels. Under the default content-box model, padding and border are added to the declared content width, producing an outer width of 364 pixels. Reducing the content-box width to 276 pixels could yield the same outer width, but it violates the requirement that the width declaration stay 320. Margins affect space outside the box, not its outer width.

Question 8

New Single answer

Topic: Cascading Style Sheets (CSS)

Skill tested: Chooses selectors that target elements by class without unintended structural coupling.

A content team maintains a page with several reusable callout panels. Each callout must receive the same border and spacing, including panels that may be inserted at different nesting levels later. The existing markup assigns class="callout" to each panel, while some panels are nested in articles and others are not. The developer wants one maintainable rule that targets only those panels and does not depend on their parent element or their position among siblings. Which selector is the best fit?

Correct Answer: B. .callout
Explanation:

The class selector .callout directly targets elements marked for the reusable callout role, regardless of their nesting depth or sibling position. The child and descendant selectors tied to article depend on structure and may miss panels elsewhere or style unrelated divs. The first-child selector depends on sibling order rather than the intended meaning. A semantic class-based selector therefore remains stable as the page structure changes.

Question 9

New Multiple answers

Topic: Cascading Style Sheets (CSS)

Skill tested: Builds responsive layouts with flexible sizing and media queries at content-driven breakpoints.

A community organization has a two-column directory layout that works on wide screens but becomes cramped on phones. The layout must keep columns side by side when there is enough room, switch to one column when the available width is too narrow, and avoid fixed pixel widths that cause horizontal overflow. The team can use common CSS layout properties and media queries, but it does not want separate markup for mobile. Which two approaches best satisfy these requirements? Select TWO.

Correct Answer: A. Use percentage or flexible column sizing and a media query to stack the columns at a suitable breakpoint.; D. Use a flexible layout such as CSS Grid with fractional columns, then change the column count in a media query when the content no longer fits.
Explanation:

Flexible grid tracks or percentage-based sizing let columns adapt to the available space, while a media query can stack them when the viewport or content width calls for it. The breakpoint should reflect when the layout ceases to work, rather than relying on fixed desktop dimensions. Fixed widths with hidden overflow conceal content instead of making it responsive. A fixed-width transformed page remains awkward to read, and duplicate markup adds unnecessary maintenance.

Question 10

New Multiple answers

Topic: Troubleshooting with Developer Tools and IDEs

Skill tested: Uses browser inspection tools to trace computed styles and identify cascade conflicts.

After deploying a page, a developer sees that a navigation link remains blue even though the stylesheet contains a rule setting navigation links to dark green. The stylesheet appears to load, and other declarations from it take effect. The developer must find the cause before editing production files and wants evidence about the element's actual styles and the rule that wins. Which two browser developer-tools actions are most useful? Select TWO.

Correct Answer: A. Review the Computed panel for the final color and the source rule responsible for it.; D. Inspect the link and review the Styles panel to see matching rules and which declarations are overridden.
Explanation:

The Styles panel shows selectors that match the inspected link and indicates overridden declarations, exposing cascade conflicts such as specificity or source order. The Computed panel confirms the final rendered color and can identify its contributing source rule. Repeated cache clearing does not explain a rule conflict when the stylesheet is already applying. Changing text cannot resolve CSS precedence, and file size in the Network panel reveals nothing about which matching declaration wins.

Question 11

New Single answer

Topic: Troubleshooting with Developer Tools and IDEs

Skill tested: Uses the browser console to locate runtime errors that interrupt page behavior.

A product page renders its HTML and CSS, but clicking the image gallery's next button does nothing. The developer has confirmed that the button exists in the DOM and that its stylesheet is loaded. A teammate recently changed the gallery script, and no visible error is shown on the page. What should the developer do first to investigate the likely cause using browser developer tools?

Correct Answer: C. Open the Console, reproduce the click, and inspect any reported JavaScript errors and their source locations.
Explanation:

Reproducing the failure while monitoring the Console is an efficient first step because a runtime error may identify the failing script and line, especially after a script change. The confirmed DOM presence and loaded styles make an immediate markup or styling rewrite less justified. Changing the button's color does not establish whether its handler runs, and the document title has no role in click-event handling.

Question 12

New Single answer

Topic: Troubleshooting with Developer Tools and IDEs

Skill tested: Diagnoses incorrect stylesheet paths by comparing IDE files with browser network requests.

A developer previews a page from an IDE. The HTML is displayed, but none of its custom styles appear. The stylesheet file exists in the project, and the link element is present in the document head. In the browser's Network panel, the stylesheet request returns a not-found response. The project stores the HTML file in a pages folder and the CSS file in a sibling assets folder. What is the most appropriate next action?

Correct Answer: D. Inspect and correct the relative href so it resolves from the HTML file's location to the CSS file, then reload and verify the request.
Explanation:

A not-found response indicates that the browser cannot retrieve the stylesheet at the URL produced by the link's href. Because relative URLs resolve from the HTML document's location, the developer should correct the path and verify the subsequent request. Selector specificity only matters after CSS has been loaded. A title element is metadata, not a stylesheet container, and !important cannot compensate for a missing file.