|
CHAPTER
1 - 2 - 3 - 4
- 5 - 6 - 7 - 8
Chapter
1 - Answers
- (True
or False) JavaScript is an interpreted language.
- JAVA is
a compiled programming language, and is platform independent.
- (True
or False) JAVA and JavaScript were created by the same company.
- Microsoft
Internet Explorer supports the following scripting languages.
- JavaScript
- JAVA
- BASIC
- VBScript
- C++
- Perl
- (True
or False) JavaScript is supported by a large number of browsers.
Chapter
2 - Answers
- Which
of the following are valid variable or function names:
- y
- 100percent
- a big
number
- break
- subtractTwoNumbers
- First_Name
- Place
the brackets in the correct locations indicated by the underscore.
if (
z[0] == 0 ) {
x =
2;
}
- Complete
this sentence: All statements should end in a semicolon.
- True or
False. JavaScript is a case insensitive language.
- True
or False. It is a good idea to add comments to your program code.
- Match
the brackets in Column A with the use in Column B.
|
Column
A
|
Answer
|
Column
B
|
|
a.
{ }
|
b
|
used
for array index values
|
|
b.
[ ]
|
c
|
used
to contain a functions, arguments
|
|
c.
( )
|
a
|
used
to contain multiple JavaScript statements
|
Chapter
3 - Answers
- True or
False. Variables in JavaScript are strongly typed.
- True
or False. You can declare a number of variables all at once.
- The var
keyword is used to declare variables.
- Match
the operator with its function.
|
Column
A
|
Answer
|
Column
B
|
|
a.
=
|
a
|
assignment
|
|
b.
==
|
c
|
addition
|
|
c.
+
|
b
|
equality
|
- Create
an if structure that will make sure the value of the p variable is greater
than or equal to 99, and if so set the total equal to the value of p.
if (
p >= 99 ) {
total
= p;
}
- Create
a function that will multiply two numbers together and return the result.
function
multiplyTwoNum( m, n ) {
var
total;
total
= m * n;
return
total;
}
or
function
multiplyTwoNum( m, n) { return m * n; }
Chapter
4 - Answers
- An object
is a collection of methods and parameters.
- The four
objects that are built into the JavaScript language are:
- String
- Date
- Array
- Math
- (True
or False) The DOM is a collection of objects added to the JavaScript
language by the browser
- (True
or False) Events are key to beginning the execution of your scripts.
- Which
event would you use to start a script after a page has been fully loaded
by the browser?
- onClick()
- onSubmit()
- onLoad()
- onMouseOver()
- onload()
- (True
or False) Events are tied to specific HTML elements.
Chapter
5 - Answers
- What are
the predefined, popup style, dialogue boxes we can use with JavaScript?
- window.popup()
- window.confirm()
- window.prompt()
- Which
type of dialogue box would you use if you want the user to enter some
information?
window.prompt()
- What is
concatenation?
Concatenation
is the combination (or addition) of two or more strings into one string.
Chapter
6 - Answers
- What event
was used to place the cursor in the first field of our FORM?
onFocus
event is used to put the cursor in the first field of the form. It is
used in our example in conjunction with the onLoad event.
- What did
we test to see if the user had entered any information into any of the
fields?
We tested
to see if the length of the string typed in by the user was greater
than one character.
- What does
the "return" statement do?
The
return sends a value back to the statement that invoked it. When a function
is done it can send only one value back, this is done through the return
statement.
- How do
we get the next error message to appear on the next line down?
We use
the \n (newline literal) in the string.
- What function
is used to verify that certain entries are numbers?
The
isNaN() (is not a number) function is used to test a string to see
if it only contains numbers.
Chapter
7 - Answers
- What two
events are used to create the mouse roll-over effect?
onMouseOver
onMouseOut
- What properties
of the image object can you read and write?
src
(source)
lowsrc
(low res source)
- Which
property is a Boolean value you can test for?
complete
- Why do
we pre-load our images?
So that
we can quickly switch between the two image objects when the user is
moving their mouse pointer over and off the image.
- Why is
it important to test to see if the images have completely downloaded?
So that
we don't try to show a user an image that is partially loaded into their
browser.
- What would
you need to add to our script to get it to work with more than two links?
The
only thing you need to add to the script is some new image objects
for the additional links. The logic section does not need to updated.
Chapter
8 - Answers
- What are
the two methods used with popup windows?
window.open()
window.close()
- What are
some good uses of popup windows?
Display
a picture, or more details about a product that a potential customer
is interested in.
- (True
or False) You can not control the size of a popup window?
- (True
or False) It is not common to see popup windows displayed with all of
the features turned off.
|