Pre-Test Lesson 8: Understanding JavaScript and Coding Essentials

Transcription

Pre-Test Lesson 8: Understanding JavaScript and Coding Essentials
Pre-Test Lesson 8: Understanding JavaScript and Coding Essentials
1. jQuery, MooTools, and YUI are examples
of JavaScript ______.
a) methods
b) libraries
c) event handlers
d) functions
2. Which of the following is a valid name for
a JavaScript function?
a) 1example$1
b) [abc]var1_$
c) example$1
d) *my.function
3. Which syntax defines a new variable in
JavaScript?
a) new
b) type
c) value
d) var
4. What is the proper syntax for an alert
box?
a) alert{'You clicked the button'}
b) alert = 'You clicked the button'
c) alert('You clicked the button')
d) (alert)('You clicked the button')
5. Which JavaScript property do you use to
change the current content of an HTML
element?
a) innerHTML
b) insideHTML
c) modifyHTML
d) changeHTML
6. Which symbol or punctuation mark
indicates the end of a JavaScript statement?
a) closing curly bracket
b) question mark
c) semicolon
d) closing quote mark
Name: _____________________
7. Which of the following is true of alert
boxes? (Choose all that apply.)
a) They are often used in business and
consumer applications.
b) They respond to user actions.
c) They are used to send and receive files.
d) They are commonly used for testing and
debugging.
8. Which technology is most often used to
add action and interactivity to a Web
application?
a) HTML
b) CSS
c) JavaScript
d) all of the above
9. A computer program is most like a ________?
a) shopping list
b) newspaper article
c) memo
d) recipe
10. Which of the following is true of
JavaScript functions?
a) Functions are reusable.
b) The action of a function is the sequence
of the actions of the statements inside of it.
c) The definition of a function provides
action.
d) A function is always custom-created.
11. You can include JavaScript code in which
section of an HTML document?
a) <title>
b) doctype declaration
c) <script>
d) <body>
12. What is the purpose of a variable?
a) stands for data
b) names a sequence of actions
ID: _____________________ Tel: ___________________
8-1
Pre-Test Lesson 8: Understanding JavaScript and Coding Essentials
c) invokes actions
d) works only with an alert box
13. You are preparing to create an
application. Which of the following might
be highly useful to reduce the amount of
time spent coding?
a) variables
b) JavaScript libraries
c) identifiers
d) functions
14. What is the following general code
syntax most often associated with?
<script type = "text/javascript"
src = "URL or local address"></script>
a) variables
b) JavaScript libraries
c) identifiers
d) functions
18. Which of the following is true of
JavaScript methods?
a) they are exactly the same as functions
b) they’re always associated and used with
a particular object
c) isNaN() is an example of a JavaScript
method
d) document.getElementById() is an
example of a JavaScript function
19. Which of the following can you use in
JavaScript to add elements after the HTML
displays onscreen? (Choose all that apply.)
a) getElementById
b) createElement
c) appendElement
d) appendChild
20. You are creating an application that
shows and hides a paragraph based on the
value a
user enters. Which of the following is most
appropriate for coding the show/hide
interactivity?
a) innerHTML
b) createElement
c) appendChild
d) display attribute
15. What is the general action of the
getElementById() method?
a) exchange files with a Web server
b) save data to local storage
c) alphabetize data
d) access display elements
16. In JavaScript, what is an action, such as
a mouse click, that triggers a different
action to occur?
a) variable
b) function
c) event
d) routine
17. Which event occurs right after all HTML
has been displayed?
a) onLoad
b) onEvent
c) onHTML
d) onDisplay
Name: _____________________
ID: _____________________ Tel: ___________________
8-2