华南理工大学 Python第2章课后小测-1(South China University of technology Python Chapter 2 after class quiz-1)

1、(单选)”abc”的长度是3,”老师好”的长度是多少?(本题分数:4)A) 1B) 3C) 6D) 9您的答案:B  正确率:100%2、(单选)下面代码的执行结果是

>>>s = "11+5in"
>>>eval(s[1:-2])

(本题分数:4)A) 6B) 11+5C) 16D) 执行错误您的答案:A  正确率:100%3、(单选)用Python内置函数表示2的10次幂的Python语句是()。(本题分数:4)A) 2*10B) 2^10C) pow(2,10)D) 2**10您的答案:C  正确率:100%  4、(单选)下列符号中,有()个是Python的关键字。(1)if    (2)false  (3)while   (4) For   (5)None(6)from  (7)True   (8)continue (9)not(本题分数:4)A) 6B) 7C) 8D) 9【解析】(2),(4)不是关键字您的答案:B  正确率:100%5、(单选)下列标识符,有()个是合法有效的Python变量名。(1)python  (2) for (3) For  (4) else(5) _7   (6) 8x    (7) x8   (8) 我喜欢python(本题分数:4)A) 4B) 5C) 6D) 7【解析】(2),(4)是保留字,(6)不能用数字开头您的答案:B  正确率:100%6、(单选)下列程序段的输出结果是

x,y=5,6
y,x=x+1,y+2
print(x,y)

(本题分数:4)A) 5 6B) 6 8C) 7 7D) 8 6您的答案:D  正确率:100%7、(单选)下列程序段的作用是()

import turtle
turtle.fd(200)
turtle.pendown()
turtle.setheading(90)
turtle.fd(50)
turtle.penup()
turtle.setheading(180)
turtle.fd(200)

(本题分数:4)A) 画出两条平行且长度相等线段B) 画出两条平行但长度不相等线段C) 画出两条垂直且长度相等线段D) 画出两条垂直但长度不相等线段您的答案:D  正确率:100%8、(单选)注释是程序员在代码中加入的一行或多行信息,它是辅助性文字,会被编译或解释器略去,不被计算机执行。Python语言的单行注释符是(  )(本题分数:4)A) //B) ‘C) #D) ##您的答案:C  正确率:100%9、(单选)Python语言的多行注释符是( )(本题分数:4)A) “B) ”’C) ‘D) `您的答案:B  正确率:100%10、(单选)Python字符串提供区间访问方式。设s是一个字符串,下列哪个表达式可以表示s的倒数第二个字符?(本题分数:4)A) s[-1]B) s[-2]C) s[2]D) s[0:-2]您的答案:B  正确率:100%11、(单选)设字符串s=”12345678″,则s[1:2]的值为(本题分数:4)A) 1B) 12C) 2D) 23您的答案:C  正确率:100%12、(单选)设字符串s=”abcdefg”,则s[-3:-1]的值为(本题分数:4)A) eB) efC) efgD) fg您的答案:B  正确率:100%13、(单选)下列赋值语句中,正确的是()(本题分数:4)A) a,b=1B) a,b=1,2C) a+b,c=3,4D) a,b=1,2,3您的答案:B  正确率:100%14、(单选)下列程序段的执行结果是( )

x="scut"
y=2
print(x+y)

