#G3204. [GESP202403 三级] 客观题

    ID: 174 Type: Objective Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>GESP Python编程能力等级认证

[GESP202403 三级] 客观题

单选题

  1. 小杨的父母最近刚刚给他买了一块华为手表,他说手表上跑的是鸿蒙,这个鸿蒙是?( )

    {{ select(1) }}

  • 小程序
  • 计时器
  • 操作系统
  • 神话人物

  1. 中国计算机学会(CCF)在2024年1月27日的颁奖典礼上颁布了王选奖,王选先生的重大贡献是( )。

    {{ select(2) }}

  • 制造自动驾驶汽车
  • 创立培训学校
  • 发明汉字激光照排系统
  • 成立方正公司

  1. 下列流程图的输出结果是?( )

    {{ select(3) }}

  • 25
  • 30
  • 35
  • 55

  1. 在Python语言中,hex函数可以将十进制数转换成十六进制数。执行语句hex(2024)后,显示的运行结果是?()

    {{ select(4) }}

  • 0x7e6
  • 0x7e7
  • 0x7e8
  • 0x7e9

  1. 下列说法错误的是?()

    {{ select(5) }}

  • 字典是通过key(键)来进行访问的,跟列表、元组不同
  • a = {}是一个空字典
  • {{1, 2}: "123"}的数据类型是字典
  • 字典一旦创建不可以被修改

  1. 使用tuple函数创建元组错误的是?()

    {{ select(6) }}

  • a = tuple("1234")
  • a = tuple([10, 20, 30, 40])
  • a = tuple(20, 30)
  • a = tuple([10, 20, 30, 40])

  1. Python代码print(list(range(1, 10))[1::2]),输出结果是()

    {{ select(7) }}

  • 上述代码执行报错
  • [1, 3, 5, 7, 9]
  • [2, 4, 6, 8, 10]
  • [2, 4, 6, 8]

  1. 下列Python赋值语句错误的是()

    {{ select(8) }}

  • a = {10, 20, 30} * 3
  • a = {10, 20, 30} * 3
  • a = "123" * 3
  • a = [10, 20, 30] * 3

  1. 执行下列Python代码,输出结果是()
a = (1, 9, 3, 6, 3, 8)
a = sorted(a, reverse=True)
print(a)

{{ select(9) }}

  • (1, 3, 3, 6, 8, 9)
  • (9, 8, 6, 3, 3, 1)
  • [9, 8, 6, 3, 3, 1]
  • [1, 3, 3, 6, 8, 9]

  1. 对于字典 data = {'apple': 3.5, 'banana': 4.0, 'orange': 6.0}, 删除 'banana': 4.0 键值对的正确操作是( )?

{{ select(10) }}

  • del data['banana']
  • del data['banana': 4.0]
  • del data
  • data.remove('banana')

  1. 在三位数的自然数中,找出至少有一位数字是5的所有整数,应在横线填入代码是( )。
count = 0
lst = []
for i in range(100, 1000):
    a = i % 10
    b = i // 10 % 10
    c = i // 100
    if a == 5 or b == 5 or c == 5:
        # 在横线处填写代码
print("这样的三位数有:", lst)

{{ select(11) }}

  • lst.extend(i)
  • lst.append(i)
  • lst.add(i)
  • lst += i

  1. 以下哪个选项可以创建一个列表,包含1到10的奇数?( )

{{ select(12) }}

  • (x for x in range(1, 11) if x % 2 != 0)
  • (x for x in range(1, 11) if x % 2 != 0
  • [x for x in range(1, 11) if x % 2 != 0]
  • [x for x in range(1, 11)] if x % 2 != 0

  1. 有一组数据 [20, 0, 7, 0, 31] 存放在nums中,希望将列表中的所有零移动到列表尾,应在横线填入代码是( )。
nums = [20, 0, 7, 0, 31]
i, j = 0, 0
while i < len(nums):
    if nums[i] != 0:
        nums[j] = nums[i]
        j += 1
    i += 1
nums[j:] = ______
print(nums)

{{ select(13) }}

  • [0] * (len(nums) - i)
  • [0] * (len(nums) - j)
  • [0] * i

  1. 执行下列Python程序,最后的输出是( )?
lst = [1, 2, 7, 10, 15, 17, 22]
result = d = 3
for i in range(1, len(lst)):
    if lst[i] - lst[i - 1] > d:
        result += d
    else:
        result += lst[i] - lst[i - 1]
print(result)

{{ select(14) }}

  • 14
  • 16
  • 18
  • 20

  1. 执行下列Python程序,最后的输出是( )?
s = 'hello world'
words = s.split()
words = [x[::-1] for x in words]
print(" ".join(words))

{{ select(15) }}

  • olleh dirow
  • hello world
  • world hello
  • dirow olleh

判断题

  1. 任何一个for循环都可以转化为等价的while循环。

    {{ select(16) }}


  1. 小杨今年春节回奶奶家了,奶奶家的数字电视要设置ip地址并接入到WIFI盒子才能收看节目,那这个WIFI盒子具有路由器的功能。

    {{ select(17) }}


  1. 若s = ["Hello world", "I love GESP", [2024, 100]], 则len(s)的值为4。

    {{ select(18) }}


  1. 执行Python代码print(set([x % 2 for x in range(10)])), 输出的结果是{0, 1}。

    {{ select(19) }}


  1. Python表达式5^6的值是15。

    {{ select(20) }}


  1. 执行Python代码print('gesp.ccf.org.cn'.split('.')), 输出的结果是['gesp', 'ccf', 'org', 'cn']。

    {{ select(21) }}


  1. 执行下列Python代码,输出的结果是None {'Name': '小杨', 'Age': 12, 'Sex': 'female'}。
dict1 = {"Name": "小杨", "Age": 13}
dict2 = {"Sex": "female", "Age": 12}
dict1.update(dict2)
a = dict1.setdefault("Height", 165)
print(a, dict1)

{{ select(22) }}


  1. 执行下列Python代码print((tuple(range(1, 4)) * 3).index(2)),输出的结果是2。

    {{ select(23) }}


  1. 执行下列Python代码,输出的结果是["banana", "apple", "orange"]。
lst = list("banana")
lst.append("apple")
lst.extend("orange")
print(lst)

{{ select(24) }}


  1. 执行Python代码print(list("CCFGESP").reverse())与print(list("CCFGESP")[::-1]),其输出的结果相同。

{{ select(25) }}