You have a request ? Contact Us Join Us

Mobile Development and JavaScript | Coursera Quiz Answers

Answer Coursera Meta iOS Developer Professional Certificate. Mobile Development and JavaScript.
Estimated read time: 35 min
Coursera: Mobile Development and JavaScript Meta
Mobile Development and JavaScript | Coursera Meta

This course marks the beginning of a series aimed at Android developers seeking to diversify into cross-platform mobile development. It emphasizes leveraging existing Android development skills to create applications that run on multiple platforms. The initial phase focuses on mastering JavaScript programming, a fundamental requirement for utilizing the React library in mobile development.

JavaScript is renowned as the backbone of modern web technology. Participants will delve into essential web development concepts through practical exercises covering functions, objects, arrays, variables, data types, and the HTML DOM, among other key elements. The course also explores advanced interactive capabilities offered by contemporary JavaScript technologies and introduces methodologies for testing code, including hands-on experience in writing unit tests using Jest.

Completion of this course contributes towards various Specialization or Professional Certificate programs, including the Meta Android Developer Professional Certificate and the Meta iOS Developer Professional Certificate. By the course's conclusion, learners will be proficient in explaining foundational web development principles with JavaScript, applying JavaScript within the React framework, and conducting effective code testing using Jest.


Notice!
Always refer to the module on your course for the most accurate and up-to-date information.

Attention!
If you have any questions that are not covered in this post, please feel free to leave them in the comments section below. Thank you for your engagement.


Module Quiz: Introduction to JavaScript

1. DevTools console is useful for doing which of the following?
  • Installing npm.
  • Testing your code.
  • Running Javascript in a web browser.
  • Downloading packages.
2. /* Comment */ is used to indicate what kind of information in javascript?
  • multi-line comments
  • inline comments 
  • unfinished code
  • test code
3. Which of the following is not a valid data type in JavaScript?
  • numbers
  • string
  • booleans
  • function
4. Which of the following is the logical AND operator in JavaScript?
  • ||
  • &
  • && 
  • \
5. == is the operator for what in JavaScript?
  • NOT
  • Assignment
  • AND
  • Equality
6. How many times will the following code print the word Hello?
for(var i = 10; i >=1; i--) { console.log("Hello"); } 
  • 1
  • 10
  • 0
  • 9
7. What will print out when the following code runs?
var i = 3; var j = 5; if(i == 3 && j == 5) { console.log("Hello"); } else { console.log("Goodbye"); }
  • undefined
  • Goodbye
  • Nothing
  • Hello
8. What will print out when the following code runs?
var i = 7; var j = 6; if(i < 7 || j < 5) { console.log("Hello"); } else { console.log("Goodbye"); }
  • Hello
  • undefined
  • Goodbye
  • Nothing
9. The result of !false is:
  • false
  • true
  • undefined
  • syntaxError
10. What will be the output of the following code block
var year = 2018;
while (year < 2023) {
 console.log(year);
 year++;
};
  • It will log the years 2018 until 2023.
  • undefined
  • It will log the years 2018 until 2022.
  • year = 2023

Module Quiz: The Building Blocks of a Program

1. Which part of the below statement is an object?
const car = {type:"Ford", model:"Model T", color:"white"}; 
  • type
  • car
  • model
  • color
2. What error is thrown when trying to run a method on a non-supported data type?
  • TypeError
  • RangeError
  • ReferenceError
  • SyntaxError
3. What is the effect of the pop() method in the following code?
var burger = ["bun", "beef", "lettuce", "tomato sauce", "onion", "bun"]; burger.pop() 
  • It turns burger into an object.
  • It will remove the last bun from the array.
  • It will remove the first bun from the array.
  • It has no effect.
4. In the following code, what data type does start: function() {} represent?
var bicycle = { wheels: 2, start: function() { }, stop: function() { } };
  • Method
  • Array
  • Property
  • Object
5. 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
6. What error gets thrown when, for example, one tries to use variables that haven't been declared anywhere?
  • RangeError
  • ReferenceError
  • TypeError
  • SyntaxError
7. Which of the below will be the output of the following code?
(10).toString(100); 
  • undefined
  • RangeError
  • .1
  • SyntaxError
