Coursera Answers

Programming in Python Coursera Quiz Answers

Hello Friends In this article i am gone to share Programming in Python Coursera Quiz Answers with you..

Enrol Link: Programming in Python

Programming in Python Coursera Quiz Answers



Knowledge check – Welcome to Python Programming

Question 1)
Is a string in Python a sequence?

  • Yes
  • No

Question 2)
In Python, what symbol is used for comments in code?

  • #
  • //

Question 3)
What type will be assigned to the following variable: x = 4?

  • str – String
  • int – Integer
  • float – Float
  • list – List

Question 4)
Python allows for both implicit and explicit data type conversions?

  • True
  • False

Question 5)
A variable called name is assigned the value of โ€œTestingโ€. What will the output of the following equal – print(len(name));

  • Testing
  • Error
  • str
  • 7


Visit this link:ย  Module quiz: Getting started with Python Quiz Answers




Functions, loops and data structures

Question 1)
What keyword is used to create a function in Python?

  • var
  • func
  • def
  • for

Question 2)
What function in Python allows you to output data onto the screen?

  • input()
  • print()
  • output()
  • while

Question 3)
A variable that is declared inside a function cannot be accessed from outside the function?

  • True
  • False

Question 4)
Which of the declarations is correct when creating a for loop?

  • for while in:
  • for x in items:
  • for in items:
  • for if in items:

Question 5)
What error will be thrown from the below code snippet?

nums = 34
for i in nums:
  • Exception
  • MemoryError
  • TypeError: ‘int’ object is not iterable
  • FloatingPointError


Exceptions in Python

Question 1)
What type of specific error will be raised when a file is not found?

  • BufferError
  • FileNotFoundError
  • ImportError
  • Exception

Question 2)
Which of the following keywords are used to handle an exception?

  • try again
  • try except
  • try def
  • try catch

Question 3)
Which of the following is the base class for all user-defined exceptions in Python?

  • Exception
  • BaseException
  • AssertionError
  • EOFError


Read in data, store, manipulate and output new data to a file

Question 1)
What function allows reading and writing files in Python?

  • read_write()
  • input()
  • output()
  • open()

Question 2)
Which method allows reading of only a single line of a file containing multiple lines?

  • readline()
  • readlines()
  • read()
  • readall()

Question 3)
What is the default mode for opening a file in python?

  • read mode
  • copy mode
  • read and write
  • write mode

Question 4)
What is the difference between write and append mode?

  • Nothing, they are both the same.
  • Write mode overwrites the existing data. Append mode adds new data to the existing file.
  • Write mode will append data to the existing file. Append will overwrite the data.
  • Write mode will not allow edits if content already exists. Append mode will add new data to the file.

Question 5)
What error is returned if a file does not exist?

  • AssertionError
  • Exception
  • FileNotFoundError
  • LookupError


Visit this link:ย  Module quiz: Basic Programming with Python Quiz Answers




Knowledge check: Procedural Programming

Question 1)
Which of the algorithm types below finds the best solution in each and every step instead of being overall optimal?

  • Dynamic Programming
  • Divide and conquer
  • Greedy
  • Recursive

Question 2)
Which of the following Big O notations for function types has the slowest time complexity?

  • O(log(n))
  • O(c)
  • O(n!)
  • O(n^3)

Question 3)
True or False: Linear time algorithms will always run under the same time and space regardless of the size of input.

  • True
  • False

Question 4)
For determining efficiency, which of the following factors must be considered important?

  • Time complexity
  • Space complexity
  • Neither of the two options above
  • Both A and B


Knowledge check: Functional Programming

Question 1)

def sum(n):
if n == 1:
return 0
return n + sum(n-1)

a = sum(5)

What will be the output of the recursive code above?

  • 0
  • 15
  • 14
  • RecursionError: maximum recursion depth exceeded

Question 2)
Statement A: A function in Python only executes when called.

Statement B: Functions in Python always returns a value.

  • Both A and B are True
  • B is True but A is False
  • A is True but B is False
  • Both A and B are False

Question 3)
some = [“aaa”, “bbb”]

def aa(some):

def aa(some, 5):

def aa(): 
return #4def aa():

def aa(): 
return "aaa"

Which of the above are valid functions in Python? (Select all that apply)

  • 3
  • 4
  • 2
  • 1

Question 4
For the following code:

numbers = [15, 30, 47, 82, 95]
def lesser(numbers):
return numbers < 50

small = list(filter(lesser, numbers))

If you modify the code above and change filter() function to map() function, what will be the list elements in the output that were not there earlier?

  • 15, 30, 47, 82, 95
  • None of the other options
  • 15, 30, 47
  • 82, 95


Visit this link:ย  Module quiz: Programming Paradigms Quiz Answers




Knowledge check: Modules

Question 1)
Assuming there exists a module called โ€˜numpyโ€™ with a function called โ€˜shapeโ€™ inside it, which of the following is NOT a valid syntax for writing an import statement? (Select all that apply)

  • import shape from numpy
  • from numpy import shape as s
  • import * from numpy
  • import numpy as dn
  • from numpy import *

Question 2)
Which of the following locations does the Python interpreter search for modules by default?

  • Installation-dependent default directory
  • Any user-specified location added to the System path using sys package
  • The current working directory
  • PYTHONPATH or simply the environment variable that contains list of directories

Question 3)
We can import a text file using the import statement in Python:

  • True
  • False

Question 4)
Which of the following statements is NOT true about the reload() function?

  • You need to import a module before the reload() function can be used over it.
  • The reload() function can be used to import modules in Python.
  • You can use the reload() function multiple times for the same module in the given code.
  • The reload() function can be used for making dynamic changes within code.

Question 5)
Which of the following is NOT to be considered as an advantage of modular programming while using Python?

  • Reusability
  • Security
  • Simplicity
  • Scope

Question 6)
Which of the following module types are directly available for import without any additional installation when you begin writing our code in Python? (Select all that apply)

  • User-defined modules in Home directory of the device
  • Modules in the current working directory of the Project
  • Third-party packages from Python Package Index not present on the device
  • Built-in modules


Knowledge check: Popular Packages, Libraries and Frameworks

Question 1)
Which of these is a popular package that is NOT primarily used in Web development?

  • Scikit-learn
  • Django
  • Pyramid
  • Flask

Question 2)
Which of these packages can be applied in the field of Machine learning and Deep learning? Select all the correct answers.

  • Keras
  • Django
  • PyTorch
  • Pytest
  • TensorFlow

Question 3)
Which of the following is not a type of web framework architecture?

  • Synchronous
  • Microframework
  • Full-stack
  • Asynchronous

Question 4)
Pandas library in Python cannot be used for which of the following tasks?

  • Comparison of different columns in a table.
  • Visualisation such as graphs and charts.
  • Cleaning, analyzing and maintaining data.

Question 5)
Which of the following is not a built-in package in the Python standard library?

  • numpy
  • sys
  • math
  • json
  • os


Visit this link:ย  Module quiz: Modules, packages, libraries and tools Quiz Answers




Visit this link:ย  End-of-Course Graded Assessment: Using Python Quiz Answers



All Programming Assignment