2021 Data Processing Using Python(用Python玩转数据)(南京大学) 最新满分章节测试答案

2024年9月27日 分类:免费网课答案 作者:网课帮手

本答案对应课程为:点我自动跳转查看
本课程起止时间为:2021-11-19到2022-01-25
本篇答案更新状态:已完结

Module 1: Basics of Python – 1.2 Multi-dimensional View of Python Multi-dimensional View of Python q

1、 问题:If k is integer, how many times will the following "while" loop be executed?k = 50 
while k > 1: 
    print(k) 
    k = k // 2
选项:
A:3
B:4
C:5
D:6
答案: 【5

2、 问题:Which of the following code snippets can print “rest apples are less than 9”once and only once?
选项:
A:apples = 100
while True:
    if apples < 9:
        break
        print("rest apples are less than 9")
    apples -= 9
B:apples = 100
while True:
    if apples < 9:
        continue
        print("rest apples are less than 9")
    apples -= 9
C:apples = 100
while apples >= 1:
    if apples < 9:
        print("rest apples are less than 9")
        break
    apples -= 9
D:apples = 100
for a in reversed(range(apples)):
    if a < 9:
        print("rest apples are less than 9")
        continue
        apples -= 9
答案: 【apples = 100
while apples >= 1:
    if apples < 9:
        print("rest apples are less than 9")
        break
    apples -= 9

3、 问题: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?
选项:
A:location(‘Jiangsu’, ‘Nanjing’)
B:location(province = ‘Jiangsu’, city = ‘Nanjing’)
C:location(city = ‘Nanjing’, province = ‘Jiangsu’)
D:location(‘Nanjing’, ‘Jiangsu’)
答案: 【location(‘Jiangsu’, ‘Nanjing’)

4、 问题: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)?
选项:
A:8
B:9
C:10
D:11
答案: 【11

5、 问题:Define a function as below:  def my_power(x, n = 2):
    s = 1
    while n > 0:
        n -= 1
        s = s * x
    return sWhat’s the result of passing my_power(-3) and my_power(3, 3) respectively?
选项:
A:9 and 27
B:-9 and 27
C:9 and -27
D:-9 and -27
答案: 【9 and 27

6、 问题:Which of the following is correct about the program below?def f(x):
     a = 7
     print(a + x)
a = 5
f(3)
print(a)
选项:
A:The result of the program is 10 and 5.
B:The result of the program is 10 and 7.
C:The result of the program is 8 and 5. 
D:The program cannot be executed normally.
答案: 【The result of the program is 10 and 5.

7、 问题:What kind of exception will be generated when executing the following code snippet?>>> a = 3
>>> print(a ** b)
选项:
A:IndexError
B:ValueError
C:NameError
D:TypeError
答案: 【NameError

8、 问题:If the code snippet always generates a random number in [0, 1.0 ), what’s the possible function from library random used here?>>> import random
>>> random.______()
选项:
A:randint
B:random
C:uniform
D:shuffle
答案: 【random

9、 问题:Which of the following statements about the flow control of Python functions are correct?
选项:
A: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". 
B: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".
C: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.
D:In "while" and "for" loops, a "break" statement serves to end the current loop and re-starts the loop.
答案: 【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". ;
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".

10、 问题:Which of the following statements about the flow control of Python functions are correct?
选项:
A:As Boolean expressions, the values of None, 0, [] and {} would be regarded as "False" by the interpreter.
B:Standard Boolean values are 0 (representing False) and 1 (representing True); in fact, the result of the statement True==1 is True.
C:Comparisons of incompatible types, like integers and strings, is meaningless in mathematics. It is no longer supported in Python 3.x.
D:When "is" is a comparison operator, the meaning of "x is y" is to compare whether "x" is a sub-class of "y".
答案: 【As Boolean expressions, the values of None, 0, [] and {} would be regarded as "False" by the interpreter.;
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.

11、 问题:Please decide whether the following statements are true or falseAn “if” statement  must be indented, by 4 spaces.
选项:
A:正确
B:错误
答案: 【错误

12、 问题: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)
答案: 【4

Module 1: Basics of Python – 1.1 Basics of Python Walk into Python quiz

1、 问题:Which of the following expressions is False?
选项:
A:(3 is 4) == 0
B:’abc’ < ‘ABC’
C:9 < 1 and 10 < 9 or 2 > 1
D:8 > 4 > 2
答案: 【‘abc’ < ‘ABC’

2、 问题:Which of the following statements can NOT print the string “hello world” (the print result must be in the same line)?
选项:
A:print(”’hello 
        world”’)
B:print(‘hello world’)
C:print("hello world")
D:print(‘hello \
        world’)
答案: 【print(”’hello 
        world”’)

3、 问题:Which of the following statements about Python is false?
选项:
A:One variable name can be assigned with different types and numerical values at different positions in Python. 
B:In Python, there is no need to explicitly declare the type of variable, yet to be determined by the "value". 
C:Python supports chained assignment and multiple assignment.
D:Upper or lower case is not sensitive in Python assignment.
答案: 【Upper or lower case is not sensitive in Python assignment.

4、 问题:Which of the following types will the Python function input() return?
选项:
A:int
B:str
C:list
D:dict
答案: 【str

5、 问题:Which of the following statements about module is false?
选项:
A:A complete Python file forms a module, an extension to enhance Python capability.
B:Functions in a module can be used in the form of "module.function" after the module is imported using the "import" clause.

本门课程剩余章节答案为付费内容
本文章不含期末不含主观题!!
本文章不含期末不含主观题!!
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦
请输入手机号或商家订单号
打不开请联系客服QQ 2356025045 商家订单号在哪里?点此了解

商家订单号查看步骤

打开支付宝
方法一:我的 > 账单 > 账单详情 > 更多>复制商家订单号
方法二:我的 > 账单 >搜索关键字【网课小帮手】
> 账单详情 > 更多>复制商家订单号
方法三:联系客服QQ 2356025045
微信支付
我 > 支付 > 钱包 > 账单 > 账单详情

继续阅读