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

第一部分: Python基础之走近Python 第一周 走近Python单元测验

1、 问题:以下表达式中,哪一个选项的运算结果是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、 问题:以下哪一条语句不能实现"hello world"字符串在一行中输出?
选项:
A:print(‘hello world’)
B:print("hello world")
C:print(”’hello 
world”’)
D:print(‘hello \
world’)
答案: 【print(”’hello 
world”’)

3、 问题:Python中input()函数的返回的是以下哪一种类型?
选项:
A:int
B:str
C:list
D:dict
答案: 【str

4、 问题:以下关于模块module的描述中错误的是哪一项?
选项:
A:一个完整的Python文件即是一个模块,是增强Python功能的扩展
B:用import导入了模块之后,可以按照“模块.函数”的格式使用这个模块的函数
C:可以使用变量来引用函数,例如可以通过bar=math.sqrt进行赋值,然后就可以使用bar来进行计算平方根,例如bar(9)结果是3.0
D:Python目前还不支持一次性导入多个模块
答案: 【Python目前还不支持一次性导入多个模块

5、 问题:以下关于Python的赋值说法中错误的是哪一个选项?
选项:
A:Python中同一个变量名在不同位置可以被赋予不同的类型的值
B:Python中不需要显式声明该变量的类型,根据“值”确定类型
C:Python支持链式赋值和多重赋值
D:Python 赋值时大小写不敏感
答案: 【Python 赋值时大小写不敏感

6、 问题:以下表达式的计算结果是3(或3.0)的选项有哪些?
选项:
A:1 / 2 + 2.5
B:9 // 2 – 1.5
C:ord(‘D’) – ord(‘A’)
D:35 % 10
答案: 【1 / 2 + 2.5;
ord(‘D’) – ord(‘A’)

7、 问题:如果想要查看math库中pi的取值是多少,可以利用以下什么方式(假设已经执行了import math,并且只要包含pi取值就可以)?
选项:
A:help(math)
B:print(pi)
C:dir(math)
D:print(math.pi)
答案: 【help(math);
print(math.pi)

8、 问题:以下哪些不是Python的关键字?
选项:
A:as
B:list
C:from
D:dict
答案: 【list;
dict

9、 问题:判断如下陈述是否正确?Python既可以在Shell中运行执行,也可以存储成以.py为扩展名的文本文件使用Python解释器去执行。
选项:
A:正确
B:错误
答案: 【正确

10、 问题:判断如下陈述是否正确?如果要从math模块导入sqrt函数,可以使用语句“from sqrt import math”。
选项:
A:正确
B:错误
答案: 【错误
分析:【正确的答案是from math import sqrt,即从math库中导出sqrt函数

第二部分: Python基础之 Python面面观 第二周 Python面面观单元测试

1、 问题:以下哪个语句可以打印出语句“rest apples are less than 9”且仅打印一次?
选项:
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(xrange(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

2、 问题:对于函数def location(city, province):
        # 字符串中%s对应输出字符串后%后的参数表中的参数值,其中s为字符串格式
    print(‘%s belongs to %s province’ % (city, province))以下哪一个语句的输出与其他几个不同?
选项:
A:location(‘Jiangsu’, ‘Nanjing’)
B:location(province = ‘Jiangsu’, city = ‘Nanjing’)
C:location(city = ‘Nanjing’, province = ‘Jiangsu’)
D:location(‘Nanjing’, ‘Jiangsu’)
答案: 【location(‘Jiangsu’, ‘Nanjing’)

3、 问题:定义以下函数,其中f为所需要传入的函数。def test(f, a, b): 
    print(f(a, b))则执行语句 test((lambda x,y: x ** 3 + y), 2, 3)的输出结果是哪个选项?
选项:
A:8
B:9
C:10
D:11
答案: 【11

4、 问题:关于以下程序的正确说法是哪一项?def f(x):
     a = 7
     print(a + x)

a = 5
f(3)
print(a)
选项:
A:程序的运行结果为10和7。
B:程序的运行结果为10和5。
C:程序的运行结果为8和5。
D:程序不能正常执行。
答案: 【程序的运行结果为10和5。

5、 问题:若k为整型,下述while循环执行的次数为多少次?k = 50 
while k > 1: 
    print(k) 
    k = k // 2
选项:
A:3
B:4
C:5
D:6
答案: 【5

6、 问题:定义函数如下:def my_power(x, n = 2):
    s = 1
    while n > 0:
        n -= 1
        s = s * x
    return s分别对该函数传递参数,调用my_power(-3)和my_power(3, 3)后运行结果分别是什么?
选项:
A:9和27
B:-9和27
C:9和-27
D:-9和-27
答案: 【9和27

7、 问题:执行以下代码会产生哪一种异常?>>> a = 3
>>> print(a ** b)
选项:
A:IndexError
B:ValueError
C:TypeError
D:NameError

本门课程剩余章节答案为付费内容
本文章不含期末不含主观题!!
本文章不含期末不含主观题!!
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦

   

发表评论

电子邮件地址不会被公开。 必填项已用*标注