Name:     ID: 
 
Email: 

JavaScript Programming Final Exam

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 1. 

Which of the following JavaScript statements use arrays?
a.
k = a >> i
c.
k = a(i)
b.
k = a[i]
d.
k = a ^ i
 

 2. 

Which property is used to change the background color?
a.
bgcolor
c.
color
b.
background-color
 

 3. 

Choose the correct comparison operator to alert true, when x is NOT equal to y.
a.
!=
c.
==
b.
< >
 

 4. 

Which HTML tag is used to define an internal style sheet?
a.
<style>
c.
<script>
b.
<css>
 

 5. 

What is the HTML tag to create a hyperlink?
a.
<a>
c.
<target>
b.
<hr>
d.
<img>
 

 6. 

What is the HTML tag to display an image?
a.
<img>
c.
<image>
b.
<pic>
d.
<picture>
 

 7. 

Which is the correct CSS syntax?
a.
body:color=black;
c.
{body:color=black;}
b.
body {color: black;}
d.
{body;color:black;}
 

 8. 

Use the correct Array method to remove the last item of the locations array?
var locations = [“North”, “South”, “East”, “West”];
a.
locations.shift( )
c.
locations.unshift( )
b.
locations.push( )
d.
locations.pop( )
 

 9. 

How do you write “Hello Word” in an alert box?
a.
msg(“Hello World”);
c.
alertBox(“Hello World”)
b.
alert(“Hello World”);
d.
msgBox(“Hello World”);
 

 10. 

Which property is used to change the font of an element?
a.
font-weight
c.
font-family
b.
font-style
 

 11. 

What will be displayed in the <p> element?

<p id="demo"></p>

<script>
       var x = 10;
        x += 5;
        document.getElementById("demo").innerHTML = x;
</script>
a.
15
c.
5
b.
10
d.
105
 

 12. 

Use the correct Math method to return the a decimal number between 0 (inclusive) and 1 (exclusive)?
a.
Math.floor( )
c.
Math.PI
b.
Math.random( )
d.
Math.ceil( )
 

 13. 

What is the correct syntax for referring to an external script called "myScript.js"?
a.
<script name="myScript.js">
c.
<script src="myScript.js">
b.
<script href="myScript.js">
 

 14. 

Which of the following variable names is not valid?
a.
car name
c.
$carname
b.
carName
d.
car_name
 

 15. 

Which of the following HTML tags is the largest heading?
a.
<h6>
c.
<h1>
b.
<h5>
d.
<h4>
 



 
         Start Over