#GESP20250603. GESP2025年6月3级

GESP2025年6月3级

选择题整理结果

1. 8位二进制原码能表示的最小整数是:()

{{ select(1) }}

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

2. 反码表示中,零的表示形式有:

{{ select(2) }}

  • 1种
  • 2种
  • 8种
  • 16种

3. 补码10111011对应的真值是()

{{ select(3) }}

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

4. 若X的8位补码为00001010,则X/2的补码是()。

{{ select(4) }}

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

5. 二进制数1101.101对应的十进制数是()

{{ select(5) }}

  • 13.625
  • 12.75
  • 11.875
  • 14.5

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

{{ select(6) }}

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

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

{{ select(7) }}

  • 29.75
  • 28.5
  • 27.625
  • 30.25

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

{{ select(8) }}

  • 1000
  • 1110
  • 1010
  • 1100

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. 如何正确定义一个长度为5的整型数组()

{{ select(10) }}

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

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

{{ select(11) }}

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

12. C++代码 string s="GESP考试";, s占据的字节数是()

{{ select(12) }}

  • 10
  • 8
  • 8或10
  • 取决于计算机采用什么编码

13. 字符串"Gesp考试",字符数是()

{{ select(13) }}

  • 10
  • 8
  • 6
  • 字符数多少取决于编码

判断题整理结果

14. C++中string的==运算符比较的是字符串的内存地址,而非内容

{{ select(14) }}

  • ×

15. string的 substr(1,3)返回从下标1开始的3个字符的子串。

{{ select(15) }}

  • ×

16. x是浮点数,(x>>1)等价于x/2

{{ select(16) }}

  • ×

17. string("hello")=="hello"的比较结果为true。

{{ select(17) }}

  • ×

18. sort可以直接用于排序set中的元素。

{{ select(18) }}

  • ×

19. (x&1)==0可以判断整数x是否为偶数。

{{ select(19) }}

  • ×

20. string的 substr(2,10)在字符串长度不足时会抛出异常。

{{ select(20) }}

  • ×

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

{{ select(21) }}

  • ×

22. 在C++中,枚举的底层类型可以是非整型(如float或double)。

{{ select(22) }}

  • ×

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

{{ select(23) }}

  • ×