All Coursera Quiz Answers

JavaScript jQuery and JSON Week 2 Practice Quiz Answer

In this article i am gone to share Coursera Course: JavaScript jQuery and JSON Week 2 Practice Quiz Answer with you..

JavaScript jQuery and JSON Week 2 Practice Quiz Answer


Also visit this link:  JavaScript jQuery and JSON Week 1 Practice Quiz Answer


 

Question 1)
Which of the following is a template that defines the shape of an object that is created?

  • Inheritance
  • Method
  • Class
  • Instance
  • Message

Question 2)
Which of the following describes a feature which we would expect from a programming language that supported first class functions?

  • The ability to return a value from a function
  • The ability for a function not to return a value (i.e. void functions)
  • The ability to define a function and assign the function to a variable
  • The ability to omit parameters and have the omitted parameters default to a value
  • The ability to have a variable number of parameters when calling a function

Question 3)
What is the keyword / predefined variable that is used in a JavaScript class definition to refer to the “current instance” of the class?

  • $this
  • me
  • _self
  • self
  • this

Question 4)
What do these two statements in JavaScript accomplish?

data.stuff = “hello”;
data[‘stuff’] = “hello”;

  • The first statement creates an object and the second creates a dictionary
  • The second statement is a syntax error in JavaScript
  • The first statement is a syntax error in JavaScript
  • These two statements accomplish the same thing

Question 5)
How is the constructor defined in JavaScript class compared to how the constructor is defined in a PHP class?

  • JavaScript does not support the notion of running a “constructor” when objects are created.
  • A PHP constructor is a method named __construct() and a JavaScript constructor is code in the outer function definition
  • The PHP and JavaScript constructor patterns are the same
  • The PHP constructor method is called __construct() and the JavaScript constructor method is called construct()