Docsity

WGU C777 Web Development Applications OA HTML5, CSS3, JavaScript, DOM and Web APIs, Exams of Web Application Development

Partial preview of the text

Download WGU C777 Web Development Applications OA HTML5, CSS3, JavaScript, DOM and Web APIs and more Exams Web Application Development in PDF only on Docsity!

PRACTICE QUESTION BANK

WGU C777 Web Development

Applications OA

HTML5, CSS3, JavaScript, DOM and Web APIs

Multiple-Choice Questions with Answers plus Rationale

Question 1 Which HTML5 element is used to define the main navigation links of a page? A. B. C. D. Correct Answer: D. Rationale: The element is the semantic container for major navigation blocks. Question 2 Which HTML5 element represents self-contained content such as a blog post? A. B. C. D. Correct Answer: B. Rationale: is for independently distributable content.

Question 5 Which element is used to include an image with alternative text? A. B. C. D. Correct Answer: C. Rationale: The alt attribute provides text for accessibility and failed loads. Question 6 Which attribute makes an HTML form field required before submission? A. required B. mandatory C. validate D. needed Correct Answer: A. required Rationale: The Boolean required attribute triggers browser validation.

Question 7 Which input type provides a color picker? A. palette B. paint C. hue D. color Correct Answer: D. color Rationale: opens a color chooser. Question 8 Which input type is used for entering an email address with built-in validation? A. address B. text-email C. mail D. email Correct Answer: D. email Rationale: type="email" checks for basic email format. Question 9 Which attribute specifies a regular expression the input must match? A. pattern B. regex C. match D. format Correct Answer: A. pattern Rationale: The pattern attribute constrains the value.

Question 13 Which attribute adds playback controls to or ? A. player B. buttons C. controls D. ui Correct Answer: C. controls Rationale: controls displays the browser's default controls. Question 14 Which element lets you provide multiple source files for different formats? A. B. C. D. Correct Answer: B. Rationale: children let the browser pick a supported format. Question 15 Which element adds captions or subtitles to a video? A. B. C. D. Correct Answer: D. Rationale: references WebVTT files.

Question 16 Which HTML5 element provides a drawing surface scripted with JavaScript? A. B. C. D. Correct Answer: D. Rationale: is used with the 2D context for graphics. Question 17 Which method retrieves the 2D drawing context from a canvas element? A. getCanvas('2d') B. draw('2d') C. context2d() D. getContext('2d') Correct Answer: D. getContext('2d') Rationale: canvas.getContext('2d') returns the drawing API. Question 18 Which technology is vector-based and scales without loss of quality? A. GIF B. SVG C. Canvas bitmap D. JPEG Correct Answer: B. SVG Rationale: SVG describes shapes in XML and scales cleanly.

Question 22 Which CSS selector selects all

elements inside a

? A. p.div B. div > p only C. div p D. div + p Correct Answer: C. div p Rationale: The descendant combinator matches p elements at any depth inside div. Question 23 Which selector matches only direct children? A. div > p B. div + p C. div ~ p D. div p Correct Answer: A. div > p Rationale: The child combinator > selects direct children. Question 24 Which selector matches the first element immediately following another? A. h1 p B. h1 ~ p only C. h1 + p D. h1 > p Correct Answer: C. h1 + p Rationale: The adjacent sibling combinator + selects the next sibling.

Question 25 Which pseudo-class styles an element when the mouse is over it? A. :active B. :focus C. :hover D. :visited Correct Answer: C. :hover Rationale: :hover applies while the pointer is over the element. Question 26 Which CSS box model layer lies between the content and the border? A. Gap B. Margin C. Padding D. Outline Correct Answer: C. Padding Rationale: Padding surrounds the content inside the border. Question 27 Which CSS property creates space outside an element's border? A. padding B. spacing C. border-spacing D. margin Correct Answer: D. margin Rationale: Margin sets external space.

Question 30 Which value of position removes an element from normal flow and positions it relative to the nearest positioned ancestor? A. static B. relative C. absolute D. inherit Correct Answer: C. absolute Rationale: absolute positioning uses the nearest positioned ancestor. Question 31 Which CSS display value creates a flexible container? A. flex B. grid-inline-only C. flexible D. block-flex Correct Answer: A. flex Rationale: display: flex activates flexbox layout. Question 32 Which flexbox property aligns items along the main axis? A. align-items B. flex-wrap C. justify-content D. order Correct Answer: C. justify-content Rationale: justify-content distributes space along the main axis.

Question 33 Which flexbox property aligns items along the cross axis? A. align-items B. flex-direction C. justify-content D. flex-flow Correct Answer: A. align-items Rationale: align-items controls cross-axis alignment. Question 34 Which CSS feature is used to apply styles based on screen width? A. Media queries B. Selectors only C. Counters D. Variables only Correct Answer: A. Media queries Rationale: @media rules enable responsive design.

Question 37 Which CSS property creates rounded corners? A. round B. border-curve C. border-radius D. corner-style Correct Answer: C. border-radius Rationale: border-radius rounds the corners. Question 38 Which CSS property adds a shadow to a box? A. element-shadow B. drop-shadow-box C. shadow-box D. box-shadow Correct Answer: D. box-shadow Rationale: box-shadow draws a shadow behind the element. Question 39 Which CSS3 feature allows smooth changes between property values? A. animation-only B. transform C. filter D. transition Correct Answer: D. transition Rationale: transition animates changes over a duration.

Question 40 Which CSS property is used to rotate or scale an element? A. filter B. rotate-element C. scale D. transform Correct Answer: D. transform Rationale: transform applies rotate(), scale(), translate() and skew(). Question 41 Which CSS at-rule defines the steps of an animation? A. @keyframes B. @steps C. @animate D. @frames Correct Answer: A. @keyframes Rationale: @keyframes describes intermediate states. Question 42 In JavaScript, which keyword declares a block-scoped variable that can be reassigned? A. var only B. define C. let D. const Correct Answer: C. let Rationale: let is block scoped and reassignable; const is not reassignable.

Question 46 Which method adds an element to the end of an array? A. shift() B. pop() C. unshift() D. push() Correct Answer: D. push() Rationale: push appends elements to the end. Question 47 Which method removes the last element from an array? A. shift() B. pop() C. push() D. splice(0) Correct Answer: B. pop() Rationale: pop removes and returns the last element. Question 48 Which method removes the first element of an array? A. pop() B. shift() C. concat() D. slice() Correct Answer: B. shift() Rationale: shift removes and returns the first element.

Question 49 Which array method creates a new array by applying a function to each element? A. reduce() B. forEach() C. filter() D. map() Correct Answer: D. map() Rationale: map returns a new array of transformed values. Question 50 Which array method returns elements that pass a test? A. join() B. filter() C. push() D. map() Correct Answer: B. filter() Rationale: filter returns a new array of matching elements. Question 51 What does JSON.parse() do? A. Validates HTML B. Converts an object to a string C. Converts a JSON string to a JavaScript object D. Deletes JSON Correct Answer: C. Converts a JSON string to a JavaScript object Rationale: parse turns text into a JavaScript value.