JavaScript 6e – Test Review Questions
Chapter 2: Working with Functions, Data Types and Operators
True / False	
1. In JavaScript code, you use the words yes and no to indicate Boolean values.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
97	

2. A comparison operator is used to compare two operands and determine if one numeric value is greater than another.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
118	

3. A logical operator is used to compare two string operands for equality.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
123	

4. Parentheses are used with expressions to change the associativity with which individual operations in an expression are evaluated.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
129, 130	

5. ​An anonymous function is a set of related statements that is assigned a name.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
74	

Multiple Choice
	
6. In JavaScript programming, you can write your own procedures, called ____, which refer to a related group of JavaScript statements that are executed as a single unit.
 	
a. 	
programs	
b. 	
functions	

c. 	
modules	
d. 	
objects	

REFERENCES:  	
73, 74, 	

7. A(n) ____ is a variable that is used within a function.
 	
a. 	
method	
b. 	
property	

c. 	
parameter	
d. 	
operator	

REFERENCES:  	
75	

8. A(n) ____ statement is a statement that returns a value to the statement that called the function.
 	
a. 	
return	
b. 	
replace	

c. 	
value	
d. 	
exit	

REFERENCES:  	
86	

9. A ____ variable is one that is declared outside a function and is available to all parts of your program.
 	
a. 	
local	
b. 	
limited	

c. 	
scoped	
d. 	
global	

REFERENCES:  	
87	

10. Data types that can be assigned only a single value are called ____ types.
 	
a. 	
primitive	
b. 	
null	

c. 	
numeric	
d. 	
Boolean	

REFERENCES:  	
91	

11. Programming languages that require you to declare the data types of variables are called ____ typed programming languages.
 	
a. 	
dynamic	
b. 	
strongly	

c. 	
static	
d. 	
loosely	

REFERENCES:  	
92, 93	

12. JavaScript is a ____ programming language.
 	
a. 	
static typed	
b. 	
loosely typed	

c. 	
strongly typed	
d. 	
numeric typed	

REFERENCES:  	
93	

13. A(n) ____ is a positive or negative number with no decimal places.
 	
a. 	
floating-point number	
b. 	
scientific number	

c. 	
exponential number	
d. 	
integer	

REFERENCES:  	
93	

14. A literal string can be assigned a zero-length string value called a(n) ____ string.
 	
a. 	
empty	
b. 	
undefined	

c. 	
short	
d. 	
byte	

REFERENCES:  	
98	

15. You can use the compound ____ to combine two strings.
 	
a. 	
value separator	
b. 	
equals comparison	

c. 	
assignment operator	
d. 	
declaration operator	

REFERENCES:  	
100	

16. A(n) ____ tells the compiler or interpreter that the character that follows it has a special purpose.
 	
a. 	
exclamation point	
b. 	
escape character	

c. 	
null character	
d. 	
upper case character	

REFERENCES:  	
101	

17. The strict equal operator is ____.
 	
a. 	
=	
b. 	
==	

c. 	
===	
d. 	
!=	

REFERENCES:  	
104, 118, 119	

18. You can use an arithmetic operator to return the modulus of a calculation, which is the ____ when you divide one number by another number.
 	
a. 	
remainder left	
b. 	
quotient	

c. 	
product	
d. 	
difference	

REFERENCES:  	
105	

19. The And operator is ____.
 	
a. 	
!=	
b. 	
||	

c. 	
&&	
d. 	
===	

REFERENCES:  	
104, 123, 124	

20. The ____ operator executes one of two expressions based on the results of a conditional expression.
 	
a. 	
.	
b. 	
()	

c. 	
,	
d. 	
?:	

REFERENCES:  	
125	

21. Which arithmetic operators have the highest precedence?
 	
a. 	
* / %	
b. 	
< <=	

c. 	
&&	
d. 	
+ -	

REFERENCES:  	
127, 128	

22. Which of the following is a logical operator?​
 	
a. 	
​++	
b. 	
​()	

c. 	
​==	
d. 	
​||	

REFERENCES:  	
123, 124	

23. Which of the following is a false value?​
 	
a. 	
​true	
b. 	
​-1	

c. 	
​0	
d. 	
​1	

REFERENCES:  	
122, 123	

24. Function statements are contained within the​ function ____.
 	
a. 	
​parameters	
b. 	
​braces	

c. 	
​arguments	
d. 	
​parentheses	

REFERENCES:  	
75	

25. The variables or values that you place in the parentheses of a function call statement are called ____.​
 	
a. 	
​string operators	
b. 	
​primitive types	

c. 	
​arguments	
d. 	
​event listeners	

REFERENCES:  	
79	

Completion	

26. Placing a parameter name within the parentheses of a function definition is the equivalent of declaring a new ____________________.
REFERENCES:  	
75	

27. A(n) ____________________ type is the specific category of information that a variable contains.
REFERENCES:  	
91	

28. Sending arguments to the parameters of a called function is called ____________________ arguments.
REFERENCES:  	
79	

29. A(n) ____________________ variable is declared inside a function and is available only within the function in which it is declared.
REFERENCES:  	
87	

30. A(n) ____________________ operator requires an operand before and after the operator.
REFERENCES:  	
105	

Subjective Short Answer	
31. Describe the two types of functions and explain when you'd use each type.
REFERENCES:  	
74	

32. Define variable scope, and describe the two types of variable scope and how you create each.
REFERENCES:  	
87	

33. JavaScript supports five primitive data types. Name and describe these types.
REFERENCES:  	
91	

34. Operator precedence is the system that determines the order in which operations in an expression are evaluated.
REFERENCES:  	
127	

35. What is a browser console and how is it useful for a web developer?
REFERENCES:  	
83	

36. What is the relationship between Boolean values, truthy values, and falsy values?​
REFERENCES:  	
97, 122, 123	

37. What is the difference between the operation of the + operator ​with numbers and with strings? Provide an example of each, including the results.
REFERENCES:  	
100, 106	

38. What are the differences between using a the increment and decrement unary operators as prefix operators versus using them as postfix operators?​
REFERENCES:  	
109	

39. Explain what logical operators are, and then list the 3 JavaScript logical operators and explain​ what each does.
REFERENCES:  	
123,  124	

40. What are the advantages of using the addEventListener() method instead of the other two methods to specify an event handler?​
REFERENCES:  	
80,  81