CIS 4004 Exam 3
Which modifier of RegExp Object performs case-insensitive matching
-i
What data type can operands store?
Combination of all of these
Syntax Errors
Occur at interpret time
Runtime Errors
Occur during execution
Logical Errors
Occur when a developer made a mistake in the logic
URL
The file the error occurred
JavaScript provides a methodology to validate form data on the client computer before sending it to the web server.
True
JavaScript supports the switch statement which handles a multiway decision making branch. The switch is more efficient than repeated if...else if statements.
True
The break statements indicate the end of a particular case. If they were omitted, the interpreter would continue executing each statement in each of the following cases. This is called "falling through".
True
The current time is displayed with var date = new Date();
True
The do...while loop is similar to the while loop except that the condition check happens at the end of the loop.
True
The process of finding and fixing bugs is called debugging.
True
______ The date the cookie will expire. If this is blank, the cookie will expire when the visitor quits the browser.
expires
$(selector).fadeTo()
fades elements in to the specified opacity
$(selector).fadeToggle()
fades in or out the element identified in the selector given the current state
$(selector).fadeIn()
fades in the element identified in the selector
$(selector).fadeOut()
fades out the element identified in the selector
setInterval(function, duration)
function after every duration milliseconds
clearTimeout(setTimeout_variable)
function calls clears any timer set by the setTimeout() functions.
$(selector).toggle()
hides or shows the element identified in the selector given the current state
$(selector).hide()
hides the element identified in the selector.
The for loop is the most compact form of looping. Of its three parts, which of the following is being described below? "Increase or decrease the looping variable"
iteration statement
$(selector).timer()
jQuery plugin for handling timer events.
The for loop is the most compact form of looping. Of its three parts, which of the following is being described below? "This statement is executed before the loop begins"
loop initialization
In each iteration, one property from ___ is assigned to ___
object, variablename
Which method removes and returns the last element of an array?
pop()
$(selector).show()
shows the element identified in the selector
$(selector).slideDown()
slides down the element identified in the selector
$(selector).slideToggle()
slides up or down the element identified in the selector given the current state.
$(selector).slideUp()
slides up the element identified in the selector
Line breaks are not allowed between the '...' or '..' statement and its label name
continue, break
$(selector).animate()
creates custom animations
description
description of the plug-in, supplied by the developer
_____ can be used as a unary operator that appears before its single operand, which may be of any type
void
hover()
A combination of the mousereenter() and mouseleave() methods.
What is Page Redirection?
A specific URL was clicked to reach a page X but internally were directed to another page Y.
Browsers always give a visual indication when an error occurs.
False
try
Includes the code that will possibly throw an exception
finally
Is optional and executes unconditionally
Line number
Line number in the URL that caused the error.
&&, ||, !, ?: are what type of operators in JavaScript?
Logical operators
Are returns optional?
Yes
Given the source code below, what is the output as a result of the conditional (a.k.a. ternary) operator statement? var age = 56; var price = (age >= 55) ? 10.00 : 20.59; document.writeln("Your price is $" + price);
Your price is $10.00
$(selector).stop()
stops animations
W3C DOM
--Allows access and modifications of all document content and is standardized. -This document object model allows access and modification of all document content and is standardized by the World Wide Web Consortium (W3C) -This model is supported by almost all the modern browsers
Which of the following are limitations of JavaScript in web development? Select all that apply.
-Does not allow the reading or writing of files -Does not have any multi-threading or multiprocessor capabilities -Cannot be used for networking applications
Which of the following are true regarding the JavaScript programming language used in web development? Select all that apply.
-The JavaScript client-side mechanism provides many advantages over traditional CGI server-side scripts -Complementary to and integrated with HTML -It is an interpreted programming language with object-oriented capabilities
==, ===, !=, !==, =>, =<, >, < are what type of operators in JavaScript?
Comparison operators
What are cookies?
In many situations, using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics
Which of the following describes the capability of a class to rely upon another class (or number of classes) for some of its properties and methods?
Inheritance
Which of the following feature has the capability to write one function or method that works in a variety of different ways?
Polymorphism
How do you read a cookie?
Reading a cookie is just as simple as writing one, because the value of the document.cookie object is the cookie
The do...while will always be executed at least once, even if the condition is false.
True
What can put form validation against this event type?
onsubmit Event Type
The "toString()" method of Boolean object.
return a string of either "true" or "false"
JavaScript provides full control to handle loops and___
switch statements
Which method of RegExp Object tests for a match in its string parameter
test()
___ allows a developer to evaluate an expression for its side-effects without the browser displaying the value of the evaluated expression
void
The JavaScript print function ______prints the current web page when executed.
window.print()
Document object
•Each HTML document that gets loaded into a window becomes a document object •The document contains the contents of the page
Legacy DOM
-This is the model which was introduced in early versions of JavaScript language -It is well supported by all browsers, but allows access only to certain key portions of documents, such as forms, form elements, and images --Well supported by all browsers, but allows access only to certain key portions of documents.
Which of the following describes the capability to store related information, whether data or methods, together in an object?
Encapsulation
++ and -- are what type of operators in JavaScript?
Increment and decrement operators
What triggers on a mouse click?
onclick
The for...in loop is used to loop through an object's
properties
Form control elements
•The form object contains all the elements defined for that object such as text fields, buttons, radio buttons, and checkboxes. -Contains all the elements defined for the form object such as a text fields, buttons, radio buttons, and checkboxes.
Window object
•Top of the hierarchy •It is the outmost element of the object hierarchy
Which operator is used in JavaScript for concatenation?
+
IE4 DOM
--Was introduced in Version 4 of Microsoft's Internet Explorer browser. -This document object model was introduced in Version 4 of Microsoft's Internet Explorer browser -IE 5 and later versions include support for most basic W3C DOM features
"lastIndexOf()" method of string object return which of the following, if the specified value is not found
-1
Form object
-All elements enclosed in the form.../form tags -Everything enclosed in the form.../form tags sets the form object
Regarding JavaScript data types, which of the following are recognized primitive data types? Select all that apply.
-Boolean -Numbers -Strings
Which of the following are advantages of using JavaScript in web development? Select all that apply.
-Increased interactivity -Less server interaction -Immediate feedback to the visitors
Regarding JavaScript data types, which of the following are recognized trivial data types? Select all that apply.
-Undefined -Null
The ternary operator, also known as the conditional operator, used to replace an if/else conditional statement, requires how many operands?
3
Given the source code below, what is the output of the do...while loop? var i = 5; do { document.writeln(i); i--; } while( i > 0);
5 4 3 2 1
Return Values: What does the code return? a = 3 b = 5 function sum(a, b) { var result = a + b ;return result; }
8
Which of the following is a feature that has the capability to store one object inside another object?
Aggregation
+, -, *, /, % are what type of operators in JavaScript?
Arithmetic operators
focus()
Function is executed when the form field gets focus.
blur()
Function is executed when the form field loses focus.
mousedown()
Function is executed when the left mouse button is pressed down while over the HTML element
mouseup()
Function is executed when the left mouse button is release while over the HTML element
mouseenter()
Function is executed when the mouse pointer enters the HTML element
mouseleave()
Function is executed when the mouse pointer leaves the HTML element
click()
Function is executed when the user clicks on the HTML element
dblclick()
Function is executed when the user double-clicks on the HTML element
______ is a stateless protocol
HTTP
The comparison operator !== is used to determine what?
If two operands are not identical in value and type
How do you make a printer-friendly page?
Make a copy of the page and leave out unwanted text and graphics, then link to the printer friendly page from the original.
Error message
Message the browser displays for the error
Given the source code below, what is the output of the while loop? var i = 0; while( i < 5) { document.writeln(i); i++; }
NOT: Infinite loop
When using the typeof() operator what does a value of null mean?
No valid data type
Given the source code below, what is the output as a result of the if statement? var age = 17; if(age >= 18) document.writeln("You are old enough to vote<br>");
Nothing
What happens when you go Offline?
Triggers when the document goes offline
A mistake in a program or a script by a developer while coding is referred to as a bug.
True
Associative arrays use strings as index values
True
Basic validation checks to make sure all the mandatory fields are filled in.
True
Data format validation ensures the data entered is checked for correct form and value.
True
Document Object Model (DOM) is the way a document content is accessed and modified
True
Error notifications that show up in the console are the result of both syntax and runtime errors.
True
In Javascript, there is no need to create an instance of the Math object to use it like other objects.
True
JavaScript can be used to move DOM elements around the page according to some sort of pattern determined by a logical equation or function.
True
JavaScript counts months from 0:
True
JavaScript implements the try...catch...finally construct for exception handling capabilities.
True
Logic errors can be the most difficult type of errors to track down.
True
Manual animation can be automated by using the JavaScript function setTimeout().
True
Math.pow(x,y) a method of math object
True
Numeric arrays use numbers as index values
True
Runtime errors are also known as exceptions.
True
Syntax errors are also known as parsing errors,
True
T/F A global variable has global scope which means it can be defined anywhere in JavaScript code.
True
T/F A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.
True
T/F Before using a variable in a JavaScript program, it must declared.
True
T/F JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user initiates explicitly or implicitly.
True
T/F JavaScript supports a composite data type known as object.
True
T/F JavaScript was first known as LiveScript.
True
T/F Operands are data objects manipulated by operators which are part of an expression.
True
T/F Storing a value in a variable is called variable initialization.
True
T/F Variables are declared with the var keyword.
True
The Boolean object represents two values: "true/false".
True
The JavaScript navigator object has child object plugins as an array with an entry for each plug-in installed in the browser to play appropriate multimedia files.
True
The objective of a switch statement is to give an expression to evaluate and several different statements to execute based on the value of the expression.
True
The onerror event handler was the first feature to facilitate error handling in JavaScript.
True
The purpose of a while loop is to execute a statement or code block repeatedly as long as an expression is true.
True
To check JavaScript code for bugs, run it through validating parsers or validators to make sure it is valid and that it follows the official syntax rules of the language.
True
catch
When an exception occurs in the try block, this code is executed
What is an example of an event?
When the page loads
Given the source code below, what is the output as a result of the if...elseif...else statement? var grade = 86; if (grade >= 90) document.writeln("You earned an A"); else if (grade >= 80) document.writeln("You earned a B"); else if (grade >= 70) document.writeln("You earned a C"); else if (grade >= 60) document.writeln("You earned a D"); else document.writeln("You earned an F");
You earned a B
Given the source code below, what is the output as a result of the if...else statement? var age = 50; if (age >= 55) document.writeln("You qualify for the senior citizen rate<br>"); else document.writeln("Your rate is based on regular adult");
Your rate is based on regular adult
What is the proper format to make an alert?
alert("String of text\n More text");
Used to send a warning to the user or alert them to some action
alert()
mimeTypes
an array with one entry for each MIME type supported by the plug-in
There should not be any other statement in between a label name and
associated loop
______ provides the ability to come out of a loop without reaching its bottom
break
Must be followed by a name for the function and open/________
close curly braces
Web Browsers and Servers use HTTP protocol to
communicate
Which method of string object combines the text of two strings and returns a new string
concat()
Which of the following methods of an array concatenates elements from one array to another
concat()
_____ provides the ability to skip a part of the code block and start the next iteration of the loop
continue
filename
executable file that was loaded to install the plug-in
What is the most frequently used event type which occurs when a user clicks the left button of his mouse?
onclick Event Type
Which method of string object splits a String object into an array of strings by separating the string into substrings
split()
The for loop is the most compact form of looping. Of its three parts, which of the following is being described below? "If the condition is true, the code inside the loop will be execute; if the condition is false, the control will come out of the loop"
test statement
action()
the jQuery action to be performed
Which of the following method, defines how many total digits (including digits to the left and right of the decimal) to display of a number.
toPrecision()
which of the following method, returns the string representation of the number's value?
toString()
$
used to define/access jQuery
What is the purpose of this jQuery function $(document).ready(function(){});?
verifies the document is finished loading before performing any actions
(selector)
what to query or find in the HTML elements
setTimeout( function, duration)
•function after duration in milliseconds from now.
name
•name of the plug-in