29 Answers to Review Questions. “Digital Media Primer” Yue-Ling Wong
Chapter 10
When applicable, please choose all correct answers.
1. True/False: If it is strict data typing, a programming language requires that you explicitly declare the data
type of a variable when the variable is first created.
2. The type of the value is called a(n) ______.
A. variable
3. ______ are used to store values, which can be updated and retrieved when the program is running.
A. Variables
B. Functions and procedures
C. Arguments
D. Statements
E. Data types
4. A(n) ______ contains a block of program instructions, which form a discrete unit with a name.
A. variable
5. Values passed into functions or procedures are called ______.
A. variables
B. arguments
C. statements
D. data types
6. ______ can be used to make the program execute nonsequentially.
A. if statements
B. Loops
C. All of the above
7. True/False: A function definition is executed automatically when the program runs.
9. A difference between a function and a procedure is that a ______ returns a value to the calling statement.
A. function
B. procedure
10. True/False: A difference between a function and a procedure is that one takes parameters, whereas the
other does not.
11. sum = addTogether(2,5);
By looking at the previous statement, you can tell that addTogether() ______.
A.definitely returns a value
B. does not return a value
30 Answers to Review Questions. “Digital Media Primer” Yue-Ling Wong
C. takes arguments
D. does not take arguments
E. It is not possible to tell whether or not it returns a value.
F. It is not possible to tell whether or not it takes arguments.
12. sum = addTogether();
By looking at the previous statement, you can tell that addTogether() ______.
13. addTogether(2,5);
By looking at the previous statement, you can tell that addTogether() ______.
A. definitely returns a value
B. may not return a value
C. takes arguments
D. does not take arguments
E. It is not possible to tell whether or not it returns a value.
F. It is not possible to tell whether or not it takes arguments.
14. addTogether();
By looking at the previous statement, you can tell that addTogether() ______.
A. definitely returns a value
B. may not return a value
C. takes arguments
D. does not take arguments
E. It is not possible to tell whether or not it returns a value.
F. It is not possible to tell whether or not it takes arguments.
15. JavaScript is a ______ language.
16. The statement in JavaScript ends with an optional ______.
A. colon ( : )
B. semicolon ( ; )
C. closing parenthesis ( ) )
D. closing curly brace (})
17. True/False: JavaScript syntax is case-sensitive.
18. Which of the following is a valid variable name in JavaScript?
19. To declare a variable in JavaScript, you use the keyword ______.
20. To define a function in JavaScript, you use the keyword ______.
21. Write an if statement to do the following. (Assume the variables have been declared. You do not need to
22. Write an if statement to do the following. (Assume the variables have been declared. You do not need to