Name:     ID: 
 
Email: 

JavaScript Programming Midterm

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

 1. 

How do you create a function in JavaScript?
a.
function = myFunction( )
c.
function:myFunction( )
b.
function myFunction( )
 

 2. 

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

 3. 

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

 4. 

Inside which HTML element do we put the JavaScript?
a.
<javascript>
c.
<script>
b.
<scripting>
d.
<js>
 

 5. 

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

 6. 

Which operator is used to assign a value to a variable?
a.
x
c.
*
b.
-
d.
=
 

 7. 

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”);
 

 8. 

How do you add a comment in JavaScript?
a.
‘This is a comment
c.
//This is a comment
b.
#This is a comment
 

 9. 

How do you declare a JavaScript variable?
a.
var carName;
c.
variable carName;
b.
v carName;
 

 10. 

Where in an HTML document is the correct place to refer to an external style sheet?
a.
In the <head> section
c.
At the end of the document
b.
In the <body> section
 

 11. 

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

 12. 

Which of the following HTML tags is not valid?
a.
<h8>
c.
<h5>
b.
<h1>
d.
<h4>
 

 13. 

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

 14. 

typeof (‘3 + 4’) will return a
a.
Number
c.
String
b.
7
d.
3 + 4
 

 15. 

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

 16. 

Which of the following table tags is used to create a table row?
a.
<table>
c.
<td>
b.
<th>
d.
<tr>
 

 17. 

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

 18. 

How you can open the link in new window?
a.
target="_new"
c.
target="_blank"
b.
target="_window"
 

 19. 

Where is the correct place to insert a JavaScript
a.
The <body> section
c.
Both the <head> and <body> section are correct
b.
The <head> section
 

 20. 

How do you call a function named “myFunction”?
a.
myFunction( )
c.
call function myFunction( )
b.
call myFunction( )
 



 
         Start Over