National Computer Ranking Examination | Level 2 Python | Real questions and analysis (4)

1. Multiple choice questions

1 . The following options that describe the incorrect indentation format of Python programs are ( )

A. Code that does not need to be indented should be written on the top line, and no blank space should be left in front of it.

B. Indentation can be achieved using the tab key or multiple spaces.

C. Strict indentation can constrain the program structure and enable multi-level indentation

D.Indentation is used to format and beautify Python programs.

2 . The result of running the following Python program segment is ( )

x=0

for  i  in range(1,20,3):

        x=x+i

print(x)

A.80                                B.190                              C.70                                D.210

3 . Which statement about the following Python program segment is correct ( )

k=1

while  1:

        k+=1

A. There is a syntax error and cannot be executed B. Executed once C. Execute unlimited times D.Execute k times

4 The result of running the following Python program segment is ( ).

i=0

sum=0

while i<10:

     if i%2==0:

          sum+=i

     i+=2

print("sum=",sum)

A.sum=17                      B.sum=18                      C.sum=19                      D.sum=20

5 . In VB, the following is equal to the value of the expression Len("python")+20 ( )

A.Int(Rnd * 26)+1                                                    B.Val("20")+16 mod 9

C.Mid("Hello2019",6,2)+"6"                                  D.abs(Sqr(16)– 30)

6 . Queue In Python, use ( ) to create a queue. The basic operations of the queue: ( ) ( ) ( ) ( ) Linear data structure is also called a linear table.

A. Randomly; join the team; leave the team; ask for the team leader; judge the team empty B.List; join the team; leave the team; seek the captain; judge the team is empty

C. List; random; leave the team; seek captain; judge the team empty D. Join the team; random; list; seek captain; judge the team empty

7 . Run the following Python program, the correct result is ( )

a=32

b=14

c=a//b

print(c)

A.2.2                               B.2                                  C.“2”                         D.4

8 . Run the following Python program, the correct result is ()

a=18

b=7

c=a%b

b=a%b

print(a,b)

A.18   5                       B.5  18                         C.18   4                       D.4  18

9 . The following ( ) are legal variable names in Python

A.int32                           B.40XL                            C.self                              D.name

10 It is known that the value of the string variable x is "H" and the ASCII value of the character "A" is 65, then the value of the python expression chr(ord(x)+2) is ( )

A.‘I’                          B.‘J’                                 C.73                                D.74

11 . Among the following options, which one is not a legal variable name in Python ( )

A.int32                           B.40xl                             C.self                              D._name_

12 . Regarding the python programming language, which of the following statements is incorrect ().

A. The python source file has the extension ***.py

B. The default interactive prompt for Python is: >>>

C. python can only write code in file mode

D.python has rich and powerful modules

13.The extension of Python program files is ( ).

A..python                       B..pyt                             C..pt                               D..py

14 . In Python, the result of the calculation 5+6*4% (2+8) is ( )

A.25

B.15

C.9

D.7.4

15 . The correct expression that means "x belongs to the interval [a, b)" in Python code is ( ).

A.a≤x and x<b 

Guess you like

Origin blog.csdn.net/PoGeN1/article/details/135367651