All Coursera Quiz Answers

Module quiz: The Building Blocks of a Program Quiz Answers

In this article i am gone to share Coursera Course: Programming with JavaScript Week 2 |  Module quiz: The Building Blocks of a Program Quiz Answers with you..

Programming with JavaScript Coursera Quiz Answers

Enroll Link: Programming with JavaScript


Also visit: Module quiz: Introduction to JavaScript Quiz Answers


 

Module quiz: The Building Blocks of a Program Quiz Answers

Question 1)
What data type is the variable x ?

var x = {};
  • Function
  • Array
  • Object

Question 2)
What will be the output of running the following code?

try {
console.log('hello)
} catch(e) {
console.log('caught')
}
  • Uncaught SyntaxError: Invalid or unexpected token.
  • Caught

Question 3)
What value is printed when the following code runs?

var burger = ["bun", "beef", "lettuce", "tomato sauce", "onion", "bun"];
console.log(burger[2]);
  • bun
  • beef
  • lettuce
  • tomato sauce
  • onion

Question 4)
In the following code, how many methods does the bicycle object have?

var bicycle = {
wheels: 2,
start: function() {
},
stop: function() {
}
};
  • 1
  • 2
  • 3

Question 5)
When the following code runs, what will print out?

try {
throw new Error();
console.log('Hello');
} catch(err) {
console.log('Goodbye');
}
  • Hello
  • Goodbye

Question 6)
If you mis-type some code in your JavaScript, what kind of error will that result in?

  • RangeError
  • SyntaxErrror
  • TypeError

Question 7)
Will the following code execute without an error?

function add(a, b) {
console.log(a + b)
}

add(3, "4");
  • Yes
  • No

Question 8)
What will be printed when the following code runs?

var result;
console.log(result);
  • undefined
  • null
  • 0

Question 9)
What will be the output of the following code?

var str = "Hello";
str.match("jello");
  • null
  • undefined
  • empty string

Question 10)
What will be the output of the following code?

try {
Number(5).toPrecision(300)
} catch(e) {
console.log("There was an error")
}
  • RangeError
  • 5
  • e
  • “There was an error”