(本题分数:4)A) scut2B) 2scutC) scutscutD) 出错,无法运行您的答案:D  正确率:100%15、(单选)无论用户在控制台输入什么内容,input()函数都以()类型返回结果。(本题分数:4)A) 整型B) 浮点数C) 字符D) 字符串您的答案:D  正确率:100%16、(单选)在Python语言中,要从控制台输入数据,可以使用()函数。(本题分数:4)A) readB) readlineC) inputD) get您的答案:C  正确率:100%17、(单选)以下哪个符号不是Python分支语句中用到的保留字()?(本题分数:4)A) ifB) elifC) elseD) elseif您的答案:D  正确率:100%18、(单选)Python语言有很多函数库。要使用这些函数库中的函数,必须使用()语句来引用该函数库。(本题分数:4)A) importB) inputC) referD) from您的答案:A  正确率:100%19、(单选)下列哪个语句可以画圆或圆弧?(本题分数:4)A) turtle.fd(5,10)B) turtle.circle(5,10)C) turtle.draw(5,10)D) turtle.drawCircle(5,10)您的答案:B  正确率:100%20、(单选)math函数库有求正弦值的函数sin。下列说法中,正确的个数是()(1)先用import math引用,然后用 sin()来求正弦值(2)先用import math引用,然后用math.sin()来求正弦值(3)先用from math import sin引用,然后用sin()来求正弦值(4)先用from math import *引用,然后用sin()来求正弦值(5)先用from math import *引用,然后用math.sin()来求正弦值(本题分数:4)A) 2B) 3C) 4D) 5【解析】1,5是错的您的答案:B  正确率:100%  21、(单选)math函数库有求正弦值的函数sin()。如果程序中要用sin()函数来求正弦值,则必须在程序的前面加上下列哪个语句?(1)import math(2)import math.*(3)from math import sin(4)from math import *(本题分数:4)A) (1)-(4)任意一个都可以B) (1)或(2)或(3)C) (1)或(3)或(4)D) (1)或(2)或(4)您的答案:C  正确率:100%22、(单选)turtle库是一个直观有趣的图形绘制函数库。它是一只()在坐标系中爬行,其爬行轨迹形成了绘制图形。(本题分数:4)A) 小狗B) 小猫C) 小海龟D) 小蛇您的答案:C  正确率:100%23、(单选)关于语句turtle.fd(-200)的说法,正确的是()(本题分数:4)A) 小海龟沿着水平方向前进200个距离B) 小海龟沿着垂直方向前进200个距离C) 小海龟沿着当前方向前进200个距离D) 小海龟沿着当前相反方向前进200个距离您的答案:D  正确率:100%24、(单选)turtle绘图中坐标系的绝对0度方向是()(本题分数:4)A) 画布正上方B) 画布正下方C) 画布正左方D) 画布正右方您的答案:D  正确率:100%25、(单选)语句 turtle.circle(-60,120)的执行结果是()(本题分数:4)A) 绘制一个半径为60像素的120度弧形,圆心在小海龟当前行进方向的右侧B) 绘制一个半径为60像素的120度弧形,圆心在小海龟当前行进方向的左侧C) 绘制一个半径为120像素的60度弧形,圆心在小海龟当前行进方向的右侧D) 绘制一个半径为120像素的60度弧形,圆心在小海龟当前行进方向的左侧您的答案:A  正确率:100%

————————

1. (single choice) the length of “ABC” is 3. What is the length of “good teacher”? (score of this question: 4) a) 1 < strong > b) 3 < / strong > C) 6D) 9 your answer: B. correct rate: 100% 2. (single choice) the execution result of the following code is

>>>s = "11+5in"
>>>eval(s[1:-2])

(score of this question: 4) < strong > A) 6 < / strong > b) 11 + 5C) 16d) execution error your answer: A. correct rate: 100% 3. (single choice) Python statement with Python built-in function representing the 10th power of 2 is (). (score of this question: 4) a) 2 * 10b) 2 ^ 10 < strong > C) pow (2,10) < / strong > d) 2 * * 10 your answer: C) accuracy: 100% 4. (single choice) among the following symbols, () are Python keywords. (1) If (2) false (3) while (4) for (5) none (6) from (7) true (8) continue (9) not (score of this question: 4) a) 6 < strong > b) 7 < / strong > C) 8D) 9 < strong > [parse] < / strong > (2), (4) not a key word. Your answer: B. correct rate: 100% 5. (single choice) of the following identifiers, there are () valid Python variable names. (1)python  (2) for (3) For  (4) else(5) _ 7 (6) 8x (7) X8 (8) I like python (score of this question: 4) a) 4 < strong > b) 5 < / strong > C) 6D) 7 < strong > [analysis] < / strong > (2), (4) is a reserved word, (6) cannot start with a number. Your answer: B. correct rate: 100% 6. (single choice) the output result of the following program segments is

x,y=5,6
y,x=x+1,y+2
print(x,y)

(score of this question: 4) a) 5 , 6b) 6 , 8C) 7 , 7 < strong > d) 8 , 6 < / strong > your answer: D , correct rate: 100% 7. (single choice) the function of the following program segments is ()

import turtle
turtle.fd(200)
turtle.pendown()
turtle.setheading(90)
turtle.fd(50)
turtle.penup()
turtle.setheading(180)
turtle.fd(200)

