Mobile Development and JavaScript | Module 4
Course Name: Mobile Development and JavaScript
Course Link: Mobile Development and JavaScript
These are Mobile Development and JavaScript Week 4 Coursera Answers
Programming Assignment: Writing a Unit Test
Task 1: Add Jest as a devDependency
Open your terminal and make sure you’re in the jest-testing
directory.
Run the following command to install Jest as a devDependency:
Answer: Please login to see answer.
Task 2: Update these code and save files:
package.json:
Answer: Please login to see answer.
timesTwo.js:
Answer: Please login to see answer.
timesTwo.test.js:
Answer: Please login to see answer.
Task 3: Submit assignment.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Module 4 Quiz: Programming Paradigms
Q1. The idea of having separate, small pieces of code that are easy to test is called what?
- Unit testing
- Integration testing
- End-to-end testing
- Post-hoc testing
Answer: Unit testing
Q2. Which of the following is a framework that can help you run a unit test?
- Jest
- JFrame
- JavaFrame
- JavaTest
Answer: Jest
Q3. When the following test executes, what will the test result be?
function multiply(a, b) { return a; } expect(multiply(2, 2)).toBe(4);
- Success.
- Fail.
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Q4. When the following test executes, what will the test result be?
function subtract(a, b) { return a – b; } expect(subtract(10, 4)).toBe(6);
- Success.
- Fail.
Answer: Please login to see answer.
Q5. True or False: End-to-end testing is the slowest and most expensive type of testing.
- True.
- False
Answer: Please login to see answer.
Q6. What is End-to-end testing (e2e)?
- End-to-end testing is testing how parts of your system interact with other parts of your system.
- End-to-end testing is a comprehensive test that starts at the beginning of your code and runs to the end.
- End-to-end testing revolves around the idea of having separate, small pieces of code that are easy to test.
- End-to-end testing tries to imitate how a user might interact with your application.
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Q7. What is Code Coverage?
- A measure of what percentage of your code is covered by tests.
- What percentage of your code is complete.
- A measure of what percentage of your code has failing tests.
- What percentage of your code is in Javascript.
Answer: Please login to see answer.
Q8. The development of Node.js led to the ability to do which of the following?
- Write full-stack JavaScript programs.
- Estimate code coverage
- Download and manage packages
- Run unit tests
Answer: Please login to see answer.
Q9. Which of the following runtimes are typically used for building backends?
- Node.js
- Cyprus
- Jest
- Protractor
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Q10. Integration testing is defined how?
- Testing how parts of your system interact with other parts of your system.
- Testing revolves around the idea of having separate, small pieces of code that are easy to test.
- Testing tries to imitate how a user might interact with your application.
- Testing how much of your code is covered by tests.
Answer: Please login to see answer.
Q11. Which of the following is testing how parts of your system interact with other parts of your system?
- Unit testing
- Post-hoc testing
- End-to-end testing
- Integration testing
Answer: Please login to see answer.
Q12. Which of the following are NOT one of the three types of testing?
- End-to-end testing
- Unit testing
- Post-hoc testing
- Integration testing
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Q13. Which command is used to install a Node package?
- npm
- pkg
- node
- package
Answer: Please login to see answer.
Q14. package.json is used to do which of the following?
- Store all the testing code.
- Turn your code into an application.
- Store all the dependencies required for application.
- Download npm packages.
Answer: Please login to see answer.
Q15. True or False: If you have built a project with different node packages, they will all be listed inside the package.json file.
- True
- False
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Q16. True or False: End-to-end tests can be performed in a web browser without writing code.
- True
- False
Answer: Please login to see answer.
Q17. A person on your team wants to help with testing. However, they are not a developer and cannot write code. What type of testing is most suited for them?
- End-to-end testing
- Post-hoc testing
- Unit testing
- Integration testing
Answer: Please login to see answer.
Q18. In Jest you use mocking by employing which of the following?
- External mock libraries
- Jest Fakes
- Jest Mock functions
- Jest Snapshot
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
Q19. What is the recommended way to separate the code that you are testing from its related dependencies?
- Mocking
- End-to-end testing
- module.exports
- Fakes
Answer: Please login to see answer.
These are Mobile Development and JavaScript Week 4 Coursera Answers
More Weeks of this course: Click Here
More Coursera Courses: http://progiez.com/coursera
![Mobile Development and JavaScript | Module 4 1 Mobile Development and JavaScript Week 4 Coursera](https://progiez.com/wp-content/uploads/2023/01/cropped-3-progiez-logo.png-1.png)