理论卷2025年9月GESP等级认证(C++) · 四级
GESP C++ 4级 2025.09
满分 100 · 及格 60 · 时长 60 分钟 · 共 27 题 (单选15 / 判断10 / 编程题2)
本卷含 2 道编程题——可以先到「编程」专栏单独练习: 不计时、不关联卷面分,提交后按测例判分。
试卷阅览 · 免费预览前 10 题 · 交卷后可查看答案与解析
1
单选题号 #11160
分值 2运行下面程序后变量 a 的值是 ( )。
int a = 42;
int* p = &a;
*p = *p + 1;
2
单选题号 #11161
分值 2以下关于数组的描述中,( ) 是错误的。
3
单选题号 #11162
分值 2给定如下定义的数组 arr,则 *(*(arr + 1) + 2) 的值是 ( )。
int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};
4
单选题号 #11163
分值 2下面这段代码会输出 ( )。
int add(int a, int b = 1); // 函数声明
int main() {
cout << add(2) << " " << add(2, 3);
return 0;
}
int add(int a, int b) { // 函数定义
return a + b;
}
5
单选题号 #11164
分值 2下面这段代码会输出 ( )。
int x = 5;
void foo() {
int x = 10;
cout << x << " ";
}
void bar() {
cout << x << " ";
}
int main() {
foo();
bar();
}
6
单选题号 #11165
分值 2下面程序运行的结果是 ( )。
void increaseA(int x) {
x++;
}
void increaseB(int* p) {
(*p)++;
}
int main() {
int a = 5;
increaseA(a);
cout << a << " ";
increaseB(&a);
cout << a;
return 0;
}
7
单选题号 #11166
分值 2关于结构体初始化,以下哪个选项中正确的是 ( )。
struct Point {int x, y;};
8
单选题号 #11167
分值 2运行如下代码会输出 ( )。
struct Cat {
string name;
int age;
};
void birthday(Cat& c) {
c.age++;
}
int main() {
Cat kitty{"Mimi", 2};
birthday(kitty);
cout << kitty.name << " " << kitty.age;
return 0;
}
9
单选题号 #11168
分值 2关于排序算法的稳定性,以下说法错误的是 ( )。
10
单选题号 #11169
分值 2下面代码试图实现选择排序,使其能对数组 nums 排序为升序,则横线上应分别填写 ( )。
void selectionSort(vector<int>& nums) {
int n = nums.size();
for (int i = 0; i < n - 1; ++i) {
int minIndex = i;
for (int j = i + 1; j < n; ++j) {
if ( __________ ) { // 在此处填入代码
minIndex = j;
}
}
____________________; // 在此处填入代码
}
}
🔒
已解锁前 10 题
第 11~27 题(共 17 题)注册用户即可作答(每题 1 积分)
本卷为普通试卷:注册用户每题扣 1 积分(每日登录送 30 体验积分),交卷后查看答案与解析
