Cookie Consent by Free Privacy Policy Generator Data Processing Using Python Week 1 Quiz Answers - Coursera!

Data Processing Using Python complete course is currently being offered by Nanjing University through Coursera platform and is being taught by ZHANG Li.

About this Course

This course, as a whole, based on Finance data and through the establishment of popular cases one after another, enables learners to more vividly feel the simplicity, elegance, and robustness of Python. Also, it discusses the fast, convenient and efficient data processing capacity of Python in humanities and social sciences fields like literature, sociology and journalism and science and engineering fields like mathematics and biology, in addition to business fields. Similarly, it may also be flexibly applied into other fields.

Skills You Will Gain

  • Python Programming
  • Numpy
  • Pandas
  • Wxpython

Also Check: How to Apply for Coursera Financial Aid


Data Processing Using Python Week 1 Quiz Answers - Coursera!


Data Processing Using Python Week 1 Coursera Quiz Answers! 

Coursera Walk into Python Quiz Answers

Question 1) Please decide whether the following statements are true or false. 

Python can be run and executed in Shell, and can also be saved into a text file whose extension is .py to be executed in the Python interpreter.

T
F

Question 2) Which of the following expressions is False?

'abc' < 'ABC'
8 > 4 > 2
9 < 1 and 10 < 9 or 2 > 1
(3 is 4) == 0

Question 3) Which of the following statements can NOT print the string “hello world” (the print result must be in the same line)?

print('''hello world''')
print('hello \ world')
print("hello world")
print('hello world')

Question 4) To view the value of “pi” in the library “math”, which of the following means can be resorted to (suppose that “import math” has been executed)?

dir(math)
print(math.pi)
print(pi)
help(math)

Question 5) Which of the followings are not keywords in Python?

dict
from
as
list

Question 6) Which of the following statements produce 3 or 3.0?

1 / 2 + 2.5
ord('D') – ord('A')
35 % 10
9 // 2 – 1.5

Question 7) Which of the following statements about Python is false?

One variable name can be assigned with different types and numerical values at different positions in Python.
In Python, there is no need to explicitly declare the type of variable, yet to be determined by the “value”.
Python supports chained assignment and multiple assignment.
Upper or lower case is not sensitive in Python assignment.

Question 8) Which of the following types will the Python function input() return?

int
dict
list
str

Question 9) To import the function “sqrt” from the module “math”, you may use the statement “from sqrt import math”.

T
F

Question 10) Which of the following statements about module is false?

A complete Python file forms a module, an extension to enhance Python capability.
Python doesn’t support import multiple modules at a time yet.
Functions in a module can be used in the form of “module.function” after the module is imported using the “import” clause.
Variables can be used to refer to functions. For example, by assigning “math.sqrt” to “bar”, “bar” can used to calculate the square root. An example will be that bar(9) equals to 3.0.

Coursera More About Python Quiz Answers

Question 1) Please decide whether the following statements are true or false
An “if” statement  must be indented, by 4 spaces.

T
F

Question 2) If k is integer, how many times will the following “while” loop be executed?

k = 50 
while k > 1: 
    print(k) 
    k = k // 2

3
5
4
6

Question 3) Which of the following code snippets can print “rest apples are less than 9”once and only once?

apples = 100
while apples >= 1:
    if apples < 9:
        print("rest apples are less than 9")
        break
    apples -= 9

Question 4) Which of the following statements about the flow control of Python functions are correct?

In “while” and “for” loops, a “continue” statement serves to stop the current loop and continues to enter the statement(s) below the loop body.
Boolean operators have a very interesting short-circuit logic behavior: for an expression “x and y”, when “x” is false, it directly returns “False”, without calculating the value of “y”. 
In “while” and “for” loops, a “break” statement serves to end the current loop and re-starts the loop.
One of the characteristics of an “if” statement is: it makes judgment from top to bottom, and if one judgment is True, the statement corresponding to that judgment will be executed, ignoring the remaining “elif” and “else”.

Question 5) Which of the following statements about the flow control of Python functions are correct?

As Boolean expressions, the values of None, 0, [] and {} would be regarded as “False” by the interpreter.
When “is” is a comparison operator, the meaning of “x is y” is to compare whether “x” is a sub-class of “y”.
Standard Boolean values are 0 (representing False) and 1 (representing True); in fact, the result of the statement True==1 is True.
Comparisons of incompatible types, like integers and strings, is meaningless in mathematics. It is no longer supported in Python 3.x.

Question 6) What’s the result of the following program?

s = 0
for i in range(1, 11):
     if i % 2 == 0:
        continue
     if i % 10 == 5:
        break
     s = s + i
print(s)

Answer: 4  

Question 7) Regarding the function below:

def location(city, province):
    print('%s belongs to %s province' % (city, province))

Which of the following statement has a different result comparing with others?

location('Nanjing', 'Jiangsu')
location(province = 'Jiangsu', city = 'Nanjing')
location(city = 'Nanjing', province = 'Jiangsu')
location('Jiangsu', 'Nanjing')

Question 8) Define a function as below with f as the function parameter,

def test(f, a, b): 
    print(f(a, b))

Which of the following options will be the result of test((lambda x,y: x ** 3 + y), 2, 3)?

9
11
10
8

Question 9) Define a function as below:  

def my_power(x, n = 2):
    s = 1
    while n > 0:
        n -= 1
        s = s * x
    return s

What’s the result of passing my_power(-3) and my_power(3, 3) respectively?

9 and -27
-9 and 27
-9 and -27
9 and 27

Question 10) Which of the following is correct about the program below?

The program cannot be executed normally.
The result of the program is 10 and 5. 
The result of the program is 8 and 5. 
The result of the program is 10 and 7.

Question 11) What kind of exception will be generated when executing the following code snippet?
 
>>> a = 3
>>> print(a ** b)

NameError
IndexError
ValueError
TypeError

Question 12) If the code snippet always generates a random number in [0, 1.0 ), what’s the possible function from library random used here?

shuffle
random
uniform
randint

Post a Comment

Previous Post Next Post