#GESP202403C4T1. 单选题(每题 2 分,共 30 分)

    ID: 3335 Type: Objective Tried: 1 Accepted: 1 Difficulty: 3 Uploaded By: Tags>GESP四级程序设计基础数据结构数组排序递推

单选题(每题 2 分,共 30 分)

单选题(每题 2 分,共 30 分)

第 1 题

若函数声明为 int f(int &x){ x+=3; return x; },则对声明的变量 int a=3,下面哪个调用能够改变 aa 的值( )。

{{ select(1) }}

  • f(&a);
  • f(*a);
  • f(a);
  • f(a-3);

第 2 题

下面 C++ 代码执行后,输出的是( )。

int main()
{
    int x[] = {2, 0, 2, 4};
    char geSP[] = "Grade Examination of SP";

    cout << geSP[sizeof(x)] << endl;

    cout << endl;
    return 0;
}

{{ select(2) }}

  • G
  • e
  • n
  • P

第 3 题

下面 C++ 代码执行后输出是( )。

int foo(float *f)
{
    return int(*f * 2);
}

int main()
{
    float fnum[10] = {1.1};
    fnum[1] = foo(fnum);
    cout << fnum[0] + fnum[1] << endl;

    cout << endl;
    return 0;
}

{{ select(3) }}

  • 11
  • 1.11.1
  • 33
  • 3.13.1

第 4 题

对二维数组 int arr[3][16];,则 arr[1] 占用内存的大小为( )字节。

{{ select(4) }}

  • 44
  • 1616
  • 4848
  • 6464

第 5 题

对二维数组 int arr[3][16];,若 arr 的地址是 0x28cbc00x28cbc0,则 arr[1] 的值是( )。

{{ select(5) }}

  • 0x28cbc4
  • 0x28cbd0
  • 0x28cc00
  • 不确定

第 6 题

下面 C++ 代码执行后输出是( )。

int main()
{
    char *p = "I love GESP!";
    cout << p + 5 << endl;

    cout << endl;
    return 0;
}

{{ select(6) }}

  • e
  • I lov
  • e GESP!
  • GESP!

第 7 题

下面 C++ 代码执行以后输出的是( )。

int rc = 5;
int main()
{
    int rc;
    cout << ++rc << endl;

    cout << endl;
    return 0;
}

{{ select(7) }}

  • 00
  • 11
  • 66
  • 不确定

第 8 题

下面 C++ 函数中采用的算法是( )。

int fib(int n)
{
    int i, f[n] = {0, 1};

    for (int i = 2; i <= n; i++)
        f[i] = f[i - 1] + f[i - 2];

    return f[n];
}

{{ select(8) }}

  • 递推
  • 递归
  • 迭代
  • 循环

第 9 题

插入排序在最好情况下的时间复杂度是( )。

{{ select(9) }}

  • O(1)O(1)
  • O(N/2)O(N/2)
  • O(N)O(N)
  • O(N2)O(N^2)

第 10 题

在如下的 C++ 代码执行后,设第 11 和 12 行的输出地址值分别为 XXYY,则下面正确的是( )。

struct pass {
    int no;
    char name[20];
    int level;
};

int main()
{
    struct pass XiaoYang;

    cout << "&XiaoYang=" << &XiaoYang << endl;     //第11行
    cout << "&(XiaoYang.no)=" << &(XiaoYang.no) << endl; //第12行

    cout << endl;
    return 0;
}

{{ select(10) }}

  • X>YX > Y
  • X=YX = Y
  • X<YX < Y
  • 不确定

第 11 题

第11题 如果文件 1.txt 中的内容如下,则执行下面 C++ 代码时,注释了 #### 那行代码所输出的 xx 的值为( )。

50 2024 3.16 I
love
GESP!
int main()
{
    ifstream fin;
    string line;
    int x;
    fin.open("1.txt", ios::in);

    for (int i = 0; i < 2; i++) {
        fin >> line;
        cout << line << endl;
    }
    fin >> x;
    cout << x << endl; //####

    cout << endl;
    return 0;
}

{{ select(11) }}

  • 55
  • 20242024
  • 33
  • 00

第 12 题

执行下列 C++ 代码时输出中的第 2 行是( )。

int main()
{
    char *s[] = {(char*)"2024", (char*)"3.16", (char*)"GESP"};

    for (int i = 0; i < 2; i++) {
        cout << *s + i << endl;
    }

    cout << endl;
    return 0;
}

{{ select(12) }}

  • 20242024
  • 3.163.16
  • 024024
  • 33

第 13 题

C++ 语言中下面哪个关键字能够限定对象的作用域( )。

{{ select(13) }}

  • extern
  • static
  • inline
  • public

第 14 题

小杨的父母最近刚刚给他买了一块华为手表,他说手表上跑的是鸿蒙,这个鸿蒙是( )。

{{ select(14) }}

  • 小程序
  • 计时器
  • 操作系统
  • 神话人物

第 15 题

中国计算机学会(CCF)在 2024 年 1 月 27 日的颁奖典礼上颁布了王选奖,王选先生的重大贡献是( )。

{{ select(15) }}

  • 制造自动驾驶汽车
  • 创立培训学校
  • 发明汉字激光照排系统
  • 成立方正公司