Web Foundations II- JavaScript review

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

What is a scripting language?

An Interpreted language that is a subset of a full programming language.

What is the output of the following JavaScript statements? var myString = "three blind mice"; alert(myString.substring(7,3));

An alert dialog box displaying "ee b"

A document object exists as long as the pages associated with it is loaded.

False

A string can consist of text, numbers, or any combination of characters that functions.

False

Which attribute defines a group of radio buttons for the radio object?

Name

Which method would you use to request and get data from a user?

The prompt() method

The JavaScript return keyword returns a:

value to a function\'s calling statement

Which JavaScript statement executes a block of code as long as a certain test condition is true?

while loop

Statements associated with a function are enclosed within: { } / / /* */ none of these

{ }

Which property is associated with the document object? -name -write -status -frames

(?? write)

JavaScript can be used for

(NOT, validation of data entered by a user)

Which symbol is used to combine (concatenate) strings and variables in the JavaScript prompt() and alert() methods?

+

Which of the following object is best suited for form questions where the user can select only one response from a group?

--- i think it's a radio button

When you evaluate strings with the JavaScript methods indexOf() and lastIndexOf(), the ______ return value indicates that the sought-after string was not found.

-1

What is output when the following JavaScript statements execute? var myStr = "Three Blind Mice"; document.write(myStr.charAt(1)); document.write(myStr.charAt(7)); document.write(myStr.charAt(13));

-hli ---(i think it would be "hli")

When using literal text, surround the regular expression with two _________ characters, one at the beginning of the regular expression and one at the end.

/

Which syntax is used to specify a multiple-line comment in JavaScript?

/*asteric ... asteric*/

Sunday is represented by the numeric value ___________ as the return value from the getDay() method.

0

Which JavaScript operator is used to assignment values to variables?

=

What is the output of the following JavaScript statements: var myStr = "[email protected]"; document.write(myStr.indexOf("b@", 0));

?? -1, bc if it's not found it returns -1... and I don't think there is an instance of "b@" actually in the string.

Which of the following is the correct JavaScript syntax for referring to a form object?

??-- You can access a <form> element by using getElementById(): var x = document.getElementById("myForm"); ??-- You can create a <form> element by using the document.createElement() method: var x = document.createElement("FORM");

Which of the following is an example of good coding practice with JavaScript -all of these -hierarchical code indentation -consistent capitalization schemes -comments

All of these

Which of the following are examples of JavaScript variable data types?

All of these (number, string, Boolean, Object, null, undefined)

What is the output of the following JavaScript statements? var myString = "three blind mice"; alert(myString.substr(3,7));

An alert dialog box displaying "ee blin"

What is the output of the following JavaScript statements? var myString = "three blind mice"; alert(myString.substr(7,3));

An alert dialog box displaying "lin"

What is the output of the following JavaScript statements? var myString = "three blind mice"; alert(myString.length);

An alert dialog box displaying the integer 16

What is the output of the following JavaScript statements? var myString = "three blind mice"; alert(myString.length);

An alert dialog box displaying the integer 16

to "exit a loop"

Break

A JavaScript constructor is a mechanism that creates an object in JavaScript.

False

A JavaScript variable name can begin with a number.

False

A common use of client-side JavaScript is to validate form field information?

False

force control flow to top of loop

Continue

The acronym DOM stands for

Document Object Model

The DOM is a W3C programming specification that represents an HTML page as a programmable object, enabling developers to access to all elements within such a document.

False

The form element is a stand-alone tag so there is no closing tag.

False

The main event handler of the button object is onclick.

False

The main property associated with a checkbox object is the checked property.

False

The principle of containership is represented in the hierarchical JavaScript object model by enabling some objects to be contained within a parent object.

False

The window object is considered the default object because it does not need to be referenced by name when calling a method of the window object.

False

True or False? In JavaScript myArray[1] would refer to the first element of the array myArray.

False

True or False? In JavaScript, whatever follows the if keyword and comes before the else keyword must be enclosed in braces (also called "curly brackets").

False

True or False? In a JavaScript regular expression \d and \D are alternate forms of the same thing.

False

What is the output of the following JavaScript statements: var myStr = "[email protected]"; document.write(myStr.lastIndexOf("edu") + "<br />");

NOT- edu ---??maybe 2... bc counting back 0,1,2

Which of the following statements is true? -Mobile browsers cannot use JavaScript. -JavaScript runs the same on all browsers. -JavaScript is a compiled language. -JavaScript is platform-independent.

JavaScript is platform-independent.

Which client-side scripting language is supported only by the Microsoft Internet Explorer browser?

Jscript

What was the first implementation of Server-Side JavaScript called?

LiveWire

How can you refer to the element of a form object? -both of these -neither of these -by its name -by its index number in the element array of the form object

NOT, by it's name

What is the output of the following JavaScript statements: var myStr = "[email protected]"; document.write(myStr.indexOf("@", 0) + "<br />");

NOT- 5 (new line) ---perhaps it wld be just "5" don't mention the new line.

What is output when the following JavaScript statements execute? var myArray = new Array("red", "white", "blue"); document.write(myArray); -Three Blind Mice -none of these -Three,Blind,Mice -myArray

NOT- Three Blind Mice NOT- none of these NOT- myArray

In a regular expression, \d{3,7} means

NOT- a single digit either 3 times or 7 times NOT- anything but a digit 3, 4, 5, 6, or 7 times --( \d means find a digit)

The __________________ JavaScript language object is used to search for specific patterns in text.

RegExp object

Which task is an example of a client-side JavaScript application?

Sending a message to a Web page user

Which JavaScript variable data type would you use to represent alphanumeric characters? -Object -String -Number -Boolean

String

acts like multiple else if clauses within an if statement

Switch

Which tag is used to embed JavaScript into an X/HTML document?

The X/HTML script tag

Which JavaScript input object returns a Boolean value of true or false?

The checkbox object

What is the purpose of the JavaScript form object?

To access all properties of a form

Why use the HTML noscript tag?

To display content for browsers that do not support JavaScript.

A function is a named block of code that can be called when needed. In JavaScript, any method that returns a value can be called a function.

True

A literal in JavaScript is the same thing as a constant in other programming languages, which means that it is a fixed value.

True

A semicolon is used in JavaScript to end a JavaScript statement.

True

Although a semicolon is not required at the end of each JavaScript statement, it is good practice to use one.

True

JavaScript is case sensitive, which means the letter a is not the same as the letter A.

True

Regular expressions can be used to search for specific patterns in text.

True

True or False? In JavaScript strings may be enclosed in either double quotes or single quotes.

True

True or False? In JavaScript use of the method getElementById() is the preferred way to get access to a DOM object.

True

True or False? In a JavaScript regular expression {0,1} and ? are alternate forms of the same thing.

True

When a user enters clicks cancel when a JavaScript prompt() method is executed, the prompt() method returns a null value, which is not a string.

True

When a user enters no input but clicks OK when a JavaScript prompt() method is executed, the prompt() method returns an empty string.

True

In JavaScript, which of the following lets you to store user-entered data or programmer-defined data and use it more than once?

Variable

A function in JavaScript is called by: -all of these -from another function -from a user or browser event -from a separate script block on an HTML page.

all of these

JavaScript variable names can consist of which of the following?

all of these

Which of the following is a built-in JavaScript function? Name at least one built-in JavaScript function. -isNaN() -parseInt() -all of these -toUpperCase()

all of these

Which of the following is a form object?

all of these

Which of the following should you do when validating form field information?

all of these

The JavaScript form object is used to do which of the following?

all of these (represent an HTML form, access all properties of an HTML form, provides methods to work with forms)

Which of the following are uses for the JavaScript String object methods?

all of these (Formatting text, Testing for the presence of specific characters, Extracting a subset from a given string)

Which of the following are JavaScript Language Objects?

all of these (String object, Array object, RegExp object)

Which of the following is true concerning the JavaScript object model?

all of these are true (-It helps the web designer to manipulate information in useful ways, -It divides objects into three general object groups: browser objects, language objects, and form field objects, It organizes objects in a hierarchy)

JavaScript can be used for -computations based on user input -validation of data entered by a user -any or all of the above -changing the look and feel of a web page

any or all of the above

An infinite loop is caused by

both of these

How can you refer to the element of a form object?

both of these

Why use the JavaScript if...else statement?

branch to one of two statements depending on the result of a test condition

The _________ JavaScript statement forces the flow of control back to the top of a loop.

continue

Which of the following is the correct JavaScript syntax for referring to a form object? -document.newForm.fieldName.value; -window.newForm.fieldName.value; -form.newForm.fieldName.value -document.newForm[fieldName].value;

document.newForm.fieldName.value;

Which JavaScript method would you use to output text to a web page?

document.write()

A key characteristic of JavaScript is that it is:

event-driven

Which of the following is the primary user interface in Web pages? -forms -tables -objects -functions

forms

The __________________ JavaScript String object method is used to test user input.

indexOf() method ---("returns the position of the first occurrence")

What is the JavaScript event that occurs when a Web page is accessed and appears in a browser?

load

Which property is associated with the document object?

name

Which of the following object is best suited for yes-or-no questions in a form?

radio object

Which JavaScript variable data type would you use to represent alphanumeric...

string

loop that checks the conditional expression after first executing the loop body

the Do... While loop

loop that checks the conditional expression before executing the loop body

the While loop

JavaScript is mostly concerned with

the behavior of a web page.

The first character in a JavaScript variable name must be either a letter or the underscore character.

true


Ensembles d'études connexes

LENB 3135 Chapter 18 Study Questions

View Set

Chapter 45: Nursing Care of a Family When a Child Has a Gastrointestinal Disorder

View Set

PACE Social Studies American History 1125 Test

View Set

Transferring & Recording Title to Real Estate

View Set

Teaching Math Summative Assessment

View Set

Chapter 4: Costing & Pricing in Transportation

View Set

Chapter 15: NCLEX practice questions

View Set