8. The statement below evaluates to which of the following?
const value = null;
console.log(value);
  • null
  • error
  • value
  • undefined
9. What will be the output of the following code?
var str = "Hello"; str.match("jello"); 
  • null
  • undefined
  • SyntaxError
  • “”
10. Which of the following is used to output an error and pass control to the first catch block? 
  • try
  • throw
  • err
  • ErrorHandling

Module Quiz: Programming Paradigms

Random 1

1. Which of the following variable declarations cannot be redeclared or reassigned?
  • var
  • const
  • let
  • There are no variable declarations which cannot be reassigned.
2. What will print out when the following code runs?
function scopeTest() { var y = 44; console.log(x); }
scopeTest();
var x = 33; 
  • 44
  • undefined
  • 33
  • null
3. Which of the following statements describes the outcome of the code block below?
class Cake {
     constructor(lyr) { this.layers = lyr; 
     } 
getLayers() { return this.layers; } 
class WeddingCake extends Cake {
     constructor() { super(2); } getLayers() { return super.getLayers() * 5; } 
     } 
var result = new WeddingCake(); 
console.log(result.getLayers()); 
  • WeddingCake cannot be updated and throws an error.
  • The constructor is not passed an initial argument and the Console.log will print undefined.
  • Console.log will print 2.
  • WeddingCake overrides the getLayers() function to multiply the result by 5.
4. Which of the following statements describes the outcome of the code block below?
class Animal { } 
class Dog extends Animal {
     constructor() { this.noise = "bark"; } 
     makeNoise() { return this.noise; } 
     } 
class Wolf extends Dog {
     constructor() { super(); this.noise = "growl"; } 
     } 
var result = new Wolf(); 
console.log(result.makeNoise());
console.log(result.makeNoise()) will log undefined
  • growl is replaced by bark as the output of console.log(result.makeNoise())
  • syntaxError
  • bark is replaced by growl as the output of console.log(result.makeNoise())
5. What is the value of …rest in the following code snippet?
const [a, b, …rest] = [1,2,3,4]
  • undefined
  • [3,4]
  • 2
  • 1
6. What value will be printed out when the following code runs?
function count(...food) { console.log(food.length) } count("Burgers", "Fries", null);
  • "Burgers", "Fries", undefined
  • 3
  • "Burgers", "Fries", null
  • 2
7. You can access the Document Object Model from what part of your web browser?
  • Sources tab
  • You cannot access the Document Object Model from your web browser.
  • Elements tab
  • Console tab
8. Which of the following methods convert a JavaScript object from a JSON string?
  • JSON.fromString
  • JSON.stringify
  • JSON.toString
  • JSON.parse
9. What will be the result of running this code? 
var letter = "a";
letter = "b";
console.log(letter);  
  • a
  • Uncaught SyntaxError: Invalid or unexpected token
  • b
  • Uncaught TypeError: Assignment to constant variable 
10. What is the keyword for a constructor function which details how an object will be built?
  • Extends
  • New
  • Function
  • Construct


Random 2

1. Which of the following variable declarations can be redeclared and reassigned?
  • const
  • let
  • var
  • There are no variable declarations which can be redeclared and reassigned.
2. What will print out when the following code runs?
function scopeTest() { var y = 44; console.log(x); }
var x = 33;
scopeTest();
  • undefined
  • null
  • 44
  • 33
3.What will print out when the following code runs?
class Cake {
     constructor(lyr) { this.layers = lyr; 
     } 
getLayers() { return this.layers; } 
class WeddingCake extends Cake {
     constructor() { super(2); } getLayers() { return super.getLayers() * 5; } 
     } 
var result = new WeddingCake(); 
console.log(result.getLayers());
  • 0
  • 2
  • 10
  • 5
4. What will print out when the following code runs?
class Animal { } 
class Dog extends Animal {
     constructor() { this.noise = "bark"; } 
     makeNoise() { return this.noise; } 
     } 
class Wolf extends Dog {
     constructor() { super(); this.noise = "growl"; } 
     } 
var result = new Wolf(); 
console.log(result.makeNoise());
  • bark
  • growl
  • syntaxError
  • undefined
5. Which of the following snippets would output [3,4] to the console from the snippet:
let a, b, rest;
[a, b, ...rest] = [1,2,3,4]
  • console.log(...rest)
  • console.log(rest)
  • console.log(c+d)
  • console.log(c,d)
6. What value will be printed out when the following code runs?
function count(...food) { console.log(food.length) } count("Burgers", "Fries", null);
  • 2
  • "Burgers", "Fries", undefined
  • "Burgers", "Fries", null
  • 3
7. You can access the Document Object Model from what part of your web browser?
  • Console tab
  • Sources tab
  • You cannot access the Document Object Model from your web browser.
  • Elements tab
8. Which of the following methods convert a JavaScript object from a JSON string?
  • JSON.fromString
  • JSON.toString
  • JSON.parse
  • JSON.stringify
9. What will be the result of running this code? 
let letter = "a" letter = "b";
console.log(letter);  
  • a
  • b
  • Uncaught TypeError: Assignment to constant variable
  • Uncaught SyntaxError: Invalid or unexpected token
10. What is a constructor?
  • An object literal. 
  • A specific object that has been created using the class name.
  • A function that is called to create an instance of an object. 
  • An instance of a class.

Module Quiz: Testing

1. Which of the following is a framework that can help you run a unit test?
  • JFrame
  • JavaFrame
  • JavaTest
  • Jest
2. When the following test executes, what format will the result be?
function multiply(a, b) { return a; } expect(multiply(2, 2)).toBe(4); 
  • True/False
  • String
  • Success/Fail
  • Function
3. Which of the following testing types revolves around the idea of having separate, small pieces of code that are easy to test?
  • Post-hoc testing.
  • Unit testing.
  • Integration testing.
  • End-to-end testing.
4. Which of the following describes a measure of what percentage of your code is covered by tests?
  • TestMeasure
  • Test coverage
  • Code coverage
  • Test%
5. The development of Node.js led to the ability to do which of the following?
  • Download and manage packages
  • Estimate code coverage
  • Write full-stack JavaScript programs.
  • Run unit tests
6. Which of the following are NOT one of the three types of testing?
  • Post-hoc testing
  • Integration testing
  • End-to-end testing
  • Unit testing
7. Which command is used to install a Node package?
  • npm
  • node
  • pkg
  • package
8. package.json is used to do which of the following?
  • Turn your code into an application.
  • Download npm packages.
  • Store all the dependencies required for application.
  • Store all the testing code.
9. Which of the following statements are NOT benefits of using Test-Driven Development or TDD?
  • You have proof that your new implementation is not breaking other parts of the app.
  • You can run tests without setting them up.
  • Minimizing regressions like accidental bugs introduced to old code.
  • You can automate these tests easily and thus keep verifying again and again that the system works as expected.
10. What is the recommended way to separate the code that you are testing from its related dependencies?
  • Mocking
  • End-to-end testing
  • Fakes
  • module.exports

Final Graded Quiz: Programming with JavaScript

1. What will be the output of the following JavaScript?
const a = 2; 
const b = 4; 
if(a == 2 && b == 8) { console.log("Green"); } 
else { console.log("Blue"); }
  • Green
  • null
  • Blue
  • syntaxError
2. What will be the output of the following JavaScript?
var message = "Hello"; 
message += " World!"; 
message = "Goodbye!"; 
console.log(message);
  • Goodbye!
  • Hello
  • Hello World!
  • World!
3. What is the data type of the x variable in the following code?
var x = "Hello";
  • BigInt
  • String
  • Boolean
  • Number
4. What will the following JavaScript code output?
var x = 20; 
if(x >= 10) {
    console.log("Apple"); 
    } 
else if(x <= 5) {
    console.log("Pear"); 
    } 
else { console.log("Orange"); } 
  • Pear
  • undefined
  • Apple
  • Orange
5. What will the following JavaScript code output?
var result = 0; 
var i = 0; 
var limit = 3; 
while(i < limit) {
    result += 2; i++; 
console.log(result);
  • 0
  • 3
  • 2
  • 6
6. When the following code runs, what will print out?
try { throw new Error(); console.log('Square'); } 
catch(err) { console.log('Circle'); } 
  • undefined
  • Square
  • Circle
  • sytaxError
7. What's missing from this JavaScript function declaration?
function(a,b) 
{ return a + b } 
  • The assignment operator.
  • The dot notation.
  • The function name.
  • The bracket notation.
8. What is the output of the code below?
var cat = {} 
cat.sound = "meow"; 
var catSound = "purr" 
console.log(catSound) 
  • catSound
  • meow
  • purr
  • {}
9. What is the output of the code below?
var veggies = [] 
veggies.push('parsley') 
veggies.push('carrot') 
console.log(veggies[2])
  • 3
  • 1
  • undefined
  • 2
10. What is the first argument passed to the addEventListener function?
  • The target of the event.
  • The name of the method.
  • A string describing the type of event (such as, ‘click’).
  • A function that will handle the event.
11. How do you create a new h2 element using JavaScript?
  • With document.createElement('h2')
  • With document.addElement('h2')
  • With document.buildElement('h2')
12. True or false: Using the npm init -y command, you can initialize a new project with npm by answering all prompts with a yes.
  • True
  • False
13. DevTools console is frequently used to perform what function?
  • Testing your code.
  • Downloading packages.
  • Running Javascript in a web browser.
  • Installing npm.
14. // is used to indicate what kind of information in javascript?
  • test code
  • inline comments 
  • multi-line comments
  • unfinished code
15. Which of the following selections is not a data type?
  • booleans
  • numbers
  • function
  • string
16. The assignment operator in JavaScript is denoted by which of the following symbols?
  • ===
  • => 
  • == 
17. Having separate, small pieces of code that are easy to test describes what type of testing?
  • End-to-end testing
  • Unit testing
  • Integration testing
  • Post-hoc testing
18. True or False: End-to-end testing is the fastest and least expensive type of testing.
  • False
  • True.
19. True or False: You can install packages from the npm repository using the node command.
  • False
  • True
20. True or False: If you build a project with multiple node packages, they will all be listed inside the package.json file.
  • False
  • True
21. Which feature is used to mock data in Javascript?
  • Jest Fakes
  • Jest Snapshot
  • Jest Mock functions
  • External mock libraries
22. Which of the following statements about Test-Driven Development or TDD are false?
  • You can run tests without setting them up.
  • You have proof that your new implementation is not breaking other parts of the app.
  • You can automate these tests easily and thus keep verifying again and again that the system works as expected.
  • Minimizing regressions like accidental bugs introduced to old code.
23. Which of the following variable declarations cannot be redeclared or reassigned?
  • var
  • const
  • let
  • There are no variable declarations which cannot be reassigned.
24. What will print out when the following code runs?
class Game {
    constructor(score) {this.score = points; } 
    getPoints() { return this.score; }
class Bonus extends Game {
    constructor() { super(2);} 
    getpoints() { return super.getPoints() * 5; } 
var result = new Bonus(); 
console.log(result.getPoints()); 
  • 5
  • 2
  • 10
  • 0
25. What will print out when the following code runs?
class Animal { } 
class Cat extends Animal { 
    constructor() { this.noise = "meow"; } 
    makeNoise() { return this.noise; } 
class Tiger extends Cat { 
    constructor() { super(); this.noise = "growl"; } 
var result = new Tiger(); 
console.log(result.makeNoise());
  • growl
  • meow
  • syntaxError
  • undefined
26. Which statement will log [3,4] to the console from the following code snippet?
let a, b, rest;
[a, b, ...rest] = [1,2,3,4] 
  • console.log(c+d)
  • console.log(c,d)
  • console.log(...rest)
  • console.log(rest)
27. True or false: The rest parameter syntax allows a function to accept an indefinite number of arguments as an array.
  • False
  • True
28. Which of the following static methods convert a JSON string into an object?
  • JSON.fromString
  • JSON.stringify
  • JSON.parse
  • JSON.toString
29. What keyword, used with a constructor function, details how an object will be built?
  • New
  • Extends
  • Construct
  • Function
30.What's Which of the following concepts are not associated with the concept of functional programming?
  • Pure functions and side-effects
  • First-class functions
  • Objects
  • Higher-order function

Related Articles

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.