
4.11 复习题
一、选择题
1. 在下列数据类型中,Python不支持的是________。
A. char
B. int
C. float
D. list
2. Python语句print(type(1J))的输出结果是________。
A. <class'complex'>
B. <class'int'>
C. <class'float'>
D. <class'dict'>
3. Python语句print(type(1/2))的输出结果是________。
A. <class'int'>
B. <class'number'>
C. <class'float'>
D. <class'double'>
4. Python语句print(type(1//2))的输出结果是________。
A. <class'int'>
B. <class'number'>
C. <class'float'>
D. <class'double'>
5. Python语句序列“a=121+1.21;print(type(a))”的输出结果是________。
A. <class'int'>
B. <class'float'>
C. <class'double'>
D. <class'long'>
6. Python语句print(0xA+0xB)的输出结果是________。
A. 0xA+0xB
B. A+B
C. 0xA0xB
D. 21
7. Python语句序列“x='car';y=2;print(x+y)”的输出结果是________。
A. 语法错
B. 2
C. 'car2'
D. 'carcar'
8. Python表达式sqrt(4)*sqrt(9)的值为________。
A. 36.0
B. 1296.0
C. 13.0
D. 6.0
9. 关于Python中的复数,下列说法错误的是________。
A. 表示复数的语法是real+image j
B. 实部和虚部都是浮点数
C. 虚部必须后缀为j,且必须是小写
D. 方法conjugate()返回复数的共轭复数
10. Python语句print(chr(65))的运行结果是________。
A. 65
B. 6
C. 5
D. A
11. 关于Python字符串,下列说法错误的是________。
A. 字符即长度为1的字符串
B. 字符串以\0标识字符串的结束
C. 用户既可以用单引号,也可以用双引号创建字符串
D. 在三引号字符串中可以包含换行回车等特殊字符
二、填空题
1. Python中内置的4种数值类型为________。
2. Python内置的序列数据类型包括________。
3. Python表达式10+5//3-True+False的值为________。
4. Python表达式3**2**3的值为________。
5. Python表达式17.0/3**2的值为________。
6. Python表达式0 and 1 or not 2<True的值为________。
7. Python语句print(pow(-3,2),round(18.67,1),round(18.67,-1))的输出结果是________。
8. Python语句print(round(123.84,0),round(123.84,-2),floor(15.5))的输出结果是________。
9. Python语句print(int('20',16),int('101',2))的输出结果是________。
10. Python语句print(hex(16),bin(10))的输出结果是________。
11. Python语句print(2.5.as_integer_ratio())的输出结果是________。
12. Python语句print(float.as_integer_ratio(1.5))的输出结果是________。
13. Python语句print(gcd(12,16),divmod(7,3))的输出结果是________。
14. Python语句print((2-3j).conjugate()*complex(2,3))的输出结果是________。
15. Python语句print(sum((1,2,3)),sum((1,2,3),10))的输出结果是________。
16. Python语句print(abs(-3.2),abs(1-2j))的输出结果是________。
17. Python的标准随机数生成器模块是_________。
18. 数学表达式的Python表达式为________。
19. 数学表达式的Python表达式为________。
20. Python的内置字典数据类型为________。
21. Python语句序列“x=True;y=False;z=False;print(x or y and z);”的运行结果是________。
22. Python语句序列“x=0;y=True;print(x>=y and'A'<'B');”的运行结果是________。
23. 在直角坐标系中,(x,y)是坐标系中任意点的位置,用x和y表示第一象限或者第二象限的Python表达式为________。
24. 判断整数i能否同时被3和5整除的Python表达式为________。
25. 已知“a=3;b=5;c=6;d=True”,则表达式not d or a>=0 and a+c>b+3的值是________。
26. Python表达式16-2*5>7*8/2 or"XYZ"!="xyz"and not(10-6>18/2)的值为________。
27. 执行下列Python语句将产生的结果是________。

28. Python语句print(chr(ord('B')))的执行结果是________。
29. Python语句print("hello"'world')的执行结果是________。
三、思考题
1. Python包括哪4种内置的数值类型?
2. Python包括哪些不可变序列数据类型?哪些可变序列数据类型?
3. Python字符串字面量有哪4种定义方式?
4. Python有哪几种类型转换方式?各方式是如何进行类型转换的?
5. 阅读下面的Python程序,请问输出结果是什么?

6. 阅读下面的Python语句,请问输出结果是什么?程序的功能是什么?

7. 下列Python语句的输出结果是________。

8. 下列Python语句的输出结果是________。

9. 下列Python语句的运行结果为________。

10. 下列Python语句的运行结果为________。

11. 阅读下面的Python程序,请问输出结果是什么?

12. 阅读下面的Python程序,请问输出结果是什么?
