Docsity

DEV 101 Web Development HTML CSS JavaScript Lab Solutions | Study Guide & Practice PDF, Exams of Web Application Development

Partial preview of the text

Download DEV 101 Web Development HTML CSS JavaScript Lab Solutions | Study Guide & Practice PDF and more Exams Web Application Development in PDF only on Docsity!

DEV 101 Web Development

HTML, CSS & JavaScript Practice

Questions

Original Lab-Style Questions, Code Challenges, Explanations & Review Guide

Practice & Review Edition

100 original MCQs • 400 globally unique answer choices • Explanations • Practical scenarios

Independent educational resource — not an official course publication or answer key.

Research & Scope Note

The exact publicly verifiable course located during research is Web Dev 101: HTML (WD101) from the JS Institute/OpenEDG ecosystem. Its published syllabus covers six HTML-focused modules: getting started with HTML; text and data organization; visual and interactive elements; web presentation; optimized and accessible content; and HTML beyond basics. The provider separately lists Web Dev 102: CSS and JavaScript Essentials courses. Accordingly, the HTML section follows the verified WD101 scope, while CSS and JavaScript are included as independent integrated front-end practice rather than being presented as official WD101 syllabus content.

The questions are independently authored from learning objectives and technical references. No course lab question, instructor solution, answer key, or competitor question is intentionally reproduced.

Verified course source: JS Institute/OpenEDG — Web Dev 101: HTML (WD101).

Technical references: MDN Web Docs and the WHATWG HTML Living Standard.

HTML Fundamentals

Question 1

Which declaration should appear before the root HTML element in a modern document?

A. The HTML doctype declaration

B. A viewport declaration inside body

C. A stylesheet rule before the document

D. A JavaScript import statement before the doctype

Correct Answer: A

Explanation: The doctype establishes the intended HTML parsing mode.

Question 2

Which element contains metadata such as the document title and resource links?

A. The main element

B. The head element

C. The article element

D. The footer element

Correct Answer: B

Explanation: The head contains document metadata and related resource information.

Question 3

Which element is the root of a normal HTML document?

A. The body element alone

B. The header element

C. The html element

D. The document-title element

Correct Answer: C

Explanation: The html element is the document root and contains head and body.

Question 4

Where should ordinary visible page content normally be placed?

A. Inside the doctype declaration

B. Inside the meta element

C. Inside the title element

D. Inside the body element

Correct Answer: D

Explanation: The body contains the document content presented to users.

Question 5

Which declaration specifies UTF-8 character encoding in modern HTML?

A. A meta charset declaration using UTF-

B. A CSS encoding property on body

C. An img encoding attribute

D. A language value in the title element

Correct Answer: A

Explanation: A meta element with charset="UTF-8" declares the document encoding.

Which element supplies the document title used by browsers?

A. The heading element

B. The title element

C. The caption element

D. The label element

Correct Answer: B

Explanation: The title element provides the document title.

Question 7

What is the purpose of an HTML comment?

A. To create hidden form controls

B. To change the browser's CSS engine

C. To leave source notes that are not rendered as page content

D. To declare a JavaScript variable

Correct Answer: C

Explanation: HTML comments are source-level notes and are not rendered.

Question 8

What does the DOM represent?

A. A list of CSS files only

B. A browser's network history

C. A table of HTTP status codes

D. A tree-like representation of the document and its nodes

Correct Answer: D

Explanation: The Document Object Model represents document structure as interconnected nodes.

Question 9

Which global attribute provides a unique identifier for an element?

A. id

B. class-group

C. unique-name-only

D. element-key

Correct Answer: A

Explanation: The id attribute identifies an element uniquely within the document.

Question 10

Which attribute is intended for reusable groups of styling or scripting hooks?

A. shared-id

B. class

C. style-key

D. group-target

Correct Answer: B

Explanation: The class attribute assigns reusable class names.

Semantic HTML, Text & Structure

Which list type is appropriate for steps that must be followed in sequence?

A. An unordered list

B. A paragraph with commas

C. A description list of terms

D. A bullet list intended for items with no required sequence

Correct Answer: D

Explanation: Ordered lists communicate meaningful sequence.

Question 17

Which structure represents terms paired with their descriptions?

A. A description list using dl, dt, and dd

B. A navigation list using only nav

C. A paragraph containing repeated br elements

D. A table without rows

Correct Answer: A

Explanation: Description lists model term-description relationships.

Question 18

Which element identifies a table header cell?

A. td-head

B. th

C. header-cell

D. A text prompt attached to a form control

Correct Answer: B

Explanation: The th element represents a header cell.

Question 19

Which element groups the main body rows of a table?

A. table-body

B. row-group-main

C. tbody

D. body-rows-only

Correct Answer: C

Explanation: tbody groups table body rows.

Question 20

Which element supplies a caption for a table?

A. table-title-only

B. A group caption for related form controls

C. table-label

D. A short description placed above a data table

Correct Answer: D

Explanation: caption identifies or describes a table.

