Name:     ID: 
 
Email: 

JavaScript Programming Midterm

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

 1. 

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

 2. 

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

 3. 

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

 4. 

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

 5. 

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

 6. 

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

 7. 

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

 8. 

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

 9. 

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

 10. 

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

 11. 

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

 12. 

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

 13. 

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

 14. 

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

 15. 

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

 16. 

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

 17. 

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

 18. 

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

 19. 

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

 20. 

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



 
         Start Over