题目编号
语言
全部语言
等级
全部等级
考查知识点
选择考查知识点 (0)
找到 1505 道单选题
EXY-SC-2910
第 66 题

以下代码实现了给定一个 $n\times m$ 的整数矩阵,能找出所有 $2\times2$ 子矩阵中,元素最大平均值的功能,以下哪个选项是正确的?( )

n, m = map(int, input().split())
matrix = [list(map(int, input().split())) for _ in range(n)]

max_avg = float("-inf")
for i in range(_____①_____):
    for j in range(_____②_____):
        # 计算当前2×2子矩阵的和
        total = matrix[i][j] + matrix[i][j + 1] + matrix[i + 1][j] + matrix[i + 1][j + 1]
        avg = total / 4.0
        if avg > max_avg:
            max_avg = avg

print(f"{max_avg:.2f}")
A

① n-1 ,② m-1

B

① n-2 ,② m-2

C

① n ,② m

D

① n-1 ,② m-2

语言: Python
GESP真题 四级
2026.9
单选题号: 15
EXY-SC-2909
第 67 题
文件 text.txt 的内容如下:
Python is a programming language. Python is easy to learn.
Many people use Python for data analysis and web development.
Python has a large community and many libraries.
以下代码实现了统计文件中单词 Python 出现的次数的功能,以下哪个选项是正确的?( )。
count = 0
with open("text.txt", "r") as f:
    content = f._____①_____
    words = content._____②_____
    for word in words:
        if word == "Python":
            count += 1
print(f"Python出现次数:{count}")
A
① readlines() ② split()
B
① read() ② split()
C
① read() ② strip()
D
① readlines() ② strip()
语言: Python
GESP真题 四级
2026.9
单选题号: 14
EXY-SC-2908
第 68 题

以下代码实现了根据交通灯颜色返回动作(停、等、行)的功能,以下哪个选项是正确的?( )

def traffic_action(color):
    actions = {"红": "停", "黄": "等", "绿": "行"}
    if color in actions:
        return _____①_____
    else:
        return "无效颜色"

color = input("输入交通灯颜色: ")
action = traffic_action(color)
print(f"颜色 {color} 对应的动作是: {_____②_____}")
A

① actions[color] ② action

B

① actions[color] ② color

C

① actions.get(color) ② actions

D

① actions.get(color, "无效颜色") ② color

语言: Python
GESP真题 四级
2026.9
单选题号: 13
EXY-SC-2907
第 69 题
执行下面 Python 代码后,输出的结果是?( )
students = [("Alice", "B", 25), ("Bob", "A", 23), ("Cathy", "A", 22)]
sorted_students = sorted(students, key=lambda x: (x[1], x[2]))
print([s[0] for s in sorted_students])
A
["Cathy", "Alice", "Bob"]
B
["Bob", "Cathy", "Alice"]
C
["Alice", "Bob", "Cathy"]
D
["Cathy", "Bob", "Alice"]
语言: Python
GESP真题 四级
2026.9
单选题号: 12
EXY-SC-2906
第 70 题
执行下面 Python 代码后,输出的结果是?( )
a = [1, 1]
for i in range(2, 10):
    a.append(a[i - 1] + a[i - 2])
print(a[8])
A
89
B
55
C
34
D
21
语言: Python
GESP真题 四级
2026.9
单选题号: 11
当前页显示 66 - 70 ,共 1505 道单选题