#141. GESP Python 三级 2024年06月 客观题
GESP Python 三级 2024年06月 客观题
一、单选题(每题2分,共30分)
- 小杨父母带他到某培训机构给他报名参加CCF组织的GESP认证考试的第1级,那他可以选择的认证语言有几种?( )
{{ select(1) }}
1234
- 下面流程图在yr输入2024时,可以判定yr代表闰年,并输出2月是29天,则图中菱形框中应该填入( )。

{{ select(2) }}
(yr%400==0) || (yr%4==0 && yr%100!=0)(yr%400==0) && (yr%4==0)(yr%400==0) && (yr%4==0 && yr%100!=0)
- 下列流程图的输出结果是?( )

{{ select(3) }}
5102030
- 将十进制2024转化成八进制,可以使用下列哪个表达式?( )
{{ select(4) }}
bin(2024)int(2024)oct(2024)hex(2024)
- 执行下面Python代码后,输出的结果是?( )
a = {'name': 'Tom', 'age': 12}
b = {'name': 'Join', 'email': '[email protected]'}
b.update(a)
print(len(b))
{{ select(5) }}
1234
- 执行下面Python代码后,输出的结果不可能是哪一项?( )
a = dict(zip(range(8, 0, -2), range(0, 8, 2)))
print(a)
{{ select(6) }}
{0: 8, 4: 4, 6: 2, 2: 6}{8: 0, 6: 2, 4: 4, 2: 6}{4: 4, 6: 2, 8: 0, 2: 6}{8: 0, 2: 6, 4: 4, 6: 2}
- 执行下面Python代码后,输出的结果是?( )
t1 = ("python", "c++", "scratch")
t2 = tuple(i for i in t1[::-1])
print(t2)
{{ select(7) }}
('scratch', 'c++', 'python')('python', 'scratch', 'c++')('scratch', 'python', 'c++')('c++', 'python', 'scratch')
- 执行下面Python代码后,输出的结果是?( )
t1 = (1, 2, 3, 4, 5, 6, 7)
t2 = ('a', 'b', 'c', 'd', 'e', 'f')
s = t1[2:] + t2[5:2:-1]
print(s)
{{ select(8) }}
(3, 4, 5, 6, 7, 'c', 'd', 'e')(3, 4, 5, 6, 7, 'f', 'e', 'd', 'c')(3, 4, 5, 6, 'f', 'e', 'd', 'c')(3, 4, 5, 6, 7, 'f', 'e', 'd')
- 执行下面Python代码后,输出的结果是?( )
a = [i % 10 for i in range(10, 20)]
b, c = [], []
while len(a) > 0:
s = a.pop()
if s % 2 == 0:
b.append(s)
else:
c.append(s)
print(b, c)
{{ select(9) }}
[9, 7, 5, 3, 1] [8, 6, 4, 2, 0][8, 6, 4, 2, 0] [9, 7, 5, 3, 1][0, 2, 4, 6, 8] [1, 3, 5, 7, 9][1, 3, 5, 7, 9] [0, 2, 4, 6, 8]
- 执行下面Python代码后,输出的结果是?( )
a = ['o', 'r', 'a', 'n', 'g', 'e']
a.sort()
a.reverse()
print(a)
{{ select(10) }}
['a', 'e', 'g', 'n', 'o', 'r']['e', 'g', 'n', 'a', 'r', 'o']['r', 'o', 'n', 'g', 'e', 'a']['o', 'r', 'a', 'n', 'g', 'e']
- 下面可以正确输出
They're planning a party for their friend's birthday.的Python语句是?( )
{{ select(11) }}
print('They\'re planning a party for their friend\'s birthday.")print("They\'re planning a party for their friend\'s birthday.')print('They're planning a party for their friend's birthday.')print('They\'re planning a party for their friend\'s birthday.')
- 执行下面Python代码后,输出的结果是?( )
s = 'gesp.ccf.org.cn'
print(s.split('.', 1))
{{ select(12) }}
['gesp', 'ccf.org.cn']['gesp', 'ccf', 'org.cn']['gesp', 'ccf', 'org', 'cn']['gesp.ccf.org.cn']
- 执行下面Python代码后,输出的结果可能是?( )
str = "Happy new year"
a = set(str)
print(a)
{{ select(13) }}
{'H', 'p', 'w', 'e', 'y', 'a', 'r', 'p', 'n'}{'p', 'n', 'w', 'r', 'H', 'y', 'a', 'e'}{'r', 'y', 'w', 'n', 'e', 'a', 'p', 'H', ' '}{'r', 'p', 'e', 'a', 'H', 'w', 'n', 'a', 'y'}
- 小杨在做数学题,题目要求找出从1到35中能被7整除的数字,即
[7, 14, 21, 28, 35],以下哪个解析式可以完成这样的任务?( )
{{ select(14) }}
[i for i in range(36) if i % 7 == 0][i for i in range(1, 36) if i % 7 == 0][i for i in range(1, 35) if i % 7 == 0][i for i in range(1, 36) if i // 7 == 0]
- 某小学男子篮球队招募新成员,要求加入球队的成员身高在135厘米以上(不含135厘米)。本次报名的人员有10人,她们的身高分别是125、127、136、134、137、138、126、135、140、145。完善以下代码,求出本次球队能够招募到新成员的人数?( )
a = [125, 127, 136, 134, 137, 138, 126, 135, 140, 145]
b = [i > 135 for i in a]
c =
print(c)
{{ select(15) }}
a.index(135)sum(b)len(b)b.count('True')
二、判断题(每题2分,共20分)
- GESP测试是对认证者的编程能力进行等级认证,同一级别的能力基本上与编程语言无关。( )
{{ select(16) }}
- 正确
- 错误
- 在Python中,
print(list("GESP"))将输出['G', 'E', 'S', 'P']。( )
{{ select(17) }}
- 正确
- 错误
- 集合是一个无序的不重复元素序列,用
{}作为界定符,如集合{1, 2, {3: 4}, 5, 6}。( )
{{ select(18) }}
- 正确
- 错误
- 集合支持索引操作,可以通过索引访问元素。( )
{{ select(19) }}
- 正确
- 错误
- 整数-6的16位补码可用十六进制表示为FFFA。( )
{{ select(20) }}
- 正确
- 错误
- 十六进制FB转成八进制为363。( )
{{ select(21) }}
- 正确
- 错误
- a, b为整数,如果表达式
a ^ b == 0为True,那么说明a与b相等。( )
{{ select(22) }}
- 正确
- 错误
- 执行下面Python代码后,输出的结果是8。( )
a = 0b1010
b = 0o1100
c = a & b
print(c)
{{ select(23) }}
- 正确
- 错误
- 执行下面Python代码后,输出的结果不可能是89781。( )
import random
i = 1
s = ""
while i <= 5:
a = random.randint(0, 9)
if a % 3 == (i + 1) % 3:
s += str(a)
i += 1
print(s)
{{ select(24) }}
- 正确
- 错误
- 把整数3025从中剪开分为30和25两个数,此时再将这两数之和平方,计算结果又等于原数。
(30 + 25) × (30 + 25) = 55 × 55 = 3025,这样的数叫“雷劈数”。可以使用枚举的方法求出所有符合这样条件的四位数。( )
{{ select(25) }}
- 正确
- 错误