#GESP1031. [GESP202406三级] 客观题

    ID: 4251 客观题 尝试: 4 已通过: 1 难度: 2 上传者: 标签>GESP真题三级选择题枚举连续性问题数论进制转换

[GESP202406三级] 客观题

题目描述

[GESP202406三级] 客观题。本题为客观题,请在页面中按题号依次作答。题目正文、选项、图片或代码片段以页面中显示为准。

题目内容

题目描述

[GESP202406三级] 客观题。本题为客观题,请在页面中按题号依次作答。题目正文、选项、图片或代码片段以页面中显示为准。

题目内容

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

  1. 小杨父母带他到某培训机构给他报名参加 CCF 组织的 GESP 认证考试的第1级,那他可以选择的认证语言有几

    种?( )。

{{ select(1) }}

  • 11
  • 22
  • 33
  • 44
  1. 下面流程图在 yr 输入 20242024 时,可以判定 yr 代表闰年,并输出 22 月是 2929 天 ,则图中菱形框中应该填入 ( )。

    1

{{ select(2) }}

  • (yr%400==0) || (yr%4==0)
  • (yr%400==0) || (yr%4==0 && yr%100!=0)
  • (yr%400==0) && (yr%4==0)
  • (yr%400==0) && (yr%4==0 && yr%100!=0)
  1. 一般默认 6464 位计算机系统中整型变量(int)还是 3232 位,则整数能够表示的数据范围是( )。

{{ select(3) }}

  • 0 2320~2^{32}
  • 0 2640~2^{64}
  • 231 (231)1-2^{31}~(2^{31})-1
  • 263 (263)1-2^{63}~(2^{63})-1
  1. 下列代码将十进制转化成八进制,则横线上应填入 ( )。

    #include <iostream>
    using namespace std;
    void decimal2octal(int decimal) {
      int oct_number[100];
      int i = 0;
      while (decimal > 0) {
        __________________________ //在此处填入代码
      }
      for (int j = i - 1; j >= 0; j--) {
        cout << oct_number[j];
      }
      cout << endl;
    }
    

{{ select(4) }}

  • oct_number[i] = decimal % 8; decimal /= 8;
  • oct_number[i] = decimal / 8; decimal %/= 8;
  • oct_number[i++] = decimal % 8; decimal /= 8;
  • oct_number[i++] = decimal / 8; decimal %= 8;
  1. 二进制数 101.11101.11 对应的十进制数是( )。

{{ select(5) }}

  • 6.56.5
  • 5.55.5
  • 5.755.75
  • 5.255.25
  1. 下列流程图的输出结果是( )。

    2

    {{ select(6) }}

  • 55
  • 1010
  • 2020
  • 3030
  1. 下列代码的输出结果是( )。

    #include <iostream>
    using namespace std;
    int main() {
      int a = 12;
      int result = a >> 2;
      cout << result << endl;
      return 0;
    }
    

{{ select(7) }}

  • 1212

  • 66

  • 33

  • 11

  1. 下列代码的输出结果是( )。

    #include <iostream>
    using namespace std;
    int main() {
      int a = 5;
      int b = 10;
        a = a ^ b;
      b = a ^ b;
      a = a ^ b;
      cout << "a = " << a << ", b = " << b << endl;
      return 0;
    }
    

{{ select(8) }}

  • a = 5, b = 10
  • a = 5, b = 5
  • a = 10, b = 5
  • a = 10, b = 10
  1. 如果字符串定义为 char str[] = "GESP"; ,则字符数组 str 的长度为

{{ select(9) }}

  • 00
  • 44
  • 55
  • 66
  1. 在下列代码的横线处填写( ),可以使得输出是“7”

    #include <iostream>
    using namespace std;
    int main() {
      int array[5] = {3,7,5,2,4};
      int max = 0;
      for(int i=0; i<5; i++)
        if(______________) // 在此处填入代码
          max = array[i];
      cout << max << endl;
      return 0;
    }
    

{{ select(10) }}

  • max > array[i]
  • max < array[i]
  • max = array[i]
  • 以上均不对
  1. 小杨在做数学题,题目要求找出从 113535 中能被7整除的数字,即 [7, 14, 21, 28, 35] ,则横线处应填入哪个代码?( )。

    #include <iostream>
    using namespace std;
    int main() {
      int arr[35];
      int count = 0;
      for (int i = 1; i <= 35; i++) {
        if (i % 7 == 0)
        __________________________ // 在此处填入代码
      }
      for (int i = 0; i < count; i++)
        cout << arr[i] << endl;
      return 0;
    }
    

{{ select(11) }}

  • arr[count++] = i;
  • arr[i] = count++;
  • arr[i] = count;
  • arr[count] = count++;
  1. 已知字符 '0' ASCII 编码的十进制表示为 4848 ,则执行下面C++代码后,输出是

    #include <iostream>
    using namespace std;
    int main() {
      string s = "0629";
      int n = s.length();
      int x = 0;
      for(int i = 0; i < n; i++)
        x += s[i];
      cout << x << endl;
      return 0;
    }
    

