MOOC Python大数据处理与分析(北京联合大学)1452332173 最新慕课完整章节测试答案
第一部分 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: 错误
答案: 【 错误】
编写一个输入输出的程序(练习用,不计分)
1、判断题:
简单的输入输出:编程实现输入姓、名的提示语并接受用户输入,并单独显示姓、名和全名,执行效果如下所示:Input your surname: ZHANGInput your firstname: DazhuangYour surname is: ZHANGYour firstname is: DazhuangYour full name is: ZHANG Dazhuang在看参考程序之前你成功了吗?【参考答案】surname = input('Input your surname: ')
firstname = input('Input your firstname: ')
print('Your surname is:', surname)
print('Your firstname is:', firstname)
print('Your full name is:', surname, firstname)
选项:
A: 正确
B: 错误
答案: 【 正确】
第二部分 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&n