(score of this question: 4) a) draw two parallel and equal length line segments b) draw two parallel but unequal length line segments C) draw two vertical and equal length line segments < strong > d) draw two vertical but unequal length line segments < / strong > your answer: D. accuracy: 100% 8. (single choice) comments are one or more lines of information added by the programmer in the code. They are auxiliary text, which will be omitted by the compiler or interpreter and will not be executed by the computer. The single line comment of Python language is () (score of this question: 4) a) / / b) ‘< strong > C) # < / strong > d) ## your answer: C ## accuracy: 100% 9 (single choice) the multiline annotator of Python language is () (this question score: 4) a) “< strong > b)” ‘< / strong > C)’d ` your answer: B accuracy: 100% 10, (single choice) Python string provides interval access. Let s be a string, which of the following expression can represent the penultimate character of S? (this question score: 4) a) s [- 1] < strong > b) s [- 2] < / strong > C) s [2] d) s [0: – 2] your answer: B accuracy: 100% 11, (single choice) If the string s = “12345678”, then the value of s [1:2] is (score of this question: 4) a) 1b) 12 < strong > C) 2 < / strong > d) 23 your answer: C “correct rate: 100% 12, (single choice) if the string s =” ABCDEFG “, then the value of s [- 3: – 1] is (score of this question: 4) a) e < strong > b) EF < / strong > C) efgd) FG your answer: B” correct rate: 100% 13, (single choice) in the following assignment statements, the correct is () (score of this question: 4) a) a, B = 1 < strong > b) a, B = 1,2 < / strong > C) a + B, C = 3,4d) a, B = 1,2,3 your answer: b) correct rate: 100% 14, (single choice) the execution result of the following program segments is ()

x="scut"
y=2
print(x+y)

(score of this question: 4) a) scut2b) 2scutc) scutscut < strong > d) error, unable to run < / strong > your answer: D) accuracy rate: 100% 15, (single choice) no matter what content the user enters on the console, the input() function returns the result in the form of (). (score of this question: 4) a) integer b) floating point number C) character < strong > d) string < / strong > your answer: D. accuracy: 100% 16. (single choice) in Python language, to input data from the console, you can use the () function. (score: 4) a) readb) readLine < strong > C) input < / strong > d) get your answer: C) accuracy: 100% 17, (single choice) which of the following symbols is not a reserved word () used in Python branch statements? (score: 4) a) IFB) elifc) else < strong > d) else if < / strong > your answer: D. accuracy: 100% 18. (single choice) Python language has many function libraries. To use the functions in these libraries, you must use the () statement to reference the library. (score of this question: 4) < strong > A) import < / strong > b) inputc) refd) from your answer: a) accuracy: 100% 19, (single choice) which of the following statements can draw a circle or arc? (score: 4) a) turtle fd(5,10)B) turtle. circle(5,10)C) turtle. draw(5,10)D) turtle. Drawcircle (5,10) your answer: B. correct rate: 100% 20. (single choice) math function library has function sin for finding sine value. In the following statements, the correct number is () (1) first use import , math to reference, and then use , sin () to find the sine value (2) first use import , math to reference, and then use math Sin() to find the sine value (3) first use the reference from # math # import * sin, and then use sin() to find the sine value (4) first use the reference from # math # import * and then use sin() to find the sine value (5) first use the reference from # math # import * and then use math Sin() to find the sine value (score of this question: 4) a) 2 < strong > b) 3 < / strong > C) 4D) 5 < strong > [analysis] < / strong > 1, 5 is wrong. Your answer: B. correct rate: 100% 21. (single choice) math function library has the function sin() to find the sine value. If you want to use the sin() function to find the sine value in the program, which of the following statements must be added in front of the program? (1)import math(2)import math.* (3) From math import sin (4) from math import * (score: 4) a) (1) – (4) any one can be b) (1) or (2) or (3) < strong > C) (1) or (3) or (4) < / strong > d) (1) or (2) or (4) your answer: C accuracy: 100% 22. (single choice) the turtle library is an intuitive and interesting graphic drawing function library. It is a () crawling in the coordinate system, and its crawling track forms the drawing graph. (score: 4) a) dog B) kitten < strong > C) turtle < / strong > d) snake your answer: C) accuracy: 100% 23. (single choice) about the sentence turtle FD (- 200), the correct answer is () (score of this question: 4) a) the little turtle advances 200 distances along the horizontal direction B) the little turtle advances 200 distances along the vertical direction C) the little turtle advances 200 distances along the current direction < strong > d) the little turtle advances 200 distances along the current opposite direction < / strong > your answer: D. accuracy: 100% 24 (single choice) the absolute 0 degree direction of the coordinate system in the picture is () (score of this question: 4) a) directly above the canvas b) directly below the canvas C) directly to the left of the canvas < strong > d) directly to the right of the canvas < / strong > your answer: D. accuracy: 100% 25. (single choice) statement “turtle” The execution result of circle (- 60120) is () (score: 4) < strong > A) draw a 120 degree arc with a radius of 60 pixels, and the center of the circle is on the right side of the current travel direction of the little turtle < / strong > b) draw a 120 degree arc with a radius of 60 pixels, and the center of the circle is on the left side of the current travel direction of the little turtle C) draw a 60 degree arc with a radius of 120 pixels, The center of the circle is on the right side of the current travel direction of the little turtle. D) draw a 60 degree arc with a radius of 120 pixels. The center of the circle is on the left side of the current travel direction of the little turtle. Your answer: a # accuracy: 100%