1. Question 1
2 / 2 pts
A reference to an external Javascript file is normally placed in the ____ section of an HTML document,
according to good design principles.
body
Correct!
head
title
paragraph
Question 2
3 / 3 pts
Before you use a variable in a JavaScript program, you should ____ it.
compile
concatenate
Correct!
declare
nullify
Question 3
3 / 3 pts
In naming a variable, the first character must be either a letter or a(n) ____.
Correct!
underscore
pound sign
number sign
ampersand
Question 4
3 / 3 pts
The number can be converted to a text string by enclosing it within ____.
slashes / ... /
single quotation marks ' ... '
2. double quotation marks " ... "
Correct!
either b or c
Question 5
3 / 3 pts
JavaScript ____ most occurrences of white space.
repeats
Correct!
ignores
comments
executes
Question 6
0 / 3 pts
The ____ symbol can be used to combine text strings.
Correct Answer
+
*
You Answered
++
~
Question 7
3 / 3 pts
What does the JavaScript command document.writeln("Hello" + "World"); print?
Hello World
Correct!
HelloWorld
World Hello
WorldHello
Question 8
3 / 3 pts
3. When calling a JavaScript function, you provide in your call ____.
the function name
the parameters
Correct!
both a and b
none of the above
Question 9
3 / 3 pts
A function may require ____, which are values used by the function.
terms
Correct!
parameters
ids
names
Question 10
3 / 3 pts
To add code that runs when content of an input field has been modified, you use the ____ event handler.
onload
Correct!
onchange
onfocus
onblur
Question 11
3 / 3 pts
The ____ event handler runs when the browser has completed unloading the document.
onload
onremove
onerror
Correct!
4. onunload
Question 12
3 / 3 pts
January is indicated by the number ____ in JavaScript.
Correct!
0
1
4
10
Question 13
3 / 3 pts
The ____ method extracts the year value from the date variable.
extractYear()
Correct!
getFullYear()
Year()
thisYear()
Question 14
0 / 3 pts
What does the following generic function called foo return?
function foo()
{
var y = 3;
var x = 4;
y = ++x;
x += y;
return x;
}
You Answered
7
4
Correct Answer
9
5. 5
Question 15
0 / 3 pts
Which of the following calculates the difference in terms of days?
You Answered
days = (newYear - currentDate)/(1000*60*60);
days = (newYear - currentDate)/(1000*60*24);
days = (newYear - currentDate);
Correct Answer
days = (newYear - currentDate)/(1000*60*60*24);
Question 16
3 / 3 pts
Which function makes sure that a number is not greater than the largest numeric value supported by
JavaScript?
isNaN(value)
isNull(value)
isZero(value)
Correct!
isFinite(value)
Question 17
3 / 3 pts
____ converts a text string, myString, to a number with decimal places.
parseText
parseInt
parseNumber
Correct!
parseFloat
Question 18
3 / 3 pts
The ____ logical operator returns true when both expressions are true.
6. ||
|
==
Correct!
&&
Question 19
3 / 3 pts
Which of the following assigns y a value of 15 if x is greater than 1 and less than 3 and 20 otherwise?
Correct!
y = (x > 1) && (x < 3) ? 15 : 20;
y = (x > 1) || (x < 3) ? 15 : 20;
y = (x > 1) && (x < 3) ? 20 : 15;
y = (x > 1) || (x < 3) ? 20 : 15;
Question 20
3 / 3 pts
The general format of the command to specify that a task occur once,after some time, is ____.
setTime("command", interval);
setDelay("command", interval)
Correct!
setTimeout("command", delay);
setInterval("command", delay);
Question 21
3 / 3 pts
To clear all commands set to repeat every n seconds,you use ____.
clearTimeout()
clearRepeat()
clearDelay()
Correct!
clearInterval()
7. Question 22
3 / 3 pts
The ____ property of an array indicates the total number of elements in an array.
counter
index
size
Correct!
length
Question 23
3 / 3 pts
The size of an array is always ____ the highest index number.
equal to
Correct!
one more than
one less than
none of the above
Question 24
0 / 3 pts
____ create(s) an array that could be used to hold five student names.
You Answered
var students =new Array(5);
var students =new Array("John","Julie", "Jacob","Janice", "Jackson");
var students =["Alice", "Max", "Tom", "Stan","Susan"];
Correct Answer
all the choices are correct
Question 25
3 / 3 pts
The ____ method removes and returns the first element from the beginning of an array.
split()
unshift()
8. Correct!
shift()
slice()
Question 26
3 / 3 pts
To sort elements of an array numerically, you use the ____ method.
arrange()
order()
Correct!
sort()
list()
Question 27
3 / 3 pts
Which of the following displays the contents ofarray grades separated by ", "?
grades.push(",");
grades.reverse();
Correct!
grades.join(", ");
grades.toString(",");
Question 28
3 / 3 pts
The process of executing all of the contained statements within a loop is called a(n) ____ of the loop.
Correct!
iteration
implementation
execution
processing
Question 29
0 / 3 pts
Which of the following can be used as a start expression in a For loop?
9. Correct Answer
i = 10;
i++;
You Answered
i <= j;
--j;
Question 30
3 / 3 pts
Given a For loop counterof "for (i = 0; i <= 360; i += 60)", the countervalues are ____.
60, 120, 180, 240, 300, and 360
Correct!
0, 60, 120, 180, 240, 300, and 360
0, 60, 120, 180, 240, and 300
0, 120, 240, and 360
Question 31
3 / 3 pts
Consider the following code:
var i = 0;
do {
document.write("<td>"+i+"</td>");
i = prompt("Enter a number");
}
while (i < 4);
The Do/While loop will execute at least ____ times.
0
Correct!
1
2
3
Question 32
0 / 3 pts
Which of the following loops print the numbers 1-10?
10. for (i = 1; i <= 10; i++){
document.write(i);
}
i = 0;
while (i < 10){
document.write(i+1);
i++;
}
You Answered
i = 0;
do {
j = i + 1;
document.write(j);
i++;
}
while (j <= 10);
Correct Answer
all of the above
Question 33
0 / 3 pts
The value returned by the function someValue (shown below) represents the ____ value found among all
the
values in the array.
function someValue(arr) {
var someVal = arr[0];
for (var i = 0; i < arr.length; i++) {
if (arr[i] > someVal) someVal=arr[i];
}
return someVal;
}
Correct Answer
largest
middle
You Answered
smallest
first
Question 34
3 / 3 pts
A common programming error is to use ____ instead of ____ to test if two items are equal.
Correct!
=, ==
11. ==, =
++, --
%, *
Question 35
3 / 3 pts
Consider the following code:
for (var i = 0; i< names.length; i++) {
if (names[i] == "Valdez") {
document.write("Valdez is in the list");
}
}
What should be added to cause the loop to stop when Valdez is found?
halt;
Correct!
break;
stop;
continue;
Question 36
0 / 3 pts
Consider the following code:
num = 1;
for(i = 1; i < 4; i++) {
num += 2;
}
What will the value of num be after the loop has executed?
1
You Answered
3
5
Correct Answer
7
Question 37
3 / 3 pts
A series of if statements that are inside of each otherare also called a ____ statements.
12. n-alternative if
Correct!
nested if
case
loop
Question 38
3 / 3 pts
Which of the following if statements will write hours to the screen in a 12 hourformat (assuming hours
starts as a variable value between 0 and 23)?
if(hours==0) {
document.write(12); }
elseif(hours>13) {
document.write(hours-12);}
else {
document.write(hours); }
if(hours==0) {
document.write(12); }
elseif(hours>=12) {
document.write(hours-12);}
else {
document.write(hours); }
Correct!
if(hours==0) {
document.write(12); }
elseif(hours>=13) {
document.write(hours-12);}
else {
document.write(hours); }
if(hours==0) {
document.write(12);}
else if(hours>=0) {
document.write(hours);}
else if(hours > 12) {
document.write(hours-12);}
Question 39
3 / 3 pts
The topmost object in the object hierarchy is the ____ object, which represents the browser window.
document
browser
Correct!
13. window
location
Question 40
3 / 3 pts
To have a date field display the text string "6-23-2006" you would run the command ____.
form1.date.when = "6-23-2006";
Correct!
document.form1.date.value = "6-23-2006";
form1.date.value = "6-23-2006";
document.form1.date = "6-23-2006";
Question 41
3 / 3 pts
A return value of ____ causes a form to cancel submission.
Correct!
false
halt
true
continue
Question 42
3 / 3 pts
In JavaScript, you can use the ____ to display an information message to the user.
dialog window
info box
Correct!
alert box
user box
Question 43
3 / 3 pts
14. If a text input field is required on a form, you should validate it by making sure the number of characters in
the
field is ____.
Correct!
> 0
< 0
> null
none of the above
Question 44
3 / 3 pts
Given the example text= "GPS-ware Products",the method text.slice(4,8);// returns ____.
9
Prod
Correct!
ware
GPS
Question 45
3 / 3 pts
The ____ method of the String class extracts a part of a string and returns the extracted part as a new string.
getChars()
charAt()
Correct!
slice()
stringPart()
Question 46
3 / 3 pts
The ____ method converts a text string to lowercase.
toMinCase()
lowerCase()
Correct!
15. toLowerCase()
toUpperCase()
Question 47
3 / 3 pts
Given the following form:
<form name="myForm">
Submit your URL here:
<input type = "text" name="URL">
<input type="submit">
</form>
Which of the following is not a valid way to get the data entered in the textbox and store it in a varible?
var data =myForm.URL.value;
var data =myForm.elements[0].value;
Correct!
var data = forms[0].url.value;
All of the above are correct
Question 48
0 / 3 pts
The expression /ww/ matches ____.
$x
You Answered
A@
*
Correct Answer
go
Question 49
3 / 3 pts
____ matches 1 or more consecutive white space characters.
/s?/
Correct!
/s+/
/s&/
16. /s*/
Question 50
3 / 3 pts
To require a string to end with a specific regular expression pattern, you begin the regular expression
pattern with the ____ metacharacter (or special class).
Correct!
$
^
|
&
Question 51
3 / 3 pts
Text strings can be appended to any URL by adding the ____ character to the Web address followed by the
text
string.
^
&
*
Correct!
?
Question 52
3 / 3 pts
To make it possible to store state information beyond the current Web page session,Netscape created ____.
Correct!
cookies
scripts
hidden form fields
query strings
Question 53
3 / 3 pts
To view the name/value pair within a cookie, retrieve the content of the ____ object.
17. document.path
Correct!
document.cookie
cookie.path
cookie.document
Question 54
0 / 3 pts
Individual cookies in the document.cookie object are separated by ____.
You Answered
a semicolon
a space
Correct Answer
a semicolon and a space
none of the above
Question 55
3 / 3 pts
To replace a cookie's value, write a cookie with the same ____ but a new value.
Correct!
name
location
expiration date
timing delay
Question 56
3 / 3 pts
____ cookies remain available only for the current browser session.
Persistent
Correct!
Temporary
Local
18. Global
Question 57
3 / 3 pts
The ____ attribute of the cookie property determines how long a cookie can remain on a client system
before it
is deleted.
path
Correct!
expires
secure
domain
Question 58
3 / 3 pts
The ____ attribute determines the availability of a cookie to other Web pages on a server.
domain
secure
Correct!
path
expires
Question 59
0 / 3 pts
Which statement is true?
You Answered
To use jQuery, you do not have to do anything. Most browsers (Internet Explorer, Chrome, Firefox and
Opera) have the jQuery library built in the browser
Th use jQuery the user needs to add a jQuery plugin to their browser
To use jQuery, you must buy the jQuery library at www.jquery.com
Correct Answer
To use jQuery, you can refer to a hosted jQuery library at Google
Question 60
3 / 3 pts
19. Which of the following is not a standard part of the jQuery UI?
accordion
dialog
Correct!
cycle
datepicker
Question 61
3 / 3 pts
With jQuery, look at the following selector: $("p.links"). What does it select?
The first p element with class="links"
All p elements with id="links"
Correct!
All p elements with class="links"
The first p element with id="links"
Question 62
3 / 3 pts
Which jQuery method is used to display selected elements?
display(block)
Correct!
show()
visible()
visible(true)
Question 63
3 / 3 pts
Which jQuery method is used to set add one or more css classes to selected elements?
css()
addCSS()
addStyle()
Correct!
20. addClass()
Question 64
3 / 3 pts
Which jQuery method is used to perform an asynchronous HTTP request?
ajaxRequest()
ajaxAsync()
Correct!
ajax()
ajaxSetup()
Question 65
3 / 3 pts
An important step in preparing to publish a Web site is to obtain a(n) __________ name.
Correct!
domain
index
AVI
ICANN
Question 66
0 / 3 pts
In an FTP application, a(n) __________ name specifies a particular connection to a server.
Correct Answer
site
streaming
You Answered
host
encoded
Question 67
3 / 3 pts
Which of the following is commony done as part of website compatibility testing?
Test with a variety of users
21. Verify that all of yourimages have alt attributes
Correct!
Use different devices when testing your site
Assess the numberof simultaneous users the website can support
Quiz Score: 164 out of 200