Ensurepass

QUESTION 31

Consider the following code:

clip_image001

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

A.A window alert box will display Hello.

B.A window alert box will display Goodbye.

C.No window alert box will appear because there is an error in the code.

D.A window alert box will display Hello then a second alert box will display Goodbye.

 

Answer: A

 

 

QUESTION 32

Consider the following code:

clip_image002

What is the appropriate parameter for the alert() method in line 5 to reference the text in the firstName text box?

A.document.myForm.value(firstName)

B.document.myForm.firstName.value

C.window.myForm.firstName.value

D.window.myForm.text(firstName)

 

Answer: B

 

 

QUESTION 33

Consider the following code:

clip_image003

When an invalid e-mail address is entered, an alert is displayed to the user, but the form submission is not interrupted. What changes need to be made to the script in order to abort the submission if an invalid e-mail address is entered?

A.Add return false after the alert() statement.

B.Change return to validate in the function call.

C.Add validate false after the alert() statement.

D.Remove the return keyword from the function call and put it in front of the alert() statement.

 

Answer: A

 

 

QUESTION 34

Consider the following code:

clip_image005

What output will appear in the browser when you run this script?

A. "1, 2, 3, 4, 5, 6, 7, 8, 9"

B. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,

C. 1, 2, 3, 4, 5, 6, 7, 8, 9,

D. "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"

 

Answer: B

 

 

QUESTION 35

Suppose you define two variables as follows: var x = 5;

var y = "5";

Which statement will return the mathematical sum of these variables?

A.alert(x + int(y));

B.alert(x + parseInt(y));

C.alert(x + y);

D.alert((int)x + (int)y);

 

Answer: B

 

 

QUESTION 36

Consider the following code:

clip_image006

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

A.A window alert box will display Hello.

B.A window alert box will display Goodbye.

C.No window alert box will appear because there is an error in the code.

D.A window alert box will display Hello then a second alert box will display Goodbye.

 

Answer: C

 

 

QUESTION 37

Consider the following statement: for (X; Y; Z)

What does Z represent in this code?

A.The counter variable

B.The loop counter update expression

C.The condition under which the loop will execute

D.The highest value that the counter variable may reach

 

Answer: B

 

 

QUESTION 38

Which of the following is a practice associated with the security risk known as cross-site scripting (XSS)?

A.Inserting JavaScript code in a URL query string to perform an unintended or malicious action

B.Using a look-alike site to impersonate a trusted site so the user will enter sensitive information

C.Using a certificate authority validation to persuade users to accept a specialized script that can override certain security restrictions in thebrowser

D.Launching a JavaScript statement that has no conditions for ending, thus requiring the user to close the browser in order to end the script

 

Answer: A

 

 

QUESTION 39

What is the purpose of the prototype property in JavaScript?

A.It is used to add properties or methods to a JavaScript object.

B.It returns a list of properties and methods of a JavaScript object.

C.It enables developers to create JavaScript code from a specially formatted prototype flowchart document.

D.It is used to create usage examples of custom objects because its output is not evaluated by the JavaScript interpreter.

 

Answer: A

 

 

QUESTION 40

Which example correctly implements inline scripting with JavaScript?

A.<input type="button" value="Click Here!" onclick=" " />

B.<input type="button" value="Click Here!" onclick="myGreeting();" />

C.<input type="button" value="Click Here!" onclick="alert(‘Hello World! ‘); " />

D.<input type="button" value="Click Here!" />

 

Answer: C

 

 

Comments are closed.