题目编号
语言
全部语言
等级
全部等级
知识点
选择知识点 (0)
找到 1260 道单选题
EXY-SC-0490
第 771 题

下面关于排序算法(冒泡排序、插入排序和选择排序)的描述中,不正确的是( )。

A

冒泡排序基于元素交换实现,需借助临时变量,共涉及 3 个单元操作;而插入排序基于元素赋值实现,仅需 1 个单元操作。因此冒泡排序的计算开销通常比插入排序更高。

B

选择排序在任何情况下的时间复杂度都为 $O(n^2)$。

C

冒泡排序在任何情况下的时间复杂度都为 $O(n^2)$。

D

如果给定数据部分有序,插入排序通常比选择排序效率更高。

语言: C++
GESP真题 四级
2024.12
单选题号: 10
EXY-SC-0489
第 772 题

下面代码采用递推算法来计算斐波那契数列 f(n) = f(n-1) + f(n-2),则横线上应填写( )。

int fib(int n) {
    if (n == 0 || n == 1)
        return n;

    int f1 = 0;
    int f2 = 1;
    int result = 0;
    for (int i = 2; i <= n; i++) {
        ___________________________    // 在此处填入代码
    }
    return result;
}
A
result = f1 + f2;
f1 = f2;
f2 = result;
B
result += f1 + f2;
f1 = f2;
f2 = result;
C
result += f1 + f2;
f2 = result;
f1 = f2;
D
result = f1 + f2;
f2 = result;
f1 = f2;
语言: C++
GESP真题 四级
2024.12
单选题号: 9
EXY-SC-0488
第 773 题

下面( )正确定义二维数组。

A

int a[3][];

B

int a[][];

C

int a[][4];

D

int a[][2] = {{1,2},{1,2},{3,4}};

语言: C++
GESP真题 四级
2024.12
单选题号: 8
EXY-SC-0487
第 774 题

假定整型是 32 位,对一个 2 行 3 列的二维整数数组 array,假设数组第一个元素在内存中的地址为 0x7ffee4065820,则第 2 行第 2 个元素的地址 &array[1][1] 为( )。

int array[2][3] = {
    {0, 1, 2},
    {3, 4, 5}
};
A

0x7ffee4065824

B

0x7ffee4065828

C

0x7ffee406582c

D

0x7ffee4065830

语言: C++
GESP真题 四级
2024.12
单选题号: 7
EXY-SC-0486
第 775 题

下面的描述中,( )不能正确定义一个名为 Student 的结构体以及一个包含 20 个元素的结构数组。

A
struct Student {
    string name;
    int age;
    float score;
};
struct Student students[20];
B
struct Student {
    string name;
    int age;
    float score;
};
Student students[20];
C
struct Student {
    string name;
    int age;
    float score;
};
Student* students = new Student[20];
D
struct Student {
    string name;
    int age;
    float score;
};
Student students = new Student[20];
语言: C++
GESP真题 四级
2024.12
单选题号: 6
当前页显示 771 - 775 ,共 1260 道单选题