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
WEEK 1 QUIZ ANSWERS
Knowledge check – Welcome to Python Programming
Is a string in Python a sequence?
In Python, what symbol is used for comments in code?
What type will be assigned to the following variable: x = 4?
- str – String
- int – Integer
- float – Float
- list – List
Python allows for both implicit and explicit data type conversions?
A variable called name is assigned the value of “Testing”. What will the output of the following equal – print(len(name));
Visit this link: Module quiz: Getting started with Python Quiz Answers
WEEK 2 QUIZ ANSWERS
Functions, loops and data structures
What keyword is used to create a function in Python?
What function in Python allows you to output data onto the screen?
A variable that is declared inside a function cannot be accessed from outside the function?
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:
What error will be thrown from the below code snippet?
nums = 34 for i in nums: print(i)
- TypeError: ‘int’ object is not iterable
Exceptions in Python
What type of specific error will be raised when a file is not found?
Which of the following keywords are used to handle an exception?
- try again
- try except
- try def
- try catch
Which of the following is the base class for all user-defined exceptions in Python?
Read in data, store, manipulate and output new data to a file
What function allows reading and writing files in Python?
Which method allows reading of only a single line of a file containing multiple lines?
What is the default mode for opening a file in python?
- read mode
- copy mode
- read and write
- write mode
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.
What error is returned if a file does not exist?
Visit this link: Module quiz: Basic Programming with Python Quiz Answers
WEEK 3 QUIZ ANSWERS
Knowledge check: Procedural Programming
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
Which of the following Big O notations for function types has the slowest time complexity?
True or False: Linear time algorithms will always run under the same time and space regardless of the size of input.
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
def sum(n): if n == 1: return 0 return n + sum(n-1) a = sum(5) print(a)
What will be the output of the recursive code above?
- RecursionError: maximum recursion depth exceeded
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
some = [“aaa”, “bbb”]
#1 def aa(some): return #2 def aa(some, 5): return #3 def aa(): return #4def aa(): #4 def aa(): return "aaa"
Which of the above are valid functions in Python? (Select all that apply)
For the following code:
numbers = [15, 30, 47, 82, 95] def lesser(numbers): return numbers < 50 small = list(filter(lesser, numbers)) print(small)
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
WEEK 4 QUIZ ANSWERS
Knowledge check: Modules
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 *
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
We can import a text file using the import statement in Python:
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.
Which of the following is NOT to be considered as an advantage of modular programming while using Python?
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
Which of these is a popular package that is NOT primarily used in Web development?
Which of these packages can be applied in the field of Machine learning and Deep learning? Select all the correct answers.
Which of the following is not a type of web framework architecture?
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.
Which of the following is not a built-in package in the Python standard library?
Visit this link: Module quiz: Modules, packages, libraries and tools Quiz Answers
WEEK 5 QUIZ ANSWERS
Visit this link: End-of-Course Graded Assessment: Using Python Quiz Answers
All Programming Assignment
- Programming Assignment: Type casting input Solution
- Programming Assignment: Functions, loops and data structures Solution
- Programming Assignment: Read in data, store, manipulate and output new data to a file Solution
- Programming Assignment: Mapping key-values to Dictionary data structures Solution
- Programming Assignment: Abstract Classes and Methods Solution
- Programming Assignment: Import and Scope Solution
- Programming Assignment: Write a test Solution