程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Yu Yue education] basic reference of Python language programming in Nanjing University of Posts and Telecommunications

編輯:Python

education
-Python Fundamentals of language programming - Chapter materials, examination materials - Nanjing University of Posts and telecommunications 【】
Unit work for the first week
First week unit test
1、【 Single topic selection 】 The first electronic computer in the world “ENIAC” On 1946 Born in ____________ university .
A、 Pennsylvania, USA
B、 Cambridge, England
C、 Carnegie Mellon
D、 The harvard
Reference material 【 】
2、【 Single topic selection 】 The basic structure of modern computers “ Program storage idea ” By ____________ Bring up the .
A、Von Neumann
B、Dennis M. Ritchie
C、Bell
D、Ken Thompsom
Reference material 【 】
3、【 Single topic selection 】 The representation of data in a computer is ____________.
A、 Binary system
B、 Decimal system
C、 octal
D、 Hexadecimal
Reference material 【 】
4、【 Single topic selection 】 In the computer , A byte (Byte) contain ____________ A bit (bit).
A、8
B、2
C、4
D、16
Reference material 【 】
5、【 Single topic selection 】 In the following programming languages , Not a high-level programming language .
A、 assembly language
B、C Language
C、Java Language
D、Python Language
Reference material 【 】
6、【 Single topic selection 】Python Language features do not include
.
A、Python Language programs must be modified to run across platforms
B、Python The language is very concise
C、Python The language uses interpretation to execute
D、Python Language is an object-oriented programming language
Reference material 【 】
7、【 Single topic selection 】Windows Operating system , Generally, use shortcut keys ____________ To save the work you are currently editing .
A、Ctrl+S
B、Ctrl+C
C、Ctrl+P
D、Alt+F4
Reference material 【 】
8、【 Single topic selection 】 A famous computer scientist Niklaus Wirth( Ni · Worth ) It was proposed that ____________.
A、 Program = data structure + Algorithm
B、 Storage control structure
C、 Stored program control
D、 cybernetics
Reference material 【 】
9、【 Single topic selection 】 Algorithm is the step of solving the problem , Due to the different ways of solving problems , But they must meet their basic properties , The following need not be satisfied is ____________.
A、 Must have input
B、 deterministic
C、 Fineness
D、 The feasibility of
Reference material 【 】
10、【 Single topic selection 】 stay Python The most commonly used function for outputting calculation results on the screen is ____________.
A、print()
B、output()
C、write()
D、screen()
Reference material 【 】
11、【 Single topic selection 】 When the following code runs, it will not produce errors ____________.
A、print(“Hello, I’m fine”)
B、print(‘Hello, I’m fine’)
C、print(‘Hello, I’m fine")
D、print("Hello, I’m fine’)
Reference material 【 】
12、【 Single topic selection 】 What is not wrong with the following statement is ____________.
A、‘hello’ * 2
B、‘hello’ + 2
C、‘hello’ * ‘2’
D、‘hello’ - ‘2’
Reference material 【 】
13、【 Single topic selection 】 And most programming languages follow “ Backwards compatible ” The difference in principle is ,.
A、Python 3.x Not compatible Python 2.x The program
B、Python 3.x Compatible Python 2.x The program
C、Python 2.x and Python 3.x Programs that can be compatible with each other
D、Python 2.x Compatible Python 3.x The program
Reference material 【 】
14、【 Single topic selection 】 Of the following four capacity units , Is between TB and MB Units between .
A、GB
B、KB
C、NB
D、PB
Reference material 【 】
15、【 Single topic selection 】 Computer software classification , So-called “ Open source software ” refer to
.
A、 Open source software
B、 Software at the source of development
C、 Software without copyright
D、 Free software
Reference material 【 】
16、【 Single topic selection 】 The smallest unit of information in a computer is ____________.
A、 The bit
B、 byte
C、 Program
D、 character
Reference material 【 】
17、【 Single topic selection 】 stay Python in , The symbol that cannot be used to represent a string is ____________.
A、[ ]( A square bracket )
B、’ ‘( A pair of single quotes )
C、" "( A pair of double quotes )
D、’’’ ‘’’( One to three quotation marks )
Reference material 【 】
18、【 Single topic selection 】 stay Python The interaction mode of language ( Also known as Shell Pattern ) in , Used to represent the calculation result of the previous formula .
A、
( Underline )
B、$
C、
D、
E、@
Reference material 【 】
19、【 Single topic selection 】 When operating the computer , Shortcut key Ctrl+Alt+Del The correct way to do this is :
A、 The three keys must be pressed at the same time
B、 Hold down Ctrl Key not loose , Press... At the same time Alt and Del key
C、 Hold down Ctrl and Alt Key not loose , Then press the Del key
D、 Press... One by one Ctrl、Alt、Del key
Reference material 【 】
20、【 Single topic selection 】 The content displayed on the computer or mobile phone screen is composed of many points , Every such point , We call it “ Pixels ”, Each pixel is passed through ____________ The changes of the three color channels and their superposition to get a variety of colors .
A、 red , green , blue
B、 red , yellow , blue
C、 yellow , green , blue
D、 red , yellow , green
Reference material 【 】
21、【 Single topic selection 】 Of the following options , Is the right learning Python Experience .
A、Python New versions of tend to include more features , So be sure to install the latest version Python Learning to program
B、 The procedures written by the teacher are very simple , So we don't have to try to write these programs ourselves
C、 To protect your program , There should be as few comments in the program as possible , So others can't understand
D、 Learning programming requires integrating theory with practice , So in the process of learning programming, we must be more on the computer 、 Practice diligently
Reference material 【 】
22、【 Completion 】 A computer's CPU A set of instructions that can be understood and executed directly , We call it the of the computer
.
A、
Reference material 【 】
23、【 Completion 】 english “CPU” The corresponding Chinese explanation is
_____.
A、
Reference material 【 】
24、【 Completion 】 There are two ways to translate high-level language programs into low-level language programs or machine language programs : Compiling and ____________.
A、
Reference material 【 】
25、【 Completion 】 Programming methods are generally divided into : Structured programming method ( Also known as process oriented programming method ) and ____________.
A、
Reference material 【 】
26、【 Completion 】 The following expression evaluates to ____________.30-3**2
A、
Reference material 【 】
27、【 Completion 】 The result of the following command about string operation is ____________.12+34
A、
Reference material 【 】
28、【 Completion 】 The following expression evaluates to ____________.13//5+3
A、
Reference material 【 】
29、【 Completion 】 The following expression evaluates to ____________.13%5+3
A、
Reference material 【 】
30、【 Completion 】 The following expression evaluates to ____________.(-7+2)(-4)
A、
Reference material 【 】
31、【 Completion 】 Use IDLE To write Python The program , stay ____________( Interactive mode / File mode ) Not required in print function , Just enter the name of the variable to see the data content in the variable .
A、
Reference material 【 】
Unit work in the second week
Unit test in the second week
1、【 Single topic selection 】 The following legal user-defined identifiers are ____________.
A、_kill23
B、a
b
C、break
D、1a2b
Reference material 【 】
2、【 Single topic selection 】Python The identifier in a language consists of letters 、 When numbers and underscores are composed of three characters , First character ____________.
A、 Can only be letters or underscores
B、 Can only be letters
C、 It could be letters , Any of the characters in numbers and underscores
D、 Can only be underscores
Reference material 【 】
3、【 Single topic selection 】 Usually we will Python The language program is saved in a suffix ____________ In the file of .
A、py
B、p
C、pt
D、python
Reference material 【 】
4、【 Single topic selection 】 Execute the following program segments , The output is zero ____________.x = 7.0
y = 5
print(x % y)
A、2.0
B、2
C、1.0
D、1
Reference material 【 】
5、【 Single topic selection 】 If the program has only the following two lines of code , The execution result of the program is
.x = a + 10
print(x)
A、 Program error
B、0
C、10
D、 Output a random result
Reference material 【 】
6、【 Single topic selection 】 The result of the execution of the following statement is
_________.‘hello’ - ‘world’
A、 Program error
B、helloworld
C、hello world
D、52473
Reference material 【 】
7、【 Single topic selection 】 The execution result of the following program segments is ___________.x = 1
print(type(x))
x = 1.0
print(type(x))
x = ‘1.0’
print(type(x))
A、<class ‘int’><class ‘float’><class ‘str’>
B、<class ‘float’><class ‘int’><class ‘str’>
C、<class ‘str’><class ‘float’><class ‘int’>
D、<class ‘str’><class ‘int’><class ‘float’>
Reference material 【 】
8、【 Single topic selection 】 Execute the following program segments , Enter the value 10, The output is zero ___________.x = input()
y = x + 5
print(y)
A、 Program error
B、‘15’
C、‘105’
D、15
Reference material 【 】
9、【 Single topic selection 】 Integer type 、 When floating-point and complex data are mixed together ,Python A default data type conversion will be performed , Options ____________ Correctly represent the relationship of this type conversion .
A、 Integers -> Floating point numbers -> The plural
B、 Integers -> The plural -> Floating point numbers
C、 The plural -> Floating point numbers -> Integers
D、 Floating point numbers -> The plural -> Integers
Reference material 【 】
10、【 Single topic selection 】 The following options can be used as Python The name of the program variable is ____________.
A、jet
B、3k
C、-bird-
D、t%ke
Reference material 【 】
11、【 Single topic selection 】 The result of the following program is ____________.a=58
b=True
a+b413
A、True
B、-1
C、False
D、0
Reference material 【 】
12、【 Single topic selection 】 Suppose there are now two variables, namely x and y, among x=3,y=5, Of the following options ____________ You can't exchange values in two variables .
A、x=yy=x
B、x,y=y,x
C、t=xx=yy=t
D、x=x+yy=x-yx=x-y
Reference material 【 】
13、【 Single topic selection 】Python3 in , Use input() Function can get the data entered by the user from the keyboard , No matter what the user enters , The default data type for this data is ____________.
A、 character string
B、 Integers
C、 The set of real Numbers
D、True perhaps False
Reference material 【 】
14、【 Single topic selection 】 After executing the following statements , Variable a and b The values of are ____________.a=1
b=a=a+1
A、a=2,b=2
B、a=1,b=1
C、a=1,b=2
D、a=2,b=1
Reference material 【 】
15、【 Single topic selection 】 In the following options , The result of the run is not of floating point type .
A、15//4
B、3e2
C、12/3
D、3+1.0
Reference material 【 】
16、【 Single topic selection 】 In the following options , No Python Legal variable name .
A、x32
B、10XL
C、my
D、name
Reference material 【 】
17、【 Single topic selection 】 The value of the following expression is True Yes.
.
A、5+4j>2-3j
B、3>2>1
C、(3,2)< (‘a’,‘b’)
D、‘abc’ > ‘xyz’
Reference material 【 】
18、【 Judgment questions 】Python The program can be in Shell Interactive execution in the environment , It can also be stored as .py For program files with extensions Python The interpreter performs .
A、 correct
B、 error
Reference material 【 】
19、【 Judgment questions 】Python Language is case sensitive .
A、 correct
B、 error
Reference material 【 】
20、【 Judgment questions 】 stay Python in ,“=” It can not only represent the assignment operation , It can also be used to judge whether two numbers are equal
A、 correct
B、 error
Reference material 【 】
21、【 Judgment questions 】 The order of precedence of logical operators is :not and or.
A、 correct
B、 error
Reference material 【 】
22、【 Completion 】 In a computer program “=” It's called
.
A、
Reference material 【 】
23、【 Completion 】 The output of the following statement is
_______.int(10.88)
A、
Reference material 【 】
24、【 Completion 】 The output of the following statement is :'’.‘abc’ * 3
A、
Reference material 【 】
25、【 Completion 】 After the following program runs ,x The value of is
___.x=3
x
=3+52
A、
Reference material 【 】
26、【 Completion 】 Logical data can be treated as integers in the process of arithmetic operation , Usually True The value of corresponds to an integer 1,False The value of corresponds to an integer ____________.
A、
Reference material 【 】
27、【 Completion 】 In general ,Python The use of symbols in language ________ Indicates a comment in a program ; There is another use ’’’…’’‘ Special notes for .
A、
Reference material 【 】
28、【 Completion 】 expression “1//3” The result is ________.
A、
Reference material 【 】
29、【 Completion 】 expression “1.0+21.0” As the result of the ________.
A、
Reference material 【 】
30、【 Completion 】 The output of the following statement is ___________. round(10.5)
A、
Reference material 【 】
31、【 Completion 】 expression “ x=‘odd’ if len(‘hello’)%2 else ‘even’ ” The result of execution is :x=‘’.
A、
Reference material 【 】
Week 3 unit work
Third week unit test
1、【 Single topic selection 】Python Errors contained in language programs , There are generally three kinds of , following ____________ Not one of them .
A、 Compile error
B、 Grammar mistakes
C、 Algorithm error
D、 Runtime error
Reference material 【 】
2、【 Single topic selection 】 if s = ‘Hello World’, execute s.replace(‘l’, ‘m’) after ,s The content is
____.
A、‘Hello World’
B、‘Hemmo Wormd’
C、‘Hemlo World’
D、‘Hello Wormd’
Reference material 【 】
3、【 Single topic selection 】 The output of the following code is ____________.’{:.4e}’.format(234.56789)
A、‘2.3457e+02’
B、‘2.3456e+02’
C、‘234.5679’
D、‘2.345e+02’
Reference material 【 】
4、【 Single topic selection 】 By string s = ‘this is a pen’ get ‘This Is A Pen ’ The method to ____________.
A、s.title()
B、s.capitalize()
C、s.upper()
D、s.isupper()
Reference material 【 】
5、【 Single topic selection 】 If the string s = ‘hello’, Then the statement s.ljust(8, ‘.’) and s.rjust(8) The output of is ____________.
A、‘hello…’’ hello’
B、’…hello’’ hello’
C、‘hello…’‘hello ’
D、‘hello…’‘hello’
Reference material 【 】
6、【 Single topic selection 】 After the following expression is run , The result is False.
A、‘Hello’>‘hello’
B、‘abcd’<‘ad’
C、‘abcd’>‘abc’
D、’ '<‘a’
Reference material 【 】
7、【 Single topic selection 】 Receive an integer entered by the user . If you enter an even number , The output “True”, Otherwise output “False”. The program that can realize the above functions is
_.
A、print(not bool(int(input()) % 2))
B、print(int(input()) % 2 != 0)
C、print(int(input()) % 2 == 1)
D、print(not bool(input() % 2))
Reference material 【 】
8、【 Single topic selection 】 When outputting a floating-point number in a string , The most commonly used is to retain the decimal point 2 The format controller of bit is ____________.
A、{:.2f}
B、{.2}
C、{:2f}
D、{.2f}
Reference material 【 】
9、【 Single topic selection 】 The error contained in the following program is ____________.r=input( Please enter the radius of the circle :)
S=3.14rr
print( The radius is {} The area of the circle is {}.format(r,S))
A、 Runtime error
B、 Grammar mistakes
C、 Algorithm error
D、 The program has no errors
Reference material 【 】
10、【 Single topic selection 】 The error contained in the following program is ____________.r=eval(input( Please enter the radius of the circle :))
S=23.14r
print( The radius is {} The area of the circle is {}.format(r,S))
A、 Algorithm error
B、 Grammar mistakes
C、 Runtime error
D、 The program has no errors
Reference material 【 】
11、【 Single topic selection 】 The execution result of the following statement is ____________. int(5.6)
A、 There's something wrong with the program
B、5
C、6
D、‘5’
Reference material 【 】
12、【 Single topic selection 】 The execution result of the following statement is ____________. round(4.5)
A、4
B、5
C、4.5
D、 There's something wrong with the program
Reference material 【 】
13、【 Single topic selection 】 Of the following options , Not one of the functions of annotations .
A、 When the program goes wrong , The computer will repair the program according to the code in the comments
B、 Describe the functions the program wants to achieve or the problems it wants to solve
C、 Help people who read the program better understand the execution process of the program
D、 Explain the implementation details of the code in the program
Reference material 【 】
14、【 Single topic selection 】 The following statement about strings is wrong
.
A、{:.2f} It is used to format the output value with the decimal point 2 position
B、 Substring lookup function of string find() Only the position of the first matching substring can be returned , Otherwise return to 0
C、 You can use single quotation marks , You can also create a string in double quotes
D、 Special characters such as line feed and carriage return can be included in the three quotation mark string
Reference material 【 】
15、【 Single topic selection 】Python The escape character for line feed in language is
________.
A、\t
B、\n
C、\a
D、\r
Reference material 【 】
16、【 Judgment questions 】 When Python When the program contains algorithm errors , Can't be executed .
A、 correct
B、 error
Reference material 【 】
17、【 Judgment questions 】 In the format string , Use... In formatting tags “^” You can center and align the output content at the specified output position .
A、 correct
B、 error
Reference material 【 】
18、【 Judgment questions 】 To illustrate the role of the program , Comments can only be placed at the beginning of the program , It cannot be placed elsewhere in the program .
A、 correct
B、 error
Reference material 【 】
19、【 Judgment questions 】 Errors in the program , Also called by programmers BUG, We should try our best to eliminate BUG.
A、 correct
B、 error
Reference material 【 】
20、【 Completion 】 The result of running the following string is ’_’.x=‘hello’’{0:*^11}’.format(x)
A、
Reference material 【 】
21、【 Completion 】 The output of the following statement is ’
’.{1} Basic {0}{2}.format( To write ,‘ Program ’,’’‘ Method ’’’)
A、
Reference material 【 】
22、【 Completion 】 stay IDLE Run in Python When it comes to programming , If you pop up a “SyntaxError” The dialog , Indicates that the current program contains ____________( Grammar mistakes / Algorithm error / Runtime error ).
A、
Reference material 【 】
23、【 Completion 】 To enhance the readability of the program , We are Python A program is often written with # Code at the beginning , This code that does not participate in program execution is called ____________.
A、
Reference material 【 】
24、【 Completion 】 The following expression evaluates to .30-3
2+8//32/10
A、
Reference material 【 】
25、【 Completion 】 Writing Python The program , If you accidentally write a closing parenthesis in a statement , Will cause the current program to change ____________( Grammar mistakes / Algorithm error / Runtime error ).
A、
Reference material 【 】
Unit 4 homework
Unit four
1、【 Single topic selection 】 We use turtle.speed() Set the crawling speed for the little turtle , When we want to skip the movement of the little turtle , When directly getting the graphics drawn by the program ,speed() The parameter value of should be __________.
A、0
B、1
C、5
D、10
Reference material 【 】
2、【 Single topic selection 】 Which of the following methods is used to control the size of the brush ____________.
A、pensize()
B、pencolor()
C、penup()
D、pendown()
Reference material 【 】
3、【 Single topic selection 】 The output of the following segments is ___________.x = 0
def fun(y):
y = 1
fun(x)
print(x)
A、0
B、1
C、2
D、3
Reference material 【 】
4、【 Single topic selection 】 The output of the following program is ___________.x = 1
def fun():
global x
x = 2
fun()
print(x)
A、2
B、0
C、1
D、3
Reference material 【 】
5、【 Single topic selection 】 Define the following functions , Which of the following function calls will make an error ___________.def P(a1,a2=2,a3=3):
print(a1,a2,a3)
A、P(a2=10,a3=10)
B、P(10,a3=10)
C、P(a3=10,a1=10)
D、P(10)
Reference material 【 】
6、【 Single topic selection 】 The output of the following program is :.x = 10
y = 20
def swap(x, y):
t = x
x = y
y = t
print(x, y)
swap(x,y)
print(x,y)
A、20 1010 20
B、10 20 10 20
C、10 2020 10
D、20 1020 10
Reference material 【 】
7、【 Single topic selection 】 When we want to fill a closed circle with red , We will use the statement turtle.begin_fill() and turtle.end_fill(), But when we forget to use turtle.end_fill() when , What will happen
_.
A、 There is no red filling in the circle
B、 A red circle
C、 The canvas is filled with red
D、 Program error
Reference material 【 】
8、【 Single topic selection 】 stay Python The keyword for importing other function libraries in is ___________.
A、import
B、from
C、into
D、include
Reference material 【 】
9、【 Single topic selection 】 Which of the following turtle The method is used to set the orientation of the little turtle ?
A、setheading()
B、sethead()
C、heading()
D、head()
Reference material 【 】
10、【 Single topic selection 】 If we color(’#FF0000’,’#0000FF’) Set the color of the little turtle , So which of the following is true ?
A、 The outline color is red , The fill color is blue
B、 The outline color is blue , The fill color is red
C、 The outline color is blue , The fill color is green
D、 The outline color is red , The fill color is yellow
Reference material 【 】
11、【 Single topic selection 】 After which of the following methods is executed , You can set the little turtle to leave no trace in the process of moving ?
A、up()
B、down()
C、left()
D、right()
Reference material 【 】
12、【 Single topic selection 】 If we want the little turtle's brush to face upward , Which of the following methods should be performed ?
A、setheading(90)
B、setheading(0)
C、setheading(-90)
D、setheading(180)
Reference material 【 】
13、【 Single topic selection 】 The default marker shape of the little turtle in the drawing area is a ___________.
A、 arrow
B、 Turtle graphics
C、 Five-pointed star
D、 circle
Reference material 【 】
14、【 Single topic selection 】 If we use goto(0,0) Function call for , After executing this statement , The turtle's position is ___________.
A、 In the middle of the screen
B、 The upper left corner of the screen
C、 Top right corner of the screen
D、 The bottom left corner of the screen
Reference material 【 】
15、【 Single topic selection 】 The effect of the following statement is ___________.turtle.circle(-90,90)
A、 Draw a radius of 90 Arc of , The center of the circle is on the right side of the direction of the little turtle
B、 Draw a circle centered on (-90,90) The circle of
C、 Draw a radius of 90 Arc of , The center of the circle is on the left side of the direction of the little turtle
D、 Draw a radius of 90 Round
Reference material 【 】
16、【 Single topic selection 】 After drawing with the little turtle , We usually use ___________ Carry out the closing work .
A、turtle.done()
B、turtle.finish()
C、turtle.complete()
D、turtle.exit()
Reference material 【 】
17、【 Judgment questions 】 Move forward in the turtle function forward() It can also be abbreviated as fd().
A、 correct
B、 error
Reference material 【 】
18、【 Judgment questions 】 Turtle function circle() You can only draw a complete circle , You can't draw an arc .
A、 correct
B、 error
Reference material 【 】
19、【 Judgment questions 】 Use goto() Function to move the turtle to another location , There must be no trace on the screen .
A、 correct
B、 error
Reference material 【 】
20、【 Completion 】 The output of the following program is :.def sum(i1, i2):
result = 0
for i in range(i1, i2 + 1):
result += i
return result
print(sum(1, 10))
A、
Reference material 【 】
21、【 Completion 】 The output of the following program is :'
’.def func(a,b):
return a
b
s=func(‘hello’,2)
print(s)
A、
Reference material 【 】
22、【 Completion 】 When we want to fill a closed shape with color , We will use the statement turtle.begin_fill() and turtle..
A、
Reference material 【 】
Experimental report
Week 5 unit work
Week five unit test
1、【 Single topic selection 】 The key words that can end a cycle are _____________.
A、break
B、if
C、exit
D、continue
Reference material 【 】
2、【 Single topic selection 】 The following are the basic elements of the flowchart ________________.
A、 Judgment box
B、 Sequential statements
C、 Branch statement
D、 Loop statement
Reference material 【 】
3、【 Single topic selection 】 The output of the flowchart shown in the figure below is
_______.<img src="http://edu-image.nosdn.127.net/3CD49A679CF1769E7EC3987708C7A6CD.jpg?imageView
A、2
B、0
C、1
D、3
Reference material 【 】
4、【 Single topic selection 】 The following statement about the flow line is incorrect _______________.
A、 As long as the flow line is in the up-down direction, it means to execute from top to bottom. There is no arrow
B、 The flow line, no matter what direction , Press the general arrow to execute
C、 The flow line indicates the sequence of algorithm steps , Used to connect the flow chart frame
D、 A flow line is a line with an arrow , It can be drawn as a broken line
Reference material 【 】
5、【 Single topic selection 】 Read the following program , Select the correct output _______________.x = 10
y = 20
if x 10:
if y 20:
z = x + y
print(‘z is’, z)
else:
print(x)
A、10
B、20
C、30
D、 No output
Reference material 【 】
6、【 Single topic selection 】 Read the following code , Select the correct output _______________.grade = 90
if grade = 60:
print( ‘D’)
elif grade = 70:
print( ‘C’)
elif grade = 80:
print( ‘B’)
elif grade = 90:
print( ‘A’)
A、D
B、A
C、B
D、C
Reference material 【 】
7、【 Single topic selection 】 The output of the following program is _______________.number = 10
if number % 2 == 0:
print(number, ‘is even’)
elif number % 5 == 0:
print(number, ‘is multiple of 2’)
A、10 is even
B、10 is multiple of 2
C、10 is even10 is multiple of 2
D、 Program error
Reference material 【 】
8、【 Single topic selection 】 The output of the following program is _____________.x = 1
y = -1
z = 1
if x 0:
if y 0:
print(‘AAA’)
elif z 0:
print(‘BBB’)
A、 There is no output
B、‘AAA’
C、‘BBB’
D、 Program error
Reference material 【 】
9、【 Single topic selection 】 The output of the following program is ___________.y = 0
for i in range(0, 10, 2):
y += i
print(y)
A、20
B、0
C、10
D、30
Reference material 【 】
10、【 Single topic selection 】 The output of the following program is ___________.x = 0
while x6:
if x%20:
continue
if x
4:
break
x += 1
print(x=,x)
A、 Dead cycle
B、1
C、4
D、6
Reference material 【 】
11、【 Single topic selection 】 The number of times the following loop body is executed is different from others ________.
A、i=0
while(i<=1000):
print(i)
i=i+1
B、for i in range(100):
print(i)
C、for i in range(100,0,-1):
print(i)
D、i=100
while(i>0):
print(i)
i=i-1
Reference material 【 】
12、【 Single topic selection 】 In high-level language programs , The three basic structures of the program do not include ________.
A、 Sequential structure
B、 Branching structure
C、 Loop structure
D、 Restrictive structure
Reference material 【 】
13、【 Single topic selection 】 The following statement is correct ____________.
A、Python The program can only run in Windows Series of operating systems .
B、Python 3.x And Python 2.x Is compatible with each other .
C、Python Indentation in is not arbitrary , Must be carried out in accordance with the specifications , Each level must use four spaces .
D、Python If a statement is too long and does not want to be displayed in one line , It is often necessary to add... At the end of the line “\” Line continuation operator .
Reference material 【 】
14、【 Completion 】 Read the following program , The final output value is _______________.var_A = 50
if var_A 20:
var_A += 10
else:
var_A -= 10
var_A += 3
print(var_A)
A、
Reference material 【 】
15、【 Completion 】 After the following procedures are run , The value printed on the screen is ___________.sum = 0
i = 1
while sum 10:
if i % 2 != 0:
sum += i
print(sum)
A、
Reference material 【 】
16、【 Completion 】 The output of the following code is __________.num = 27
count = 0
while num 0:
if num % 2 == 0:
num /= 2
elif num % 3 == 0:
num /= 3
else:
num -= 1
count += 1
print(count)
A、
Reference material 【 】
17、【 Completion 】 The output of the following program is __________.max = 10
sum = 0
extra = 0
for num in range(1, max):
if num % 2 and not num % 3:
sum += num
else:
extra += 1
print(sum)
A、
Reference material 【 】
18、【 Completion 】 If you enter 4, 6.8, 1, 9.7, -2, What is the output result of the following program ____________.number = eval(input())
max = number
while number0:
number = eval(input())
if number max:
max = number
print(max)
A、
Reference material 【 】
19、【 Completion 】 Execute the following code , Then the running result of the program is :s= .s = 0
for i in range(1,21) :
if i%2 == 0 :
continue
if i%10 == 7 :
break
s = s+i
print(s=,s)
A、
Reference material 【 】
20、【 Completion 】 Execute the following code , Then the running result of the program is .a = m = 15
b = n = 20
while a%b!=0:
a,b=b,a%b
print(b,mn//b)
A、
Reference material 【 】
21、【 Completion 】 Execute the following code , Then the running result of the program is .year = eval(input( Year of importation :)) # Also available int() function
if (year%40 and year%100 !=0) or (year%4000):
print( Leap year )
else:
print( Non leap year ) When running, enter 1900 when , How the program runs ?
A、
Reference material 【 】
22、【 Completion 】 Execute the following code , After the program runs , The first line of the results displayed on the screen is :.for i in range(3,10,3):
if i%2:
print(i)
A、
Reference material 【 】
23、【 Completion 】 Execute the following code , After the program runs , The second line of the results displayed on the screen is :
.for i in range(3,10,3):
if i%2:
print(i)
A、
Reference material 【 】
Experimental report : Process control of procedure
Week 6 unit work
Week 6 unit test
1、【 Single topic selection 】 About the list , The following description is incorrect ___________.
A、 The elements must be inserted in order
B、 There is no limit to length
C、 Element types can be different
D、 Support in Operator
Reference material 【 】
2、【 Single topic selection 】 The following methods do not apply to strings ___________.
A、sort()
B、count()
C、find()
D、index()
Reference material 【 】
3、【 Single topic selection 】 The output of the following program is ___________.a = [10, 20, 30]
print(a * 2)
A、[10, 20, 30, 10, 20, 30]
B、[20, 40, 60]
C、[11, 22, 33]
D、[10, 20, 30]
Reference material 【 】
4、【 Single topic selection 】 expression (12, 34, 56) + (78) The result is ____________.
A、 Program error
B、(12, 34, 56, 78)
C、[12, 34, 56, 78]
D、(12, 34, 56, (78))
Reference material 【 】
5、【 Single topic selection 】 The output of the following program is ___________.sum=0
for i in range(10):
sum+=i
print(sum)
A、45
B、0
C、10
D、55
Reference material 【 】
6、【 Single topic selection 】 About tuple data structure , The following description is correct :.
A、 Support in Operator
B、 All element data types must be the same
C、 Insert new elements at the end
D、 Tuples do not support slicing
Reference material 【 】
7、【 Single topic selection 】 The methods supported by tuples and lists are ______________.
A、index()
B、append()
C、extend()
D、remove()
Reference material 【 】
8、【 Single topic selection 】 In the dictionary , Which is faster to find a key or a value
.
A、 key
B、 value
C、 Same fast
D、 Can't compare
Reference material 【 】
9、【 Single topic selection 】 The execution result of the following statement is
____________.{1, 2, 3} {3, 4, 5}
A、{3}
B、{1, 2, 3, 4, 5}
C、{1, 2, 3, 3, 4, 5}
D、 Program error
Reference material 【 】
10、【 Single topic selection 】 The following sentence , Which cannot create a dictionary ______________.
A、{1, 2, 3}
B、dict(zip([1, 2, 3], [4, 5, 6]))
C、dict([(1, 4), (2, 5), (3, 6)])
D、{ }
Reference material 【 】
11、【 Single topic selection 】 The following statement that cannot create a dictionary is ________.
A、dict1 = {}
B、dict2 = { 3 : 5 }
C、dict3 = dict( [2 , 5] ,[ 3 , 4 ] )
D、dict4 = dict( ( [1,2],[3,4] ) )
Reference material 【 】
12、【 Single topic selection 】 The way to delete all elements in the dictionary is .
A、clear()
B、delete()
C、close()
D、deleteAll()
Reference material 【 】
13、【 Single topic selection 】 For the sequence numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Which of the following related operations results in a number 6?
A、>>> numbers[0: 5]
B、>>> numbers[6]
C、>>> numbers[5: -1]
D、>>> numbers[-4: -1]
Reference material 【 】
14、【 Single topic selection 】 The output of the following options is 10 Yes.
____.
A、>>>print(list(range(1, 20, 3))[4])
B、>>>print(len(‘12345’ + ‘56789’))
C、>>>print(len({‘a’:1, ‘b’:2, ‘c’:3, ‘d’:4, ‘e’:5}))
D、>>>print(‘1’ * 10)
Reference material 【 】
15、【 Single topic selection 】 Among the following four assignment operations , Which operation can get a dictionary type data ?
A、>>>data = (‘Zhangsan’, 18)
B、>>>data = [‘Zhangsan’, 18]
C、>>>data = {‘Zhangsan’: 18}
D、>>>data = “‘Zhangsan’, 18”
Reference material 【 】
16、【 Completion 】 The output of the following program is __________.a = [10, 20, 30]
b = a
b[1] = 40
print(a[1])
A、
Reference material 【 】
17、【 Completion 】 The execution result of the following procedure is ___________.def fun(lst):
lst = [4, 5, 6]
lst = [1, 2, 3]
fun(lst)
print(lst)
A、
Reference material 【 】
18、【 Completion 】 The output of the following program is __________.def fun(list):
list = [4, 5, 6]
return list
a = [1, 2, 3]
fun(a)
print(a[1])
A、
Reference material 【 】
19、【 Completion 】 The return result of the following expression is __________.[n
n for n in range(6) if n*n % 2 ==1]
A、
Reference material 【 】
20、【 Completion 】Python Combined data types include tuples 、 list 、 Dictionaries 、 aggregate , among ________ yes Python The only mapping type in .
A、
Reference material 【 】
21、【 Completion 】Python Provides operations to determine whether an element belongs to a sequence , This operation uses the operator ________ To complete .
A、
Reference material 【 】
22、【 Completion 】 set up s=‘abcde’, be s[1:3] The value is ’’.
A、
Reference material 【 】
23、【 Completion 】 set up s=‘abcde’, be s[::-1] The value is ’
’.
A、
Reference material 【 】
24、【 Completion 】 The result of the following string operation is ’’.x=‘hello’
print(x[::-1])‍
A、
Reference material 【 】
25、【 Completion 】 Given string s=hello world, obtain hello The slice expression of is
.
A、
Reference material 【 】


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved