In: Computer Science
Javascript Questions:
1. Which of the following is not a way to avoid adding
objects to
the global namespace?
a. Create and assign variables and event handlers within an
IIFE.
b. Use the var keyword.
c. Use an object literal as a namespace.
d. Create and attach an event handler function within the
event
onload handler.
2. Data properties added by assignment are writable, configurable,
and
enumerable by default. Data properties added with the
defineProperty
method are
a. writable, configurable, and enumerable by default.
b. non-writable, non-configurable, and non-enumerable by
default.
c. writable, non-configurable, and non-enumerable by default.
d. writable, configurable, and non-enumerable by default.
3. Which of the following is a benefit of using the JSON data
format?
a. It's the only data format that works with JavaScript.
b. It's a subset of XML so you can use existing XML objects
to work with it.
c. It's a subset of JavaScript so you can use familiar
JavaScript
syntax to work with it.
d. It's a subset of HTML so you can use the DOM to work with
it.
4. The six data types allowed in JSON are strings, numbers,
Booleans,
arrays, objects, and
a. null
b. undefined
c. function definitions
d. integers
5. The global JSON object provides which two methods for
converting
JavaScript objects to JSON strings and back again?
a. stringify and replacer
b. stringify and reviver
c. stringify and parse
d. parse and replacer
6. A jQuery selector includes all but one of the
following.
Which one is it?
a. $ sign
b. quotation marks
c. parentheses
d. dot operator
7. What does the following jQuery code do?
$("h2").prev();
a. Gets the h2 element that precedes the current element
b. Gets the element in the HTML that precedes the selected h2
element
c. Gets the previous sibling of the selected h2 element
d. Gets the previous sibling of the selected h2 element that is
an
h2 element
8. Which of the following event methods occurs when the user moves
the
mouse pointer over an element and then clicks on it?
a. click
b. mouseover
c. mouseout
d. click and mouseover
9. Before you use a plugin, you have to know all but one of
the
following. Which one is it?
a. the HTML that it requires
b. how its CSS works
c. the methods that it provides
d. the options that it provides
10. To provide for implicit iteration, a plugin should use
a. a for loop
b. a while loop
c. an each method
d. the this keyword
Answer: