Mobile Development and JavaScript | Module 2
Course Name: Mobile Development and JavaScript
Course Link: Mobile Development and JavaScript
These are Mobile Development and JavaScript Week 2 Coursera Answers
Module 2 Quiz: The Building Blocks of a Program
Q1. Which part of the below statement is an object?
const car = {type:”Ford”, model:”Model T”, color:”white”};
- type
- color
- car
- model
Answer: car
Q2. True or False: SyntaxError in JavaScript cannot be caught using the try-catch block.
- True
- False
Answer: False
Q3. What value is printed when the following code runs?
var burger = [“bun”, “beef”, “lettuce”, “tomato sauce”, “onion”, “bun”]; console.log(burger[2]);
- bun
- beef
- tomato sauce
- lettuce
Answer: lettuce
These are Mobile Development and JavaScript Week 2 Coursera Answers
Q4. In the following code, what data type does start: function() {} represent?
var bicycle = { wheels: 2, start: function() { }, stop: function() { } };
- Array
- Method
- Property
- Object
Answer: Method
Q5. When the error is thrown, the code will do what?
try { throw new Error(); console.log(‘Hello’); } catch(err) { console.log(‘Goodbye’); }
- Execute the code inside the throw statement.
- Execute the code inside the catch statement.
- Print the type of error to the console.
- Print new Error to the console.
Answer: Execute the code inside the catch statement.
Q6. Which of the following is used to run a block of code that may output an error without stopping the program?
- throw
- catch
- ErrorHandling
- try
Answer: try
These are Mobile Development and JavaScript Week 2 Coursera Answers
Q7. When the following code runs, what will print out?
try { throw new Error(); console.log(‘Hello’); } catch(err) { console.log(‘Goodbye’); }
- Hello
- Goodbye
- err
- catch failed
Answer: Goodbye
Q8. What error gets thrown when, for example, one tries to use variables that haven’t been declared anywhere?
- TypeError
- ReferenceError
- RangeError
- SyntaxError
Answer: ReferenceError
Q9. Which of the below will be the output of the following code?
(10).toString(100);
- .1
- SyntaxError
- RangeError
- undefined
Answer: SyntaxError
These are Mobile Development and JavaScript Week 2 Coursera Answers
Q10. The statement below evaluates to which of the following?
const value = null;
console.log(value);
- value
- null
- undefined
- error
Answer: null
Q10. What will be printed when the following code runs?
var result; console.log(result);
- result
- null
- undefined
- 0
Answer: undefined
Q12. Which of the following statements will evaluate to false?
- null == undefined;
- !null;
- null === undefined;
- null === null;
Answer: null == undefined;, null === undefined;
These are Mobile Development and JavaScript Week 2 Coursera Answers
Q13. A method returns undefined if the variable that is being evaluated does not have which of the following?
- A null value
- Correct syntax
- A defined value
- A method cannot return undefined.
Answer: A defined value
Q14. What represents the intentional absence of any object value?
- undefined
- noValue
- null
- “”
Answer: null
Q15. Which of the following is used to output an error and pass control to the first catch block?
- ErrorHandling
- try
- err
- throw
Answer: throw
These are Mobile Development and JavaScript Week 2 Coursera Answers
More Weeks of this course: Click Here
More Coursera Courses: http://progiez.com/coursera