Name:     ID: 
 
Email: 

JavaScript Programming Midterm

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

 1. 

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

 2. 

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

 3. 

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

 4. 

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

 5. 

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

 6. 

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

 7. 

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

 8. 

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

 9. 

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

 10. 

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

 11. 

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

 12. 

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

 13. 

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

 14. 

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

 15. 

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

 16. 

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

 17. 

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

 18. 

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

 19. 

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

 20. 

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
 



 
         Start Over