Links, Images & Media

Which element creates a hyperlink?

A. a with an href attribute

B. link with src

C. url with path

D. navigate with target-only

Correct Answer: A

Explanation: The a element creates hyperlinks and href supplies the destination.

Question 22

How can a link jump to a specific section of the same page?

A. Put the target text in the link's title

B. Use a fragment identifier that matches the target element's id

C. Use a CSS class as the href value without a fragment

D. Place the destination in the page's doctype

Correct Answer: B

Explanation: A fragment such as #details targets an element with the matching id.

Question 23

Which attribute supplies alternative text for a meaningful image?

A. image-description

B. assistive-text

C. alt

D. visual-label

Correct Answer: C

Explanation: The alt attribute provides alternative text.

Question 24

What is commonly appropriate for a purely decorative image?

A. The filename as alt text

B. The page title as alt text

C. The CSS class as alt text

D. An empty alt attribute

Correct Answer: D

Explanation: An empty alt can indicate that a decorative image should be ignored by assistive technology.

Question 25

Which element embeds audio using native HTML media support?

A. audio

B. sound

C. music

D. audio-player-only

Correct Answer: A

Explanation: The audio element embeds sound content.

Which input type is intended for an email address?

A. type="mailbox"

B. type="address-email"

C. type="email"

D. type="contact"

Correct Answer: C

Explanation: The email type communicates the expected data and enables relevant browser validation.

Question 32

Which input type is intended for ordinary single-line text?

A. type="string"

B. type="single-line"

C. type="words"

D. type="text"

Correct Answer: D

Explanation: The text type is the standard single-line free-form text control.

Question 33

Which controls are normally used when exactly one option from a group should be chosen?

A. Radio inputs sharing the same name

B. Independent checkboxes

C. A set of submit buttons

D. A description list

Correct Answer: A

Explanation: Radio controls with the same name form a mutually exclusive group.

Question 34

Which controls are appropriate when several independent preferences may be selected?

A. A single radio group

B. Checkbox inputs

C. Heading elements

D. Table header cells

Correct Answer: B

Explanation: Checkboxes represent independent selections.

Question 35

Which element provides a persistent text prompt for a form control?

A. The table's caption element used to identify its subject

B. prompt

C. label

D. field-name

Correct Answer: C

Explanation: The label element names and describes a form control.

How should a label be explicitly associated with an input?

A. Give both elements identical class names

B. Put the input inside the title element

C. Copy the input's name into the label's href

D. Match the label's for value to the input's id

Correct Answer: D

Explanation: The label's for attribute references the control's id.

Question 37

Which element groups related form controls semantically?

A. fieldset

B. form-group

C. control-set

D. input-section-only

Correct Answer: A

Explanation: fieldset groups related form controls.

Question 38

Which element names a fieldset group?

A. fieldset-title

B. The fieldset caption element

C. group-caption-only

D. form-heading

Correct Answer: B

Explanation: legend supplies a caption for a fieldset.

Question 39

Which input type obscures typical password entry?

A. type="secure-text"

B. type="masked"

C. type="password"

D. type="private"

Correct Answer: C

Explanation: The password input type provides a masked text-entry control.

Question 40

Which boolean attribute marks a control as required for native constraint validation?

A. mandatory

B. must-fill

C. validate-needed

D. required

Correct Answer: D

Explanation: The required attribute marks a control as mandatory.

CSS Presentation & Layout

Which property controls space between content and an element's border?

A. outer spacing around a box

B. inner spacing between content and border

C. inner-gap

D. content-space-outside

Correct Answer: B

Explanation: Padding is internal space between content and the border.

Question 47

Which property creates space outside an element's border?

A. content-to-border spacing inside a box

B. outer-content

C. space outside the edge of an element

D. border-distance

Correct Answer: C

Explanation: Margin creates space outside the border.

Question 48

Which property draws a line around an element?

A. frame

B. edge-line

C. box-stroke

D. border

Correct Answer: D

Explanation: The border property draws a border around an element.

Question 49

Which declaration makes an element a flex container?

A. display: flex

B. layout: flex

C. position: flex

D. flex-container: true

Correct Answer: A

Explanation: display:flex establishes a flex formatting context.

Question 50

Which flex-direction value creates a vertical main axis?

A. vertical

B. column

C. top-down

D. axis-y

Correct Answer: B

Explanation: flex-direction: column makes the main axis vertical.

CSS Responsive & Cascade

Which justify-content value places space between flex items while keeping the first and last near the container edges?

A. edge-spread

B. main-gap-only

C. space-between

D. between-edges

Correct Answer: C

Explanation: space-between distributes remaining main-axis space between items.

Question 52

Which declaration creates three equal flexible Grid columns?

A. grid-columns: 3 equal

B. columns: repeat-three

C. grid-template: three-wide

D. grid-template-columns: repeat(3, 1fr)

Correct Answer: D

Explanation: repeat(3, 1fr) creates three equal flexible tracks.

Question 53

Which CSS feature applies rules conditionally based on viewport characteristics?

