Lesson #3 Review
Questions
1. Variables used in a program are most like ...
2. Which of the
following is NOT a valid name for a variable in JavaScript?
3.Which of the following
is NOT a rule for naming variables?
4. Which of the following is NOT
a 'type' of data in JavaScript?
5. Besides valid
and invalid variable names, we like to have the variable names be helpful
and descriptive. Not too short and not too long. Which of the following would
be valid but unwise to use as a variable name.
6.The use of the
dollar sign $ should be avoided in variable names since some older browser
versions won't accept it.
7. When we use the prompt()
method to store data in a variable, it is always stored as what data type?
8.The keyword 'var' should be used
9. Suppose
you are writing a program to calculate the number of calories in the pizza
you ate for lunch. You use the prompt() method to ask the user for the number
of slices they had. Then multiply the number of slices by 350 calories,
and output the answer. In order to do the math, you need to convert the
number of slices to a float data type. Which method do you need to use?
10. Variables get their data
type from the values that are stored in them, and can change type as the
program executes..
Return to Top of Page | Back
to Main Menu