Ensurepass

QUESTION 11

Consider the following code:

clip_image001

What is the expected result when you run this script in the browser?

A.There will be no visible output, but the script will count down to 0.

B.The script will output a countdown from 15 to 0 in the client window.

C.The script will output a countdown from 15 to 1 in the client window.

D.The script will output 15, then 1, because it will only write the first and last values of a while? statement.

 

Answer: C

 

 

QUESTION 12

Consider the following code:

clip_image002

Which statement could be used to determine the value of the first radio button?

A.document.rdoGroup1.value

B.document.myForm.rdoGroup1[0].value

C.document.getElementById(rdoGroup1).value

D.document.getElementById("rdoGroup1").value

 

Answer: B

 

 

QUESTION 13

Which choice best defines events and event handlers?

A.An event can be an action initiated by the user, and an event handler specifies how JavaScript will react to the action.

B.An event is an action initiated by the operating system, and an event handler is a function defined by the user.

C.An event handler can be an action initiated by the user, and an event specifies how JavaScript will react to the action.

D.An event is initiated by an error in JavaScript, and an event handler will attempt to bypass the error and continue.

 

Answer: A

 

 

QUESTION 14

Consider the following code:

clip_image003

What is the output when you run this script in the browser?

A.An alert box displaying the following: John, Paul, George, Ringo

B.An alert box displaying the following: Ringo, John, Paul, George

C.An alert box displaying the following: Ringo, Paul, George

D.An alert box displaying the following: John, Ringo, George

 

Answer: D

 

 

QUESTION 15

Which statement about the JavaScript form object is true?

A.The JavaScript form object has no relationship to the X/HTML <form> element.

B.You can use a single instance of the form object to represent multiple forms on a Web page.

C.The form object cannot be used to access the individual field elements that compose the form.

D.The JavaScript form object is available when the X/HTML <form></form> tags are present in the X/HTML document.

 

Answer: D

 

 

QUESTION 16

Consider the following code:

clip_image004

What is the expected result of this script?

A.When you leave the page, the alert box will display.

B.The page will ignore the function, so a blank page will display on entry and exit.

C.When you enter the page, you will be warned that there is unfinished JavaScript to run.

D.When you leave the page, there will be a JavaScript error because you cannot unload an alert box.

 

Answer: A

 

 

QUESTION 17

Which of the following comparison statements will return true?

A. x = 10; y = 5;

x <= y;

B. x = 10; y = 5;

x !== "X" C. x = 10; y = 5;

x === y;

D. x = 10; y = 5;

x == y;

 

Answer: B

 

 

QUESTION 18

Which statement is true about the getElementByID() method?

A.It returns only the first element with the specified ID.

B.It returns an array containing all elements with the specified ID.

C.If a match is not found for the specified ID, it will attempt searching by name.

D.If a match is not found for the specified ID, it will attempt searching by tag name.

 

Answer: A

 

 

QUESTION 19

Consider the following code:

clip_image005

Will this function generate an error?

A.No, because the code is well-formed

B.Yes, because the alert syntax is incorrect

C.Yes, because there are no valid variables returned

D.Yes, because the passed arguments have not been defined before the function call

 

Answer: D

 

 

QUESTION 20

Which script block will display Hello World in the browser when the script is run?

A.<script type="text/javascript"> var message = "Hello ";

var message2 = "World"; document.write(message + message2);

</script>

B.<script type="text/javascript"> var message = "Hello ";

var message2 = "World"; document.write(message & message2);

</script>

C.<script type="text/javascript"> var message = Hello ;

var message2 = World ; document.write(message + message2);

</script>

D.<script type="text/javascript"> var message = "Hello ";

var message2 = "World"; document.write("message + message2 ");

</script>

 

Answer: A

 

 

Comments are closed.