{{ select(12) }}

  • 1717
  • 158158
  • 209209
  • 316316
  1. 某小学男子篮球队招募新成员,要求加入球队的成员身高在 135135 厘米以上(不含 135135 厘米)。本次报名的人员有 1010 人,他们的身高分别是 125、127、136、134、137、138、126、135、140、145 。完善以下代码,求出本次球队能够招募到新成员的人数?

    #include <iostream>
    using namespace std;
    int main() {
      int arr[10] = {125, 127, 136, 134, 137, 138, 126, 135, 140, 145};
      int count = 0;
      for(int i=0; i<10; i++)
          __________________________ // 在此处填入代码
      cout << count << endl;
      return 0;
    }
    

{{ select(13) }}

  • count = arr[i]>135? 1: 0;
  • count += arr[i]>135? 1: 0;
  • count++;
  • 以上都不对
  1. 下面可以正确输出 They're planning a party for their friend's birthday. 的C++语句是( )。

{{ select(14) }}

  • cout << 'They\'re planning a party for their friend'\s birthday." << endl;
  • cout << "They\'re planning a party for their friend's birthday.'<< endl;
  • cout << 'They're planning a party for their friend's birthday.'<< endl;
  • cout << "They\'re planning a party for their friend\'s birthday." << endl;
  1. 如果执行下面C++代码后,输出的结果是 “gesp ccf org cn ” ,则横线上应填入哪个代码?

    #include <iostream>
    using namespace std;
    int main() {
      string str = "gesp.ccf.org.cn";
      string delimiter = ".";
      string result="";
      string token;
      size_t found = str.find(delimiter);
      while (found != string::npos) {
        token = str.substr(0, found);
        result += token;
        result += " ";
        __________________________ // 在此处填入代码
        found = str.find(delimiter);
      }
      //最后一部分
      result += str;
      result += " ";
        cout << result << endl;
      return 0;
    }
    

{{ select(15) }}

  • str = str.substr(found + delimiter.length(), str.length() - 1);
  • str = str.substr(found, str.length() );
  • str = str.substr(found, str.length() -1);
  • 以上都不对

二.判断题(每题2分,共20分)

  1. GESP测试是对认证者的编程能力进行等级认证,同一级别的能力基本上与编程语言无关。
{{ select(16) }}
  • 正确
  • 错误
  1. 整数 6-61616 位补码可用十六进制表示为 FFFA
{{ select(17) }}
  • 正确
  • 错误
  1. 补码的优点是可以将减法运算转化为加法运算,从而简化计算机的硬件设计。

    {{ select(18) }}

  • 正确
  • 错误
  1. 字符常量'\0'常用来表示字符串结束,和字符常量'0'相同。

{{ select(19) }}

  • 正确
  • 错误
  1. 数组的所有元素在内存中可以不连续存放。

    {{ select(20) }}

  • 正确

  • 错误

  1. C++中可以对数组和数组的每个基础类型的元素赋值。

    {{ select(21) }}

  • 正确
  • 错误
  1. 如果 为 int 类型的变量,且表达式((a | 3) == 3)的值为 true ,则说明 在从 0033 之间(可能为00 、可能为 33
{{ select(22) }}
  • 正确
  • 错误
  1. 执行下面C++代码后,输出的结果是 88

    int a = 0b1010;
    int b = 01100;
    int c = a & b;
    cout << c <<endl;
    

    {{ select(23) }}

  • 正确
  • 错误
  1. 执行下面C++代码后,输出的结果不可能是 8978189781
```cpp
#include <iostream>
#include <cstdlib> // 为了使用 rand() 和 srand()
#include <ctime> // 为了使用 time()
using namespace std;
int main() {
  // 设置随机种子
  srand(time(NULL));
  int i = 1;
  int s[5];
  while(i <= 5)
  {
    int a = rand() % 10;
    if(a % 3 == (i + 1) % 3)
      s[i++] = a;
  }
  for(int i = 1; i <= 5; i++)
  cout << s[i];
  cout << endl;
  return 0;
}
```

{{ select(24) }}
  • 正确
  • 错误
  1. 把整数 30253025 从中剪开分为 30302525 两个数,此时再将这两数之和平方,计算结果又等于原数。(30 + 25) × (30 + 25) = 55 × 55 = 3025,这样的数叫“雷劈数”。可以使用枚举的方法求出所有符合这样条件的四位数。

    {{ select(25) }}

  • 正确

  • 错误

输入格式

本题没有标准输入。

输出格式

本题没有标准输出,请在交互式作答区域选择或填写答案。

数据范围与提示

  • 本题为客观题,包含单选题和判断题。
  • 请按页面中的 select 作答区域提交答案。
  • 题面中的图片、代码片段和选项以页面显示为准。

来源

GESP 202406 三级

输入格式

本题没有标准输入。

输出格式

本题没有标准输出,请在交互式作答区域选择或填写答案。

数据范围与提示

  • 本题为客观题,包含单选题和判断题。
  • 请按页面中的 select 作答区域提交答案。
  • 题面中的图片、代码片段和选项以页面显示为准。

来源

GESP 202406 三级