GESP C++ 3级 2024.06
小杨父母带他到某培训机构给他报名参加CCF组织的GESP认证考试的第1级,那他可以选择的认证语言有()种。
1
2
3
4
下面流程图在 yr 输入 时,可以判定 yr 代表闰年,并输出 月是 天 ,则图中菱形框中应该填入( )。

(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)
一般默认64位计算机系统中整型变量(int)还是 位,则整数能够表示的数据范围是( )。
~
~
~
~
下列代码将十进制转化成八进制,则横线上应填入( )。
#include
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;
}
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;
二进制数 对应的十进制数是( )。
6.5
5.5
5.75
5.25
下列流程图的输出结果是( ) 。

5
10
20
30
下列代码的输出结果是( )。
#include
using namespace std;
int main() {
int a = 12;
int result = a >> 2;
cout << result << endl;
return 0;
}
12
6
3
1
下列代码的输出结果是( )。
#include
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;
}
a = 5, b = 10
a = 5, b = 5
a = 10, b = 5
a = 10, b = 10
如果字符串定义为 char str[] = "GESP"; ,则字符数组 的长度为( )。
0
4
5
6
在下列代码的横线处填写( ),可以使得输出是 。
#include
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;
}
max > array[i]
max < array[i]
max = array[i]
以上均不对
