WGU C777 PA Exam – 100 Questions &
Answers Exam Bank (Latest Updated with
Detailed Solutions)
Document 2: WGU C777 PA Exam – 100
Questions & Answers Exam Bank
Instructions: This practice exam contains 100 questions covering key concepts in web development
technologies, including HTML5, CSS3, JavaScript, and responsive design. Select the best answer. Answers
are in bold and rationales are in italic.
1. Which HTML5 element is used to define navigation links?
A) <header>
B) <nav>
C) <footer>
D) <section>
Answer: B
Rationale: The <nav> element is specifically designed to define a set of navigation links, typically a menu
or table of contents. <header> is for introductory content, <footer> is for footer content,
and <section> defines a thematic grouping of content.
2. Which CSS property is used to change the background color of an element?
A) color
B) background-color
C) bgcolor
D) font-style
Answer: B
Rationale: The background-color property sets the background color of an element. The color property
sets the text color. bgcolor is an outdated HTML attribute, and font-style controls the style of the font
(e.g., italic).
3. Which JavaScript method is used to write content directly to the HTML document?
A) console.log()
B) window.alert()
C) document.write()
D) document.getElementById()
,Answer: C
Rationale: The document.write() method is used to write HTML expressions or JavaScript code directly to
the HTML document. console.log() writes to the browser console, window.alert() creates a pop-up alert
box, and document.getElementById() is used to select an element.
4. What does the CSS display: flex; property do?
A) It hides the element from the page.
B) It enables a flexible box layout model for the container.
C) It makes the element a block-level element.
D) It sets the element's font to flex.
Answer: B
Rationale: The display: flex; property defines a flex container, enabling the flexible box layout model
(Flexbox), which allows for responsive and efficient arrangement of items within the container.
5. Which HTML5 element is used to represent a piece of content that is slightly different from the
surrounding content, like a sidebar or a quote?
A) <article>
B) <aside>
C) <main>
D) <div>
Answer: B
Rationale: The <aside> element represents content that is tangentially related to the main content, such
as sidebars, pull quotes, or advertising. <article> is for self-contained compositions, <main> is for the
dominant content, and <div> is a generic container.
6. What is the correct JavaScript syntax to change the content of an HTML element with id="demo"?
A) document.getElementById("demo").innerHTML = "Hello World!";
B) document.getElementByName("demo").innerHTML = "Hello World!";
C) #demo.innerHTML = "Hello World!";
D) document.querySelector("#demo").textContent = "Hello World!"; (Both A and D are correct, but A is
the most classic)
Answer: A
Rationale: The standard method to access and modify an element by
its id is document.getElementById("id"). Both A and D are technically correct, but A is the most
commonly taught and accepted answer for this classic question. textContent would also work,
but innerHTML is the classic choice.
7. Which CSS property is used to control the space between the border and the content of an
element?
A) margin
, B) padding
C) border-spacing
D) outline
Answer: B
Rationale: The padding property creates space between the element's content and its
border. margin creates space outside the border. border-spacing is for table cells, and outline is a line
drawn outside the border.
8. What does the HTML <canvas> element do?
A) It creates a container for SVG graphics.
B) It provides a bitmap drawing surface for JavaScript.
C) It embeds a video file.
D) It defines a table.
Answer: B
Rationale: The <canvas> element creates a blank drawing surface that can be manipulated using
JavaScript to render graphics, animations, and other visual content. It is a bitmap-based drawing area.
9. In CSS, what is the purpose of a media query?
A) To apply styles based on the media type (e.g., screen, print) and specific characteristics (e.g., screen
width).
B) To query the user for their media preferences.
C) To embed audio files into a webpage.
D) To define the character set of the document.
Answer: A
Rationale: Media queries are a cornerstone of responsive web design. They allow you to conditionally
apply CSS styles based on the device's characteristics, such as viewport width, height, orientation, and
resolution.
10. Which JavaScript event occurs when a user clicks on an element?
A) onmouseover
B) onchange
C) onclick
D) onload
Answer: C
Rationale: The onclick event is triggered when the user clicks on an HTML element. onmouseover fires
when the mouse hovers over an element. onchange fires when the value of an input changes,
and onload fires when the page or an image has finished loading.
11. What is the default value of the CSS position property?
A) relative
Answers Exam Bank (Latest Updated with
Detailed Solutions)
Document 2: WGU C777 PA Exam – 100
Questions & Answers Exam Bank
Instructions: This practice exam contains 100 questions covering key concepts in web development
technologies, including HTML5, CSS3, JavaScript, and responsive design. Select the best answer. Answers
are in bold and rationales are in italic.
1. Which HTML5 element is used to define navigation links?
A) <header>
B) <nav>
C) <footer>
D) <section>
Answer: B
Rationale: The <nav> element is specifically designed to define a set of navigation links, typically a menu
or table of contents. <header> is for introductory content, <footer> is for footer content,
and <section> defines a thematic grouping of content.
2. Which CSS property is used to change the background color of an element?
A) color
B) background-color
C) bgcolor
D) font-style
Answer: B
Rationale: The background-color property sets the background color of an element. The color property
sets the text color. bgcolor is an outdated HTML attribute, and font-style controls the style of the font
(e.g., italic).
3. Which JavaScript method is used to write content directly to the HTML document?
A) console.log()
B) window.alert()
C) document.write()
D) document.getElementById()
,Answer: C
Rationale: The document.write() method is used to write HTML expressions or JavaScript code directly to
the HTML document. console.log() writes to the browser console, window.alert() creates a pop-up alert
box, and document.getElementById() is used to select an element.
4. What does the CSS display: flex; property do?
A) It hides the element from the page.
B) It enables a flexible box layout model for the container.
C) It makes the element a block-level element.
D) It sets the element's font to flex.
Answer: B
Rationale: The display: flex; property defines a flex container, enabling the flexible box layout model
(Flexbox), which allows for responsive and efficient arrangement of items within the container.
5. Which HTML5 element is used to represent a piece of content that is slightly different from the
surrounding content, like a sidebar or a quote?
A) <article>
B) <aside>
C) <main>
D) <div>
Answer: B
Rationale: The <aside> element represents content that is tangentially related to the main content, such
as sidebars, pull quotes, or advertising. <article> is for self-contained compositions, <main> is for the
dominant content, and <div> is a generic container.
6. What is the correct JavaScript syntax to change the content of an HTML element with id="demo"?
A) document.getElementById("demo").innerHTML = "Hello World!";
B) document.getElementByName("demo").innerHTML = "Hello World!";
C) #demo.innerHTML = "Hello World!";
D) document.querySelector("#demo").textContent = "Hello World!"; (Both A and D are correct, but A is
the most classic)
Answer: A
Rationale: The standard method to access and modify an element by
its id is document.getElementById("id"). Both A and D are technically correct, but A is the most
commonly taught and accepted answer for this classic question. textContent would also work,
but innerHTML is the classic choice.
7. Which CSS property is used to control the space between the border and the content of an
element?
A) margin
, B) padding
C) border-spacing
D) outline
Answer: B
Rationale: The padding property creates space between the element's content and its
border. margin creates space outside the border. border-spacing is for table cells, and outline is a line
drawn outside the border.
8. What does the HTML <canvas> element do?
A) It creates a container for SVG graphics.
B) It provides a bitmap drawing surface for JavaScript.
C) It embeds a video file.
D) It defines a table.
Answer: B
Rationale: The <canvas> element creates a blank drawing surface that can be manipulated using
JavaScript to render graphics, animations, and other visual content. It is a bitmap-based drawing area.
9. In CSS, what is the purpose of a media query?
A) To apply styles based on the media type (e.g., screen, print) and specific characteristics (e.g., screen
width).
B) To query the user for their media preferences.
C) To embed audio files into a webpage.
D) To define the character set of the document.
Answer: A
Rationale: Media queries are a cornerstone of responsive web design. They allow you to conditionally
apply CSS styles based on the device's characteristics, such as viewport width, height, orientation, and
resolution.
10. Which JavaScript event occurs when a user clicks on an element?
A) onmouseover
B) onchange
C) onclick
D) onload
Answer: C
Rationale: The onclick event is triggered when the user clicks on an HTML element. onmouseover fires
when the mouse hovers over an element. onchange fires when the value of an input changes,
and onload fires when the page or an image has finished loading.
11. What is the default value of the CSS position property?
A) relative