WGU Web Development Applications (KVO1) WGU (KVO1) Web Development Applications Exam Practice Test

Page: 1 / 14
Total 136 questions
Question 1

What is the purpose of cascading style sheets (CSSs)?



Answer : D

Cascading Style Sheets (CSS) are used to control the presentation of web pages, including aspects such as layout, colors, fonts, and other visual styles. They are a cornerstone technology of the World Wide Web, along with HTML and JavaScript. Here's a detailed breakdown:

Purpose of CSS: CSS is designed to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the layout, colors, and fonts. This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple web pages to share formatting, and reduce complexity and repetition in the structural content.

Setting Visual Rules: CSS allows developers to define rules that specify how different elements of a web page should be displayed. For example, CSS rules can change text color, font size, spacing between elements, and even the overall layout of the web page. These rules are applied by the browser to render the web page according to the defined styles.

Cascading Nature: The term 'cascading' in CSS refers to the process of combining multiple style sheets and resolving conflicts between different CSS rules. This allows developers to use different sources of style information, which can be combined in a hierarchical manner. For instance, a browser style sheet, an external style sheet, and inline styles can all contribute to the final rendering of a web page.

Benefits of CSS:

Consistency: By using CSS, developers can ensure a consistent look and feel across multiple web pages.

Maintainability: CSS makes it easier to update the visual presentation of a web page without altering the HTML structure. This is particularly useful for maintaining large websites.

Reusability: CSS rules can be reused across multiple pages, reducing redundancy and making it easier to implement changes globally.

Examples of CSS:

css

Copy code

body {

background-color: lightblue;

}

h1 {

color: navy;

margin-left: 20px;

}

In this example, the body element is given a light blue background color, and the h1 element is styled with a navy color and a left margin of 20 pixels.


MDN Web Docs on CSS

W3C CSS Specifications

Question 2

Given the following code:

Var a = ''true'';

What is the data type of d?



Answer : B

The data type of the variable a is determined by the value assigned to it. In JavaScript, if a value is enclosed in double or single quotes, it is treated as a string.

Variable Assignment:

Given the code:

var a = 'true';

The value 'true' is enclosed in double quotes, making it a string.

Option A: Boolean is incorrect because the value 'true' is a string, not a boolean.

Option B: String is correct because the value is enclosed in double quotes.

Option C: Object is incorrect because the value is a primitive string.

Option D: Undefined is incorrect because the variable a is assigned a value.


MDN Web Docs - JavaScript Data Types

W3Schools - JavaScript Data Types

Question 3

Which markup ensures that the data entered are either a five-digit ZIP code or an empty string?



Answer : D

> ''The `pattern` attribute in HTML allows developers to specify a regular expression against which the input field is validated.''

>

> `\d{5}` matches exactly five digits. When `required` is not set, the field can also be left empty --- meeting the requirement of 'five digits or empty'.


* MDN Web Docs: pattern attribute

* HTML Forms Constraint Validation

---

Question 4

Given the following CSS code:

How many seconds elapse before the font-size property begins to increase when a user hovers a mouse pointer over the delay element?



Answer : B

The CSS transition-delay property specifies how long to wait before starting a property transition. In the given CSS code, the transition-delay is set to 2s.

CSS Transition Properties:

transition-property: Specifies the CSS property to which the transition is applied (font-size in this case).

transition-duration: Specifies how long the transition takes (4s).

transition-delay: Specifies the delay before the transition starts (2s).

Example:

Given HTML:

Hover over me

Given CSS:

#delay {

font-size: 14px;

transition-property: font-size;

transition-duration: 4s;

transition-delay: 2s;

}

#delay:hover {

font-size: 36px;

}

When a user hovers over the element with id='delay', it will wait for 2 seconds before the transition effect on font-size starts.

Reference:

MDN Web Docs - transition-delay

W3C CSS Transitions


Question 5

A web designer evaluates the following CSS rule:

.head { color: #0000ff; }

Which element is selected as a result?

Question 6

Given the following code:

What is the value of the variable data when the code runs?



Answer : D

In JavaScript, assigning an empty pair of quotes to a variable creates an empty string.

Variable Assignment:

Given the code:

var data = '';

The variable data is assigned an empty string.

Option A: Null is incorrect because the variable is assigned an empty string, not null.

Option B: A single-character string is incorrect because the string is empty.

Option C: Undefined is incorrect because the variable is assigned a value, even though it is an empty string.

Option D: An empty string is correct because '' represents an empty string.


MDN Web Docs - String

W3Schools - JavaScript Strings

Question 7

Given the following code:

```javascript

var a;

```

What is the value of `a`?



Answer : B

> ''When a variable is declared but not initialized, its value is `undefined` by default in JavaScript.''

>

> Example:

```javascript

var a;

console.log(a); // undefined

```

* `null` must be explicitly assigned.

* `true` and `false` are Boolean values not assigned in this declaration.


* MDN Web Docs: undefined

* JavaScript Language Specification: Variable declarations

---

Page:    1 / 14   
Total 136 questions