HOMEWORK 4
Chapters 18,19,(20),12,13
1)
Define
the following terms:
a.
variable
b.
event
handler
c.
Trojan
program
d.
privacy
e.
virus
f.
cookies
g.
encryption
h.
random
numbers
2)
Discuss
what a user can do to make a personal computer more secure.
3)
You
have a variable called credits that holds the number of credits that
a student has. Write a JavaScript
statement that alerts the user if he/she should apply for graduation by
checking if credits is more than 100.
4)
Trace
the following JavaScript code. At each
line show what is in the variables by filling in the chart below:
a. var cost = 0;
b. var taxRate = .08;
c. var present = "videogame";
d. if (present == "sweater")
e. cost = 15;
f. else if (present == "watch")
g. cost = 30;
h. else if (present == "videogame")
i. cost = 100;
j. cost = cost + cost * taxRate;
k. present = “none”;
|
Line number |
cost |
present |
taxRate |
|
a |
|
|
|
|
b |
|
|
|
|
c |
|
|
|
|
d |
|
|
|
|
e |
|
|
|
|
f |
|
|
|
|
g |
|
|
|
|
h |
|
|
|
|
i |
|
|
|
|
j |
|
|
|
|
k |
|
|
|
5)
What
would occur if you changed line h above to (notice the capital ‘V’
in the word Videogame):
if (present == "VideoGame")?
6)
What
is the dot operator in JavaScript (object.property)? Give an example of when it might be used.