#CCF4380. [GESP202506三级] 客观题

[GESP202506三级] 客观题

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

第 1 题 88 位二进制原码能表示的最小整数是: ( )

{{ select(1) }}

  • 127-127
  • 128-128
  • 255-255
  • 256-256

第 2 题 反码表示中,零的表示形式有:( )

{{ select(2) }}

  • 11
  • 22
  • 88
  • 1616

第 3 题 补码 1011 1011 对应的真值是 ( ) {{ select(3) }}

  • 69-69
  • 59-59
  • 68-68
  • 58-58

第 4 题XX88 位补码为 0000 1010,则 X/2X/2 的补码是 ( )。

{{ select(4) }}

  • 0000 0101
  • 1000 0101
  • 0000 0101 或 1000 0101
  • 算术右移后结果取决于符号位

第 5 题 二进制数 1101.1011101.101 对应的十进制数是 ( )

{{ select(5) }}

  • 13.62513.625
  • 12.7512.75
  • 11.87511.875
  • 14.514.5

第 6 题 补码加法中,若最高位和次高位进位不同,则说明( )

{{ select(6) }}

  • 结果正确
  • 发生上溢
  • 发生下溢
  • 结果符号位错误

第 7 题 八进制数 35.6 对应的十进制数是( )

{{ select(7) }}

  • 29.7529.75
  • 28.528.5
  • 27.62527.625
  • 30.2530.25

第 8 题 二进制数 1010 | 1100 的结果是 ( )

{{ select(8) }}

  • 10001000
  • 11101110
  • 10101010
  • 11001100

第 9 题 以下哪个位运算可以交换两个变量的值 (无需临时变量) ( )

{{ select(9) }}

  • a = a ^ b; b = a ^ b; a = a ^ b;
  • a = a & b; b = a | b; a = a & b;
  • a = a | b; b = a ^ b; a = a ^ b;
  • a = ~a; b = ~b; a = ~a;

第 10 题 如何正确定义一个长度为 55 的整型数组 ( )

{{ select(10) }}

  • int array = new int[5];
  • array int[5];
  • int[] array = {1,2,3,4,5};
  • int array[5];

第 11 题 以下程序使用枚举法 (穷举法) 求解满足条件的三位数,横线处应该填入的是 ( )

01 #include <iostream>
02 using namespace std;
03
04 int main() {
05     int count = 0;
06     for (int i = 100; i <= 999; i++) {
07         int a = i / 100;
09         ————————————————————
10         int c = i % 10;
11         if (a * a + b * b == c * c) {
12             count++;
13         }
14     }
15     cout << count << endl;
16     return 0;
17 }

{{ select(11) }}

  • int b = (i / 10) / 10;
  • int b = (i / 10) % 10;
  • int b = (i % 10) / 10;
  • int b = (i % 10) % 10;

第 12 题 以下程序模拟了一个简单的小球反弹过程,横线处应该填入的是 ( )

01 #include <iostream>
02 using namespace std;
03
04 int main() {
05     int height = 10;
06     int distance = 0;
07     for (int i = 1; i <= 5; i++) { // 模拟5次落地
08         ——————————————————————
09         height /= 2;
10         distance += height;
11     }
12     cout << distance << endl;
13     return 0;
14 }

{{ select(12) }}

  • distance += height/2;
  • distance += height;
  • distance += height*2;
  • distance += height+1;

第 13 题 C++ 代码 string s = "GESP考试";ss 占据的字节数是 ( )

{{ select(13) }}

  • 1010
  • 88
  • 881010
  • 取决于计算机采用什么编码

第 14 题 C++ 语句 string s="Gesp Test"; 执行 s.rfind("e")s.rfind("e") 以后,输出的是( )

{{ select(14) }}

  • 11
  • 22
  • 66
  • 33

第 15 题 字符串 "Gesp 考试",字符数是 ( )

{{ select(15) }}

  • 1010
  • 88
  • 66
  • 字符数多少取决于编码

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

第 1 题 C++string== 运算符比较的是字符串的内存地址,而非内容。

{{ select(16) }}

  • 正确
  • 错误

第 2 题 stringsubstr(1, 3) 返回从下标 11 开始的 33 个字符的子串。

{{ select(17) }}

  • 正确
  • 错误

第 3 题 xx 是浮点数, (x >> 1) 等价于 x / 2

{{ select(18) }}

  • 正确
  • 错误

第 4 题 string("hello") == "hello" 的比较结果为 truetrue

{{ select(19) }}

  • 正确
  • 错误

第 5 题 sort 可以直接用于排序 set 中的元素。

{{ select(20) }}

  • 正确
  • 错误

第 6 题 (x & 1) == 0 可以判断整数 xx 是否为偶数。

{{ select(21) }}

  • 正确
  • 错误

第 7 题 stringsubstr(2,10)substr(2, 10) 在字符串长度不足时会抛出异常。

{{ select(22) }}

  • 正确
  • 错误

第 8 题 在数学纸面计算中, pow(2, 3) 的计算结果一定是 88,但是在 C++ 中,如果遇到数据类型是浮点数,那就不一定正确。

{{ select(23) }}

  • 正确
  • 错误

第 9 题C++ 中,枚举的底层类型可以是非整型 (如 floatdouble)。

{{ select(24) }}

  • 正确
  • 错误

第 10 题 函数声明 double f(); 返回 int 时,会自动转换为 double

{{ select(25) }}

  • 正确
  • 错误