Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) \"The following code ____. var request = new XMLHttpRequest(); request.open(\

ID: 3808097 • Letter: 1

Question

1)

"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()

2)

"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

3)

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);

4(

"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)

"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!';"

6)

"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

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()

2)

"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

3)

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);

4(

"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)

"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!';"

6)

"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

Explanation / Answer

1)Answer:2 option
puts the returned Ajax data into a html element with ID = tmpData

2) Answer:2 option
s = names[1].midterm;

3) Answer: 4 option
document.body.appendChild(x);

4) Answer: ID selector

5) Answer: 2 option
"document.getElementById('d5').value = 'That's All, Folks!';"

6) Answer: class selector