A. A media query

B. A responsive selector

C. A viewport class

D. A screen attribute

Correct Answer: A

Explanation: Media queries conditionally apply CSS based on media features.

Question 54

Which property controls an element's text color?

A. text-paint

B. color

C. font-ink

D. foreground

Correct Answer: B

Explanation: The color property sets text color.

Question 55

Which concept helps decide between competing CSS declarations with different selector strengths?

A. DOM depth

B. HTML weight

C. Specificity

D. browser preference

Correct Answer: C

Explanation: Specificity contributes to the cascade decision when declarations compete.

Which declaration creates a binding that cannot be reassigned?

A. const

B. fixed

C. constant-var

D. immutable-name

Correct Answer: A

Explanation: const prevents reassignment of the binding.

Question 62

Which declaration creates a block-scoped binding that can be reassigned?

A. mutable-const

B. let

C. changeable

D. block-variable-only

Correct Answer: B

Explanation: let is block scoped and can be reassigned.

Question 63

Which statement sends a value from a function to its caller?

A. send-back

B. output

C. return

D. give-value

Correct Answer: C

Explanation: return supplies a function's result to its caller.

Question 64

Which strict comparison operator checks value and type without coercion?

A. strict-value-only

B. same-type

C. equals-exactly-name

D. ===

Correct Answer: D

Explanation: === performs strict equality comparison.

Question 65

Which syntax creates an array literal?

A. ["red", "blue", "green"]

B. {"red", "blue", "green"}

C. ("red", "blue", "green")

D. red,blue,green

Correct Answer: A

Explanation: Square brackets create an array literal.

Which structure stores named properties such as name and age together?

A. A CSS declaration block

B. A JavaScript object

C. An HTML comment

D. A numeric literal

Correct Answer: B

Explanation: Objects store related values under named properties.

Question 67

Which operator returns the remainder of a division?

A. remainder()

B. leftover

C. %

D. divide-rest

Correct Answer: C

Explanation: The % operator returns a division remainder.

Question 68

Which loop repeats while its condition remains true?

A. repeat-true-only

B. loop-while-tag

C. condition-repeat-block

D. while

Correct Answer: D

Explanation: A while loop continues while its condition is truthy.

Question 69

Which loop combines initialization, condition, and update expressions?

A. for

B. count-block

C. iteration-header

D. repeat-three-part

Correct Answer: A

Explanation: The for statement groups initialization, condition, and update.

Question 70

Which syntax declares a named traditional JavaScript function?

A. declare calculateTotal {}

B. function calculateTotal() {}

C. fn calculateTotal => {}

D. function-name calculateTotal begin

Correct Answer: B

Explanation: A traditional function declaration begins with the function keyword.

DOM, Events & Debugging

Which API adds a class token to an element?

A. element.addClass("active")

B. element.styleClass("active")

C. element.classes.push("active")

D. element.classList.add("active")

Correct Answer: D

Explanation: classList.add adds a class token.

Question 77

Which event-object method cancels a cancelable default action such as normal form navigation?

A. event.preventDefault()

B. event.cancelAction()

C. event.stopBrowser()

D. event.blockDefaultOnly()

Correct Answer: A

Explanation: preventDefault cancels the event's default action when permitted.

Question 78

What does a null result from a DOM selector usually indicate?

A. The browser found a stylesheet

B. No matching element was found at that time

C. The selector became CSS

D. JavaScript converted the node to text

Correct Answer: B

Explanation: A null selection indicates that no matching element was returned.

Question 79

Which event property identifies the original element that initiated a bubbling event?

A. event.origin

B. event.firstElement

C. event.target

D. event.clickedAncestor

Correct Answer: C

Explanation: target identifies the original event target.

Question 80

Which browser feature is useful for inspecting runtime JavaScript errors and logs?

A. The document title bar

B. The favicon panel

C. The CSS color picker only

D. The developer console

Correct Answer: D

Explanation: The console reports errors and diagnostic output.

Accessibility, HTML Beyond Basics & Integrated Labs

Which semantic element represents a page's dominant unique content?

A. main

B. primary-box

C. content-center

D. main-wrapper-only

Correct Answer: A

Explanation: main represents the dominant content of the document.

Question 82

Which semantic element represents navigation links?

A. navigation-box

B. nav

C. link-zone

D. menu-region-only

Correct Answer: B

Explanation: nav represents a navigation section.

Question 83

Which semantic element represents a self-contained composition such as a news post?

A. story-box

B. post-div-only

C. article

D. news-region

Correct Answer: C

Explanation: article represents a self-contained composition.

Question 84

Which semantic element can represent supporting content related to the main flow?

A. side-box

B. support-content-only

C. secondary-body

D. aside

Correct Answer: D

Explanation: aside represents indirectly related supporting content.

Question 85

Which element represents a thematic grouping of content, often with a heading?

A. section

B. content-cluster

C. region-box

D. topic-div-only

Correct Answer: A

Explanation: section represents a thematic grouping.