EXY-SC-0175
第 201 题
对如下 4 个扑克牌进行排序,
struct Card {
int value;
char suit; // 花色
};
Card cards[4] = {{5,'A'}, {3,'B'}, {5,'C'}, {3,'D'}};
使用某排序算法按value排序后,结果为:{3,'D'}, {3,'B'}, {5,'A'}, {5,'C'},则这个排序算法是稳定的吗?
语言:
C++
GESP真题
四级
2025.12
单选题号:
10
EXY-SC-0174
第 202 题
给定函数 climbStairs(int n) 的定义如下,则 climbStairs(5) 的返回的值是( )。
int climbStairs(int n) {
if(n <= 2) return n;
int a = 1, b = 2;
for(int i = 3; i <= n; i++) {
int temp = a + b;
a = b;
b = temp;
}
return b;
}
语言:
C++
GESP真题
四级
2025.12
单选题号:
9
EXY-SC-0173
第 203 题
运行如下代码会输出( )。
struct Point {
int x, y;
};
struct Rectangle {
Point topLeft;
Point bottomRight;
};
int main() {
Rectangle rect = {{10, 10}, {20, 20}};
rect.topLeft.x = 5;
Point* p = &rect.bottomRight;
p->y = 5;
cout << rect.topLeft.x + rect.bottomRight.y;
return 0;
}
语言:
C++
GESP真题
四级
2025.12
单选题号:
8
EXY-SC-0172
第 204 题
执行完下面的代码后,a、b 和 c 的值分别是( )。
void byValue(int x) { x = 100; }
void byRef(int& x) { x = 200; }
void byPointer(int* x) { *x = 300; }
int main() {
int a = 1, b = 2, c = 3;
byValue(a);
byRef(b);
byPointer(&c);
return 0;
}
语言:
C++
GESP真题
四级
2025.12
单选题号:
7
EXY-SC-0171
第 205 题
执行完下面的代码后,输出是( )。
int a = 1;
void test() {
int a = 2;
{
int a = 3;
a++;
}
a++;
cout << a << " ";
}
int main() {
test();
cout << a;
return 0;
}
语言:
C++
GESP真题
四级
2025.12
单选题号:
6
当前页显示 201 - 205
,共 375 道单选题