CIS240 E-Commerce Website II (DHTML)
Exam #1 Chapters 1-5
Please mark the correct answer you‟re your sheet.
1. Javascript is a subset of the Java programming language
a. True
b. False
2. Javascript is _______________.
a. object based
b. object oriented
c. procedural
3. Javascript is ____________ by the browser as it reads the code
a. compiled
b. interpreted
c. spell checked
d. ignored
4. The Javascript language is _____________
a. case sensitive
b. client side processing
c. embedded in the HTML
d. all of the above
5. An external Javascript file usually uses a file extension of _____
a. .jscript
b. .javascript
c. .script
d. None of the above
6. Javascript code is case sensitive?
a. True
b. False
7. Which symbol ends a Javascript command?
a. .
b. :
c. ;
d. )
8. Which of the following commands writes to the web page?
a. document.println()
b. document.write()
c. document.writeln()
d. window.write()
9. Javascript will not allow you to change the data type of a variable?
a. True
b. False
10. Which of the following are correct boolean values?
a. on, off
b. “true”, “false”
c. false, true
d. „true‟, false
CIS240 E-commerce Website II (DHTML) Exam 1
11. What will display to the web page given this code?
var redCount = 4;
var blueCount = 8;
var desc = “The total count is “;
document.write(desc + redCount + blueCount);
a. The total count is 12
b. The total count is 48
c. The total count is redCountblueCount
d. descredCountblueCount
12. Which of the following variables are valid?
a. var date;
b. var my Name;
c. var _name;
d. var –name;
13. Given: var counter = 4;
What is the data type of counter after the following command?
counter = “4”;
a. string
b. Javascript will throw an error
c. numeric
d. combined
14. Which one of these produce the same result as x+=1?
a. x++
b. ++x
c. x=x+1
d. all of the above
e. none of the above
15. Which of the following statements will return false?
a. 4!=3 (is not equal to)
b. 3!=4
d. all of the above
e. none of the above
Please complete the following answers
16. List the four components of DHTML. Describe their primary functions within DHTML. (8 points)
HTML: defines the structure of a web page
Cascading Style Sheets (CSS): assigns the look and feel
JavaScript: provides functionality, makes things happen
Document Object Model (DOM): the browser version of the web page
17. Discuss the element and its appropriate use. (3 points)
The tag is used to define a client-side script in JavaScript. Common use is for inserting
JavaScript onto an HTML page.
18. Discuss variables and their purpose in Javascript. (2 points)
A variable is a symbolic name that represents some data that you set. It’s purpose is to store
information so that it can be used later.
CIS240 E-commerce Website II (DHTML) Exam 1
19. What are some rules for naming variables? (2 points)
When assigning a variable name, you cannot use reserved names; it cannot start with a number; and
cannot use a hyphen or a blank space; try to use a good descriptor; and start first word with a lowercase
letter, second with an uppercase letter .
20. Discuss a run time script and how it works (3 points)
A run time script in HTML (shown as ) gives us the ability to include or import scripts (such
as JavaScript), and uses the browser to run them.
21. Discuss a Javascript function and how it works. (2 points)
Jscript functions are a predefined action or activity and only run when called; they can be called
multiple times; they usually go in the header section.
22. Code a simple function that displays an alert box (3 points)
Function example (a,b)
{
Number += a;
Alert (“You have chosen: “ + b);
}
23. What is the general order of operations for mathematical operators? (3 points)
(Please Excuse My Dear Aunt Sally)
Parenthesis, exponents, multiplication, division, addition, subtraction
24. Define the purpose of the following symbols: (9 points)
a) = each side is equal
b) = = tests for equality
c) || value of true when either side is true (or)
d) && value of true when both sides are true (and)
e) // comments out a single line of type
f) /* … */ comments out an entire block of type
g) + adds 2 values together
h) ++ adds one to the value
i) *= multiplies a current value by a given number
CIS240 E-commerce Website II (DHTML) Exam 1