Developing AI Applications with Python and Flask | Week 1

Course Name: Developing AI Applications with Python and Flask

Course Link: Developing AI Applications with Python and Flask

These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Module 1 Practice Quiz: Python Coding Practices and Packaging Concepts

Q1. Identify the file where you add code to reference the modules in the package?

  • __main__.py
  • myproject.py
  • __name__.py
  • __init__.py

Answer: __init__.py


Q2. Which of the following is a best practice when creating function names to write test cases?

  • test
  • function.test
  • Function
  • _test

Answer: test


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Q3. Which of the following is a valid method name based on PEP8 guidelines?

  • GET_USER_NAME()
  • GetUserName()
  • get_user_name()
  • getUserName()

Answer: get_user_name()


Q4. Which of the following is required to package a Python module?

  • The methods in the Python module should be defined as public methods
  • import sys as the first line of code in the Python script
  • A folder with server.py
  • The Python module should be packaged in a directory with __init__.py in the same directory

Answer: The Python module should be packaged in a directory with __init__.py in the same directory


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Q5. Which of the following is TRUE about web apps and APIs? (Select two)

  • All web apps are APIs, but not all APIs are web apps.
  • Web apps is a generic term that includes “online” or web-based and “offline” apps.
  • Both web apps and APIs link two system parts.
  • All APIs allow users to access apps without installing them on their local systems.
See also  Developing AI Applications with Python and Flask | Week 2

Answer: All web apps are APIs, but not all APIs are web apps.
Both web apps and APIs link two system parts.


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Module 1 Graded Quiz: Python Coding Practices and Packaging Concepts

Q1. Which of the following statements are true about web apps? (Select two)

  • Web apps help link offline apps.
  • All web apps are APIs.
  • Web apps is a more generic term given to all forms of apps that create a link between any two parts of a system.
  • Web apps support CRUD actions.

Answer: All web apps are APIs.
Web apps support CRUD actions.


Q2. In which testing phase do you verify that the application functions within the larger framework?

  • Unit testing
  • User testing
  • Performance testing
  • Integration testing

Answer: Integration testing


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Q3. Which of the following statements is TRUE about PyLint?

  • PyLint is a Python IDE.
  • PyLint is a Python code compiler.
  • PyLint is a Python-based package creation tool.
  • PyLint is a Python static code analysis tool.

Answer: PyLint is a Python static code analysis tool.


Q4. Which of the following is the right way to name constants based on the PEP8 guidelines?

  • dateOfBirth
  • Date_Of_Birth
  • DATE_OF_BIRTH
  • date_of_birth

Answer: DATE_OF_BIRTH


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Q5. When gathering requirements for an app to manage events, the customer mentions that the project’s objective is to improve customer retention.
Which of the following requirements describes the above scenario?

  • Constraints
  • Business requirements
  • Technical requirements
  • User requirements
See also  Developing AI Applications with Python and Flask | Week 2

Answer: Business requirements


Q6. Why is it a good practice to build a unit testing class?

  • To call unit tests from a single class object
  • To add one or more assertion methods
  • To import the unittest library
  • To check if functions are returning the correct values

Answer: To call unit tests from a single class object


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Q7. For this question, review the partial module code and the unit test code:
When the unit test is executed, the test fails. Which of the following code statement will you modify for the unit test to pass?

  • from math import add
  • self. assertEqual (add (6, 4), 10)
  • self. assertEqual (subract (6, 4), 3)
  • def test_subract(self)

Answer: self. assertEqual (subract (6, 4), 3)


Q8. Consider the following code in the file my_code.py a directory named mypackage with init.py.
def print_hello():
print(“Hello”)
Which of the following two statements are the right ways to access the function in the method?

  • from mypackge import my_code
    my_code.print_hello ()
  • import my_code
    print_hello ()
  • from mypackage import print_hello
    print_hello ()
  • from mypackage.my_code import print_hello
    print_hello ()

Answer:

  • from mypackge import my_code
    my_code.print_hello ()
  • from mypackage.my_code import print_hello
    print_hello ()

These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


Q9. Which of the following is the general structure for testing a package?

  • import {package_name}
  • run {package_name}. {module_name}. {function_name} (parameters)
  • {package_name} (parameters)
  • {package_name}. {module_name}. {function_name} (parameters)

Answer: {package_name}. {module_name}. {function_name} (parameters)


Q10. Which of the following is the correct folder structure for the package “MyPackage”?

  • MyPackage -> module_1-> module_1.py MyPackage -> module_2-> module_2.py
  • MyPackage -> module_1.py, module_2.py, __init__.py
  • MyPackage -> module_1.py, module_2.py
  • MyPackage -> module_1.py, module_2.py, init.py
See also  Developing AI Applications with Python and Flask | Week 2

Answer: MyPackage -> module_1.py, module_2.py, __init__.py


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz


More Weeks of this course: Click Here

More Coursera Courses: http://progiez.com/coursera


These are Developing AI Applications with Python and Flask Week 1 Answer Coursera Quiz