#gesp4j24. 2024GESP四级 结构体

2024GESP四级 结构体

2024GESP四级 结构体

2403真题

1.(2403-10)在如下的C++代码执行后,设第11和12行的输出地址值分别为 X 和 Y ,则下面正确的是( )?

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(1) }}

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

2406真题

无

2409真题

2.(2409-6)在 C++ 中,( )正确定义一个名为 student 的结构体,其中包含一个 name 字符数组和一个 age 整数? {{ select(2) }}

  • struct student { char name[20]; int age; };
  • student struct { char name[20]; int age; };
  • student struct { string name; int age; };
  • struct student { char[20] name; int age; };

2412真题

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

{{ select(3) }}

  • struct Student {
        string name;
        int age;
        float score;
    };
    struct Student students[20];
    
  • struct Student {
        string name;
        int age;
        float score;
    };
    Student students[20];
    
  • struct Student {
        string name;
        int age;
        float score;
    };
    Student* students = new Student[20];
    
  • struct Student {
        string name;
        int age;
        float score;
    };
    Student students = new Student[20];