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

QUESTION 10 What does the variable m hold after these lines execute? var x = [\"

ID: 3820185 • Letter: Q

Question

QUESTION 10

What does the variable m hold after these lines execute?

var x = ["red", "orange", "yellow"", "green", "blue"];
m = x.splice(2, 2);

["red","yellow"]

["yellow","green"]

["red", "orange"]

"["orange","yellow"]

QUESTION 12

This code is an example of ____.

if(document.getElementById) {
  x = document.getElementById("box").value;
}
else {
x = document.form1.box1.value;
}

browser sniffing

browser detection

feature detection

magic number insertion

QUESTION 16

Consider the code below. How do you read Joe's age into the variable y?

var people = [
  {name: "stu", age: 23, height: 72},
{name: "sue", age: 29, height: 72},
{name: "joe", age: 33, height: 72},
{name: "moe", age: 42, height: 72}
];

y = joe.age;

y = people.joe;

y = people[3].age;

y = people[2].age;

What will the variable x hold after the loop finishes? var x = 1; for(var i = 0; i < 5; i++) { x = x + 2; }

11

9

8

none of the above

"Consider the code below. How do your read the value of the width into a variable named w?"

var rect = {length: 9, width: 6};

w = width

w = rect[0]

w = rect.width

w = rect[1]

QUESTION 21

How many times will this loop execute?

x = 0;
sum = 0;

while(x < 4) {
  sum = sum + 10;
}

0

3

4

infinity

QUESTION 22

You run this code in March 2014. what is m?

d = new Date();
m = d.getMonth();

3

Mar

2

March

["red","yellow"]

["yellow","green"]

["red", "orange"]

"["orange","yellow"]

QUESTION 12

This code is an example of ____.

if(document.getElementById) {
  x = document.getElementById("box").value;
}
else {
x = document.form1.box1.value;
}

browser sniffing

browser detection

feature detection

magic number insertion

QUESTION 16

Consider the code below. How do you read Joe's age into the variable y?

var people = [
  {name: "stu", age: 23, height: 72},
{name: "sue", age: 29, height: 72},
{name: "joe", age: 33, height: 72},
{name: "moe", age: 42, height: 72}
];

y = joe.age;

y = people.joe;

y = people[3].age;

y = people[2].age;

What will the variable x hold after the loop finishes? var x = 1; for(var i = 0; i < 5; i++) { x = x + 2; }

11

9

8

none of the above

"Consider the code below. How do your read the value of the width into a variable named w?"

var rect = {length: 9, width: 6};

w = width

w = rect[0]

w = rect.width

w = rect[1]

QUESTION 21

How many times will this loop execute?

x = 0;
sum = 0;

while(x < 4) {
  sum = sum + 10;
}

0

3

4

infinity

QUESTION 22

You run this code in March 2014. what is m?

d = new Date();
m = d.getMonth();

3

Mar

2

March

Explanation / Answer

10, ["yellow","green"]

The splice method is used to remove or add the elements to an array ,it will change the orginal array,here splice(2,2)is removing the 2 and 3 element becuse first parameter is position and 2 is the how many elements hre yellow is in the 2nd position and green is in the third possion

11, feature detection

this code documet.getelementById is getting the element by id if for example we have a text box with id "box"

x= document.getElementById("box").value; x have the value inside a text box

16,{name: "joe", age: 33, height: 72}, because joe is inthe second possition and in json object we can acsess the value like this object[index].key

17. What will the variable x hold after the loop finishes? var x = 1; for(var i = 0; i < 5; i++) { x = x + 2; }

ans: 11 , because x=1 ,in that condion i<5 and i=0 then the loop will execute 5 times

18. Consider the code below. How do your read the value of the width into a variable named w?"

ans : w = rect.width ,in json we can acces the value via object.key

21.

How many times will this loop execute?

x = 0;
sum = 0;

while(x < 4) {
  sum = sum + 10;
}

ans: infinity, because the value of x is not changing the condition is x<4 the condition will satisfy every time.

22. You run this code in March 2014. what is m?

d = new Date();
m = d.getMonth();

ans: 2 , in march we can get the 2 , here we are trying to get the month fom the date the moth is startin from 0 in 0 is jan ,1 is feb ,2 is march so we get 2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote