Question

In: Computer Science

Javascript Questions: 1. Which of the following is not a way to avoid adding objects to...

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

Solutions

Expert Solution

Answer:

  1. B- Use var keyword – it is used to create an object in javascript. How it can avoid adding using an object in namespace.
  2. Data properties added with the defineProperty method are configurable, writable and non-enumerable by default. Option –d is the answer
  3. It is a subset of JavaScript so you can use familiar JavaScript syntax to work with it. Option- c is answer.
  4. The six data types allowed in JSON are strings, numbers, Booleans, arrays, objects, and null. Option –a is correct.
  5. JSON.stringfy() convert js object to JSON string and JSON.parse() returns javascript. So option-c is correct.
  6. A jquery selector includes $ sign, quotation marks, parentheses but not .dot operator. Option D is the answer
  7. This jquery gets the previous sibling of the selected h2 element. Option c is answer.
  8. Mouseover and click events should be, the first user moves the mouse over the object then click. Option-d is answer.
  9. Before you use a plugin, you have to know the methods that it provides. Option c should be correct.
  10. To provide implicit iteration, a plugin should use each method. Option c is correct.


Related Solutions

Javascript array of objects: I'm trying to get the input into an array of objects, and...
Javascript array of objects: I'm trying to get the input into an array of objects, and then display the information in a table using a for loop, but I don't think my path is right <!DOCTYPE html> <head> <title>Form</title> <meta charset="utf-8" /> <style media="screen"> h1 { text-align: center; } div { background-color: #pink; border: 2px solid green; padding: 15px; margin: 65px; } </style> <script> var list = []; total = 0; text = ""; function Product(item, quantity, costs){ this.item =...
Why do phototropic sporangiophores avoid solid objects?
Why do phototropic sporangiophores avoid solid objects?
The transnational strategy is often seen as one way in which firms can avoid the limitations...
The transnational strategy is often seen as one way in which firms can avoid the limitations inherent in the local responsiveness/international integration trade-off. However, given the obvious advantages of being both locally responsive and internationally integrated, why are apparently only a relatively few firms implementing a transnational strategy?
Javascript problem: Given an argument of a list of book objects: Example test case input: {...
Javascript problem: Given an argument of a list of book objects: Example test case input: { "title" : "Book A", "pages": "50", "next": { "title": "Book B", "pages": 20, "next": null } } create a recursive function to return the total number total # of pages read in the list. If there are no books in the list, return 0.
1. Which of the following is not a way for insurance companies to respond to the...
1. Which of the following is not a way for insurance companies to respond to the problem of "adverse selection"? Select the correct answer below: separating insurance buyers into risk groups and charging them accordingly trying not to sell insurance to the highest risk customers deciding not to sell insurance in the market at all requiring all insurance buyers to pay exactly the same monthly premium, regardless of their risk group 2. If we think of political positions along a...
1. Which of the following is a common way in which genes in a population change?...
1. Which of the following is a common way in which genes in a population change? A) injury B) aging C) sexual reproduction D) natural selection 2. The Drake equation estimates the: A) number of planets hosting life in the Milky Way. B) number of technologically advanced civilizations in the Milky Way. C) likelihood of observing a signature of life around a star. D) likelihood of observing a radio signal from an extraterrestrial civilization. 3. Of the following, which is...
JAVASCRIPT Create an array of 5 objects named "movies" Each object in the movies array, should...
JAVASCRIPT Create an array of 5 objects named "movies" Each object in the movies array, should have the following properties: Movie Name Director Name Year Released WasSuccessful (this should be a boolean and at least 2 should be false) Genre Loop through all of the objects in Array If the movie is successful, display all the movie information on the page. These movies were a success: Title: Forrest Gump Year Realeased: 1994 Director: Robert Zemeckis Genre: Comedy
1# Which of the following is NOT a way to influence a consumers’ perception of value?...
1# Which of the following is NOT a way to influence a consumers’ perception of value? a. Social profiling b. Brand name c. Product quality d. Channels of distribution e. Customer service levels 2# Changing prices on established brands presents challenges. Shoppers are used to what frequently purchased products cost such as ready-to-eat cereal, potato chips, and canned vegetables. To lower prices with these types of products, manufacturers most often a. Use regional coupons to clear the market. b. Increase...
This all has to be in javascript A common way to remove duplicates from an array...
This all has to be in javascript A common way to remove duplicates from an array is to convert it to a set and then convert it back to an array. We will do that here. Please use these variables and data structures: var input = [3, 4, 2, 2, 4, 5, 3, 1, 3, 6]; var set = new Set(); 1. Get each element from the input array and add it to the set. 2. Get the elements from...
Which of the following is a... Which of the following is a way to address some...
Which of the following is a... Which of the following is a way to address some of the shortcomings of specialization? Multiple Choice  Each employee further develops his/her area of specialization. Each employee brings his/her own equipment or tools to work  Each employee is assigned to a team to perform a job.  Each employee takes care of one activity only.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT