JavaScript Final Review

Ace your homework & exams now with Quizwiz!

What does the following code do? var x = myhouse.kitchen; -It assigns the string myhouse.kitchen to the variable x. -It adds the values of myhouse and kitchen and assigns them to an object named x. -Assuming the myhouse object exists, it assigns the value of the kitchen property of the myhouse object to the variable x. -Assuming the kitchen object exists, it assigns the value of the myhouse property of the kitchen object to the variable x.

Assuming the myhouse object exists, it assigns the value of the kitchen property of the myhouse object to the variable x.

JavaScript is a typed language. -stereo -strongly -weakly -none of the above

weakly

What is step one of the Software Development Life Cycle? -Write the program -Define the problem -Test the program -Design the solution

define the problem

What operator is used to remove a property from an object? -delete -remove -erase -scrub

delete

The object is an object that is created by the browser for each new HTML page that is viewed. -page -document -window -element

document

Which of the following will write the value of Pi to the page? -document.write(Math.Pi) -document.write(Math.pi) -document.write(Math.PI) -document.write(Date.PI)

document.write(Math.PI)

In JavaScript, you typically access object properties through the use of the? -addition operator (+) -dot operator (.) -multiplication operator -You can't access the properties of an object

dot operator (.)

To react to an event you need to have an registered. -event -event handler function -event object -event array

event handler function

The getMonth method returns the number of the month that coincides with the actual month (1 for Jan., 2 for Feb., etc)? -True -False

false

The method of the document object allows you to get an element by the value of its id attribute. -getId -getById -getElementById -getElement

getElementById

What method do you use to get the year from an instance of a Date object? -getYear() -getCurrentYear() -getFullYear() -this.year()

getFullYear()

What does the getElementById method return if the id doesn't exist on the web page? -nothing -undefined -not found -null

null

An event is created for every event. It contains information about the event. -schedule -notification -object -None of the above

object

An object is a collection of? -variables and values -functions and values -properties and values -stand alone variables and functions

properties and values

The following is an example of . 1. Get number1 2. Get number2 3. Sum = number1 + number2 4. Display the calculated sum of number1 and number2 -an algorithm -a JavaScript program -pseudocode

pseudocode

If too many events happen close together the browser will store the events in the event until it can process them. -stack -queue -heap -folder

queue

Which HTML element is used to insert JavaScript into a web page? -Div -Style -Script -Input

script

Which of the following methods will convert a string to all uppercase characters? -toUpper -toLower -toCaps -toUpperCase

toUpperCase

The Math object's pow() method returns the numeric value of the first argument raised to the power of the second argument? -True -False

true

The string length property returns the number of characters in a string. -True -False

true

When using object literal notation to create an object, the properties and values are enclosed within curly braces ({})? -True -False

true

What does the following code return? var jsMaster = "I am a JavaScript Ninja. Ninja of JavaScript am I."; jsMaster.indexOf("ja"); -21 -ja -29 -Ninja

21

When does the event handler for the window's onload property get called? -When the web page (document) starts loading -Just before you close, or leave, the web page (document) -After the web page (document) has completely loaded -None of the above

After the web page (document) has completely loaded

Code that is only invoked if and when an event occurs is called? -Asynchronous code -Linear code -Step by step code -Sequential code

Asynchronous code

The JavaScript and Java programming languages are the same? -True -False

False

The following is an example of ? Declare three numeric variables: number1, number2, sum Display "Enter number 1" Get number1 Display "Enter number 2" Get number2 sum = number1 + number 2 Display "The sum of the two numbers is: " + sum -An algorithm -JavaScript code -Pseudocode -I don't know

Pseudocode

What punctuation is used to indicate the end of a JavaScript statement? Correct! -Semicolon -Colon -Period -Ampersand

Semicolon

Use the method to create a time based event that will execute only once after a specified amount of time? -setInterval -setWait -setTimeout -runOnce

SetTimeout

The window.onload event fires when? -The browser is opened -It is fired upon -The document has finished loading

The document has finished loading

One or more characters of text is referred to as a in programming. sentence -word -phrase -string

string

The Document Object Model (DOM) allows you to? -Get elements from the DOM -Create, add, and remove elements in the DOM -Traverse the elements of the DOM -All of the above

