EXY-SC-0535
第 726 题
下面代码试图实现选择排序,使其能对数组 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;
}
}
______________; // 在此处填入代码
}
}
语言:
C++
GESP真题
四级
2025.9
单选题号:
10
EXY-SC-0534
第 727 题
关于排序算法的稳定性,以下说法错误的是( )。
语言:
C++
GESP真题
四级
2025.9
单选题号:
9
EXY-SC-0533
第 728 题
运行如下代码会输出( )。
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;
}
语言:
C++
GESP真题
四级
2025.9
单选题号:
8
EXY-SC-0532
第 729 题
关于结构体初始化,以下哪个选项中正确的是( )。
struct Point {int x,y;};
语言:
C++
GESP真题
四级
2025.9
单选题号:
7
EXY-SC-0531
第 730 题
下面程序运行的结果是( )。
void increaseA(int x) {
x++;
}
void increaseB(int* p) {
(*p)++;
}
int main() {
int a = 5;
increaseA(a);
cout << a << " ";
increaseB(&a);
cout << a;
}
语言:
C++
GESP真题
四级
2025.9
单选题号:
6
当前页显示 726 - 730
,共 1260 道单选题