QUESTION 1 The ____ method repeatedly executes the same code after being called
ID: 3808098 • Letter: Q
Question
QUESTION 1
The ____ method repeatedly executes the same code after being called only once.
setInterval()
clearTimeout()
none of the other answers
clearInterval()
5 points
QUESTION 2
The ____ property of the Image object allows JavaScript to dynamically change an image.
src
img
path
file
5 points
QUESTION 3
"The following code ____.
var request = new XMLHttpRequest();
request.open(""GET"", url);
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
document.getElementById( tmpData').innerHTML = request.responseText;
}
};
request.send(null);"
calls a function named readyState to handle the returned Ajax data
puts the returned Ajax data into a html element with ID = tmpData
calls a function named request to handle the returned Ajax data
displays the returned data in a alert()
5 points
QUESTION 4
"Given the following, how would you assign Bob's midterm score to a variable?.
var names = [
{'name':'Alice', 'midterm': '78', 'final': '87'},
{'name': 'Bob', 'midterm"": '72', 'final': '77'},
{'name': 'Clare', 'midterm': '91', 'final': '97'},
{'name': 'Dave', 'midterm': '79', 'final': '85'}
];"
s = names.midterm;
s = names[1].midterm;
s = Bob.midterm;
s = names[2].midterm
5 points
QUESTION 5
Ajax makes use of the built in ____ object.
XMLRequestHttp
XMLHttpRequest
XMLRequest
HttpRequest
5 points
QUESTION 6
After an Ajax request is in progress a property named readyState holds an integer that indicates the progress of the data transfer.
True
False
5 points
QUESTION 7
The ____ method returns the first element in a document with a matching id attribute.
getElementById()
getElementByIdTag()
getElementByName()
getElementByTab()
5 points
QUESTION 8
Client-side JavaScript is often used to validate HTML form data before it is submitted to the web server.
True
False
5 points
QUESTION 9
"Consider this code. Which of the following tacks the division onto the end of the page?
x = document.createElement('div');
x.innerHTML = 'All's well that ends well';
document.body.append.x;
"body.appendChild(""div"");"
document.body.add(x);
document.body.appendChild(x);
5 points
QUESTION 10
"In the following code, #sidebar is a CSS _____.
<style type=""text/css"">
#sidebar {width: 620px;}
.caution {font-size: 12pt; color: blue}
</style>"
class selector
ID selector
none of the other answers
tag selector
5 points
QUESTION 11
By default an Ajax exchange is ____.
asynchronous
synchronous
delayed by 3 seconds
delayed by 4 seconds
5 points
QUESTION 12
"To be certain that all images are downloaded into a cache before commencing an animation sequence, you use the ____ event handler of the Image object."
oncache
onload
onopen
onsaved
5 points
QUESTION 13
The ____ event handler executes when a form is submitted to a server-side script.
onexit
onsubmit
none of the other answers
onsend
5 points
QUESTION 14
The ____ method returns an array of elements that match a specified tag name.
getElementsByName()
getElementsByTagId()
getElementsByTagName()
getElementsById()
5 points
QUESTION 15
"How would you get a reference to a HTML element with an id ='p3' ?"
p3 = getElementById();
"x = document.getElementByID('p3');"
x = document.getelementById(p3);
"x = document.getElementById('p3');"
5 points
QUESTION 16
The purpose of the Ajax same origin policy is to prevent malicious scripts from causing trouble.
True
False
5 points
QUESTION 17
____ allows JavaScript to store and retrieve an image from memory rather than download the image each time it is needed.
Double buffering
Image refreshing
Image quick loading
Image caching
5 points
QUESTION 18
"You have a HTML division with an id = 'd5'. How do you assign the string 'That's All, Folks!' to the division's contents?"
"document.getElementsByID('d5').innerHTML = 'That's All, Folks!';"
"document.getElementById('d5').value = 'That's All, Folks!';"
"getElementById('d5').value = 'That's All, Folks!';"
"document.getElementById('d5').innerHTML = 'That's All, Folks!';"
5 points
QUESTION 19
The HTML form element's _____ attribute determines whether the form makes a GET request or a POST request to the web server.
enctype
accept-charset
action
method
5 points
QUESTION 20
"In the following code, .caution is a CSS _____.
<style type="text/css">
#sidebar {width: 620px;}
.caution {font-size: 12pt; color: blue}
</style>"
id selector
none of the other answers
tag selector
class selector
setInterval()
clearTimeout()
none of the other answers
clearInterval()
Explanation / Answer
Question 1> Answer = setInterval()
> setInterval(t,function_def) function loops the function_def provided as an argument after time t provided as an argument
> clearInerval() will detroy the setInterval object
> clearTimeout will destroy the setTimeout object
Question 2 > Answer = src
since an img has syntax
<img src="file_path" >
javascript uses src attribute to change the image
Question 3 > Answer = puts the returned Ajax data into a html element with ID = tmpData
readyState is variable whose value is monitored
request in a object sent to browser
there is no alert() function used
Question 4 > Answer = "s = names[1].midterm;"
> names is an array object which contains many json object
> Bob is not an object
> since array indexing starts with 0 , names[1] returns Bobs object and not
names[2]
Question 5 > Answer = XMLHttpRequest
Question 6 > Answer = True
Question 7 > Answer = getElementById()
getElementByIdTag() = returns node List by tag name
getElementByName() = returns node List by no
getElementByTab() = not a valid syntax
Question 8 > Answer = True
Question 9 > Answer = document.body.appendChild(x);
document.body.append.x; // incorrect syntax , append is a function not object
"body.appendChild(""div"");" // div is not object
document.body.add(x); // add is no method
document.body.appendChild(x); // correct
Question 10 > Anser = ID selector
class selector uses "." dot not Hash "#" , Refer Question 20 at the bottom
tag selector uses tag name
Question 11 > Answer = asynchronous
Question 12 > Answer = onload
Question 13 > Answer = onsubmit
rest option doesnot exist
Question 14 > Answer = getElementsByTagName()
getElementsByTagId() doesnot exist
Question 15 > Answer = "x = document.getElementById('p3');"
p3 = getElementById(); // compilation error
"x = document.getElementByID('p3');" // D is capital
x = document.getelementById(p3); // p3 will be read as a variable not value
Question 16 > Answer = True
Question 17 > Answer = Image caching
Question 18 > Answer = document.getElementById('d5').innerHTML = 'That's All, Folks!';"
"getElementById('d5').value = 'That's All, Folks!';" // div doesnt have a value attribute
Question 19 > Answer = method
action // hold the URL of the handler
Question 20 > Answer = class selector
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.