All of the above

The following is an example of ? Ask for two numbers sum the two numbers record the sum for later use -An algorithm -JavaScript code -Pseudocode -I don't know

An algorithm

What does the following code do? myhouse.kitchen = "big"; -Assuming the kitchen object exists, the myhouse property is assigned a new string value. -Assuming the myhouse object exists, the value of the variable kitchen is added to the string big. -Assuming the myhouse object exists, the kitchen property is assigned a new string value of "big", or the kitchen property is created and initialized with the string value "big". -This wouldn't do anything.

Assuming the myhouse object exists, the kitchen property is assigned a new string value of "big", or the kitchen property is created and initialized with the string value "big".

What does this code do? var now = new Date(); -Creates an instance of a blank date object -Gets the value of a Date object in milliseconds -Gets the string representation of a Date object -Creates an instance of a Date object with the current date and time

Creates an instance of a Date object with the current date and time

Before doing anything other step in the Software Development Life Cycle you should always write the program. -True -False

False

Changing the contents of an HTML element using the innerHTML property permanently changes the document; each time the page (document) is loaded, or reloaded, these changes will be retained? -True -False

False

Functions that handle events are known as event ? -helpers -handlers -tasks -functions

Handlers

JavaScript is an example of a level computer language. -Mid -Low -High -Sub

High

A method is just like a function except that it is part of an object? -True -False

True

Event handler functions can be run at any time, they are not restricted to sequential processing? -True -False

True

JavaScript reserved words are words that JavaScript keeps for its own use. -True -False

True

Objects can be created in the following ways: with just data properties; just methods; or a combination of the two. Correct! -True -False

True

Pseudocode is a generic programming like language written in English used to develop computer programs. -True -False

True

The Document Object Model (DOM) is the browser's internal representation of the web page. It allows JavaScript to programmatically access the document (web page)? -True -False

True

The following are common types of data in computing: Numeric String Boolean -True -False

True

The innerHTML property holds the text content, as well as all nested HTML content, of an element? -True -False

True

The innerHTML property of an element allows you to change the content inside an HTML element? -True -False

True

You can pass arguments to methods, just like you can to regular functions? -True -False

True

Match the event object property with the information it provides... keyCode target timestamp type Other Incorrect Match Options: The data type The time to wait before executing the event handler function The event handler function for the event

What key was pressed The object that the event occured on when the event occured The type of event

The following are examples of . 5 "To be or not to be" -boolean data values -string values -numeric values -a numeric value and a string value

a numeric vale and a string value

The following is an example of a(n) ____. Processing a sales order: 1. Start a new sales order 2. While there are still items to be processed: → Get the quantity and price of the next item → Multiply the quantity by the price to get the total cost for the item → Add the item's total cost to the running total purchase price 3. Multiply the total purchase price by the 6% sales tax rate to get the sales tax amount 4. Ask the customer to choose none, ground or air shipping: → If not being shipped, set the shipping charge to $0 → If ground shipping, set the shipping charge to $10 → If air shipping, set the shipping charge to $20 5. Add the total purchase price, the sales tax amount, and the shipping charge to get the order total and complete the sales order. -assignment statement -algorithm -named constant -machine language

algorithm

What must be created before you can use the Date object's properties and methods? -a string -a number to reference the date -a time for the date to be set to -an instance of the Date object

an instance of the Date object

Which string method returns the character at the "x" position within the string? -indexOf(x) -charAt(x) -charCodeAt(x) -lastIndexOf(x)

charAt(x)

When creating an object using object literal notation: What punctuation is used to separate each property name and value pair (except for the last property name and value pair) declared in an object? -semi-colon (;) -period (.) -comma (,) -exclamation point (!)

comma (,)

One use of JavaScript is to add _____to a web page? -Style -user interactivity -Structure -None of the above

user interactivity


Related study sets

What does each part of PQRST represent?

View Set

NURS 1002 Pharmacology Chapter 27 Quiz: Antipilemic Drugs

View Set

Microeconomics Assignment 3 Part 5

View Set

Ricardos 3rd year second test (code??) ch.1-9

View Set