Professional Documents
Culture Documents
Module 2 - Self-Test: Name: Date: Quiz Score
Module 2 - Self-Test: Name: Date: Quiz Score
1. What is the purpose of the <script> and 10. Which of the following items indicates that a
</script> tags in a HTML document? multiline of comment is added in a JavaScript
a. It tells the browser where a JavaScript code?
begins and ends in the HTML document a. /* */
b. To tell the browser the scripting b. /-
language to be used c. //
c. To point to a scripting language file d. <!--
d. All of the above
2. When would it be a good idea to use an
external JavaScript file?
a. If the script is short and/or will just be
used by one HTML document
b. When the target audience use older
browsers
c. When the script is very long and will be
used by more than one HTML
document
d. External JavaScript files are not
recommended in general
3. JavaScript is case-sensitive
a. Yes
b. No
4. All JavaScript statements are terminated with
a semicolon (;).
a. Yes
b. No
5. An external JavaScript file uses a filename
extension of ______________?
a. .html
b. .java
c. .css
d. .js
6. Which of the following html <script>
attributes correctly points you to an external
JavaScript?
a. type
b. src
c. link
d. language
7. What JavaScript method is used to output a
string of text on a Web page?
a. document.write()
b. document.print()
c. document.type()
8. A method property used to get / set the HTML
content of an element that will allow the
JavaScript code to manipulate a webpage
content being displayed.
a. getElementById
b. log
c. innerHTML
d. print
9. Which of the following items would you use to
add a single line of comment in your
JavaScript code?
a. /*
b. /-
c. //
d. <!—
1. What is the purpose of the <script> and 7. What JavaScript method is used to output a
</script> tags in a HTML document? string of text on a Web page?
a. It tells the browser where a JavaScript a. document.write()
begins and ends in the HTML document b. document.print()
b. To tell the browser the scripting c. document.type()
language to be used 8. A method property used to get / set the HTML
c. To point to a scripting language file content of an element that will allow the
d. All of the above JavaScript code to manipulate a webpage
2. When would it be a good idea to use an content being displayed.
external JavaScript file? a. getElementById
a. If the script is short and/or will just be b. log
used by one HTML document c. innerHTML
b. When the target audience use older d. print
browsers 9. Which of the following items would you use to
c. When the script is very long and will be add a single line of comment in your
used by more than one HTML JavaScript code?
document a. /*
d. External JavaScript files are not b. /-
recommended in general c. //
3. JavaScript is case-sensitive d. <!—
a. Yes 10. Which of the following items indicates that a
b. No multiline of comment is added in a JavaScript
4. All JavaScript statements are terminated with code?
a semicolon (;). a. /* */
a. Yes b. /-
b. No c. //
d. <!--
5. An external JavaScript file uses a filename
extension of ______________?
a. .html
b. .java
c. .css
d. .js
6. Which of the following html <script>
attributes correctly points you to an external
JavaScript?
a. type
b. src
c. link
d. language
1. Which of the following type of variable is 5. What will be the output of the following code:
visible only within a function where it is
defined?
a. global variable
b. local variable
c. functional variable
d. none of these
2. When naming variables in JavaScript, which of
the following items is correct?
a. The name must contain only letters,
digits, or the symbols $ and _ a. a is of type typeof12
b. The name must contain only letters b. a is of type number
and digits c. a is of type string
c. The name must contain only letters, d. error
and the symbols %, #, $ and _ 6. To declare a variable, which of the following
d. The name must contain only letters, reserved words should you use?
digits, and start with digits and the a. var, let, const
symbols $ and _ b. for
3. What symbol is used to separate multiple c. function
variables in one line? d. switch
a. Period . 7. JavaScript reserved words can be used as
b. Colon : variable names.
c. Semicolon ; a. True
d. Comma , b. False
4. Which of the following is not a correct method 8. Variable names are case sensitive.
of declaring a variable in JavaScript? a. True
a. var b. False
b. int 9. Which of the following items would be a valid
c. const variable name in JavaScript?
d. let a. #Name
b. @Name
c. ()Name
d. $Name
10. What data type is emp in the given
declaration: var emp={name:”Daniel”,
age:15, gender:”male”};?
a. array
b. string
c. object
d. none of these