Animated Ball UMUC Logo
http://polaris.umuc.edu/~flazarus/

Trial Final Exam
CMST 398J - Programming with JavaScript

Please answer the 10 questions shown below.
Each one is worth up to 4 points. Be complete,
but no fluff please. Be neat and orderly. If I can
not easily understand your answer it will be
marked as incorrect. You may use whatever text
or notes you wish. All questions relate to HTML,
JavaScript, or CSS code blocks.


1. What is the meaning of each of the following
expressions?

a. A && B
b. the + cat ('the' and 'cat' are strings)
c. 12/3
d. A == B
e. --i
f. A <= B
g. A || B
h. <! -- -->

2. What are the constraints on naming
JavaScript variables?

3. How is the JavaScript setTimeout() method
used?

4. Contrast the use of if and else in
conditional JavaScript statements.

5. How is the JavaScript onBlur event handler
used?

6.  What does the following JavaScript do? There
is no need to detail how this script works
just describe what is presented to the viewer.

<html>
<head>
	<title>JavaScript quiz</title>
<script language="JavaScript"
type="text/javascript">
<!-- Engage Cloaking Device
function play() {
var player = Math.round(Math.random() * 100)
% 6+1;
var house = Math.round (Math.random() * 100)
% 6+1;
var winner = "";
  if (player > house) {
    winner = "Player";
  }
  else if (house > player) {
    winner = "House";
  }
  else winner = "Nobody";
var game = "Both Players Role\n\nPlayer Rolls A
" +
player + "\nHouse Rolls A " + house + "\n\n" +
winner + " WINS";
alert(game);
}
// Drop Cloak -->
</script>
</head>
<body>
<form>
<input type = "button"  value = "Play"
onclick = "play()">
</form>
</body>
</html>

7. How is the z-index attribute of the <layers> tag used?

8. What is a browser's DOM?

9a. What is wrong with this code?

<script language="JavaScript" type="text/javascript">
<!-- Engage Cloaking Device
x=12
Document.write(x)
// Drop Cloak -->
     
9b. In most circumstances terminating a Javascript statement
with a semicolon delimiter is SUGGESTED as a good practice.
When is a semicolon delimiter mandatory?
   
10. How is the<div> tag used in JavaScripts?

Go BackBack

Return to Index