Web Scripting Quiz3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

​ Which of the following examples tests whether x is equal to 5 or y is equal to 8?

(x === 5) || (y === 8)

Command buttons are created using the input element with the type attribute set to _____.

. ​button

​ What is the output of the following code? var x = ["a", "b", "c"]; x.push("d", "e"); x.pop(); x.pop();

. ​x = ["a", "b", "c"]

What is the output of the following code? var sum = 0; var x = [1, 3, 7, 11]; ​ x.forEach(sumArray); ​ function sumArray(value) { sum += value; }

22

​ What is the output of the following code? var x = [4, 7, 11]; ​ x.forEach(stepUp); ​ function stepUp(value, i, arr) { arr[i] = value + 1; }

5, 8, 12

_____ are intrinsic to the JavaScript language.

Built-in objects

Identify a list which when applied to an input box, the values appear as a pop-up list of suggested values. ​

Data list

​ _____ is the process of locating and fixing a programming error.

Debugging

Identify a return value for the expression 5/"A" using JavaScript.

NaN

Identify a widget that allows the user to interact with the form for entering numeric values confined to a specified range.

Slider control

​ Which of the following functions increases the value of each item in an array by 1?

StepUp()

What is the output of the following code? var scores = [92, 68, 83, 95, 91, 65, 77]; ​ var highScores = scores.filter(gradeA); ​ function gradeA(value) { return value > 90; }

[92, 95, 91]

​ _____ programming distributes the load to prevent a server from getting overloaded with program-related requests. a)client side b)server side

a

​ ​ Which of the following can be referenced only after the browser has finished parsing the page content? a)document objects B)document pages

a

​ Identify a method that tests whether the condition returned by the callback function holds for all items in an array .

array.every(callback [, thisArg])

Which of the following methods creates a new array populated with the elements of array that return a value of true from the callback function?

array.filter(callback [, thisArg])

​ Identify the expression used to reference array values.

array[i]

The _____ attribute tells a browser to parse the HTML and JavaScript code together, only pausing to process the script before returning to the HTML file.

async

Identify the element that can organize selection list options by placing them in option groups in long selection lists. ​ a) selgroup b)optgroup

b

The _____ operator tests whether two items are equal in value and have the same data type. a)== b)===

b

​ Identify a function that extracts the first numeric value from the text string . a)parseInt(string) b)parseFloat(string)

b

​ Identify a syntax to access any of the mathematical constants supported by the Math object. a). ​Math.constant b). ​Math.CONSTANT

b

​ The _____ property should be used only when no markup tags are involved. a)outerHTML b)textContent

b

​ To avoid fatal errors, it is advised to apply the _____ statement locally only to functions that are created rather than globally as the first line of the script file. a)"use global"; b)"use strict";

b

​ The technique for locating the source of an error is to set up _____, which are locations where the browser will pause the program, allowing the programmer to determine the error at that position.

breakpoints

The ____ element is used to create a custom option.​

button

Identify a syntax for JavaScript function.

function_name function(parameters){ commands }

Numeric data can be sorted by creating a(n) _____ function that contrasts the values of two adjacent array items.

compare

Which of the following syntax is used for a function to return a value? a) function_name(parameters) { return value; commands } d) function function_name(parameters){ commands return value;}

d

Identify the output of the following code. var x = 8; var y = 6;

d. ​96

​ A data entry control is associated with a _____ in which data values supplied by the user are stored.

data field

Identify the general syntax of the do/while loop.

do { commands } while (continue);

​ The _____ loop tests the condition to continue the loop right after the latest command block is run.

do/while

Identify the general structure of a for loop.

for (start;continue;update) { commands }

​ Identify a compare function that sorts numeric values in descending order.

function descending(a, b) { return b - a; }

The check box control is created using the _____ element.​

input

​ Identify an expression used to apply a method to an object.

object.method(values)

Identify an attribute that can be added to the input element to validate a text value against a regular expression. ​

pattern="regex"

​ A _____, which employs the first-in-first-out (FIFO) principle in which the first item added to the data list is the first removed, is similar to a stack.

queue

​ A _____ occurs after a script has been successfully loaded with no syntax errors and is being executed by a browser.

run-time error

A(n) _____ is created using the select and option elements that present users with a group of predefined possible values for the data field.

selection list

Identify a property used to refer an HTML code that is stored within a page element.

​element.innerHTML

A command that indicates an action for the browser to take should end with a _____.

semicolon

​ Identify a method that repeatedly runs commands at specified time breaks in a function created.

setInterval("command", interval)

​ For array data that should be treated as a queue, the _____ method is used, which is similar to the pop() method except that it removes the first array item and not the last.

shift()

​ Identify a method that is used to create a subarray.

slice()

A user can create an embedded script by removing the _____ attribute and placing all of the JavaScript code within the script element.

src

​ Developers advocate that JavaScript be run in _____ in which all lapses in syntax result in load-time or run-time errors.

strict mode

​ Identify a method that inserts new items at the front of an array.

unshift()

​ Identify a command that displays a dialog box containing the message "Hello World!". JavaScript

window.alert("Hello World!");

Identify a statement that is added to the first line of the file to run a script in strict mode. ​

​"use strict";

​_____ is the programming language for client-side programs.

​JavaScript

​ Which of the following methods of the Math operator rounds x up to the next highest integer?

​Math.ceil(x)

​ The _____ method creates a new array by passing the original array items to the callback function, which returns the equivalent value of the array items.

​array.map(callback [, thisArg])

​ To break a text string into several lines, which means that the text string continues on the next line, the _____ character should be used.

​backslash

​ Identify an expression that can be used to refer an element by its id attribute.

​document.getElementById(id)

Identify a method that extracts array items that match a specified condition.

​filter()

​ A(n) _____ is a collection of commands that performs an action or returns a value.

​function

Identify a compare function that sorts numeric values in ascending order.

​function ascending(a, b) { return a - b; }

Identify a pseudo-class for a check box or option button whose toggle states cannot be ascertained.​

​indeterminate

By default, browsers display input boxes as _____ elements with a default length of 20 characters.

​inline

The technique of immediate data validation and reporting of errors is known as _____. ​

​inline validation

Identify the cross-browser style sheet that changes the text color of the placeholder text for every input box to light red for the moz extension.

​input::-moz-placeholder {color: rgb(255, 151, 151);}

Every field set must contain the _____ element, which should have only text and no nested elements for describing its content.

​legend

​ A video embedded on a web page is a(n) _____ and has properties such as source of the video file or the width and height of the video player.

​object

Objects are organized into groups called _____.

​object collections

​ JavaScript code is attached to an HTML file using the _____ element.

​script

​ Identify a syntax to set the time-delayed commands.

​setTimeout("command", delay);

A _____ is used to restrict numeric values by displaying an up or down arrow to increase or decrease the field value by a set amount. ​

​spinner control

A(n) _____ is any group of characters enclosed within either double or single quotation marks in JavaScript.

​text string

The process of ensuring that the user has supplied correct data is called _____ . ​

​validation

​ Identify a command that uses the dateDiv variable to refer the page element with ID dateNow.

​var dateDiv = document.getElementById("dateNow");

​ A(n) _____ is a named item in a program that stores a data value, such as a number or text string, or an object, such as a part of the web browser or browser window.

​variable


Ensembles d'études connexes

Cyber Threat Management (Module 6)

View Set

Lección 1 Estructura 1.1- 1 ¿Masculino o femenino?

View Set

Introduction to African American Society Exam 2

View Set

ATI Fundamentals Chapter 27: Vital Signs Questions

View Set