CIW Exam Questions

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

Consider the following code: <script type=”text/javascript”> var v1 = “alpha”; function f () { var v2 =
“bravo”; alert (v1 + “, ” + v2); } f(); v1=”charlie”; alert (v1 + “, ” + v2); </script> What is the expected
result when you run this script in the browser?

A.
An alert box displaying charlie, bravo

B.
An alert box displaying alpha, bravo followed by an error

C.
Two alert boxes displaying alpha, bravo and alpha, bravo respectively

D.
Two alert boxes displaying alpha, bravo and charlie, bravo respectively, followed by an error

Explanation: