#QKCP800. QKCP801~810

QKCP801~810

1、下列哪个选项是Python中合法的变量命名?( )`。 {{ select(1) }}

  • 1variable
  • variable_name
  • variable-name
  • var!able

2、那个符号用于Python中的字符串拼接?( )。 {{ select(2) }}

  • +
  • &
  • %
  • #

3、在Python中,那个关键字用于在for或while循环中跳过当前循环?( )。 {{ select(3) }}

  • pass
  • break
  • continue
  • return

4、考虑下面代码片段,关于变量result的描述哪些事正确的?( )

result = []
for i in range(3):
    for j in range(2):
        result.append((i,j))

{{ multiselect(4) }}

  • result 是一个列表
  • reslult 中包含了6个元素
  • result 的最后一个元素是(2,1)
  • result 中包含了3个元素

5、以下哪些布尔表达式的结果是True( )。 {{ multiselect(5) }}

  • 5 > 3 and 5 < 10
  • 5 == 5 or 5 != 5
  • not 5 == 5
  • 5 in [1,2,3,4,5]

6、如果有字典my_dict = {'a':1, 'b':2, 'c':3},以下哪些操作是有效的?( )。 {{ multiselect(6) }}

  • my_dict['d'] = 4
  • del my_dict['b']
  • my_dict.append('d':4)
  • my_dict['a']=6

7、考虑下列代码:

i = 10
while i>0:
    if i<5:
        break
    i = i-1
print(i)

下列说法正确的是?( )。 {{ multiselect(7) }}

  • 程序最终会输出4
  • i 的值会不断递增
  • while 循环的终止条件是 i>0
  • while 循环执行到第7次是会退出循环

8、已知list1 = [1,3,5,7,9]和列表list2 = [2,4,6,8],以下那些代码可以将两个列表合并为一个列表( )。 {{ multiselect(8) }}

  • list1.extend(list2)
  • list3 = list1+list2
  • list1.append(list2)
  • [list1, list2]

9、下列哪些运算符是逻辑运算符?( )。 {{ multiselect(9) }}

  • +
  • and
  • or
  • not

10、关于字符串的说法,下列哪些是正确的?( )

{{ multiselect(10) }}

  • 字符串时不可变的
  • 可以使用"+"运算符来拼接字符串
  • 可以使用索引来访问字符串中的特定字符
  • 可以改变字符串中特定索引位置的字符