#G12503. 2025年3月 C++ 1级真题
2025年3月 C++ 1级真题
1. 单选题 (共 15 题)
- 2025年春节有两件轰动全球的事件,一个是DeepSeek横空出世,另一个是贺岁片《哪吒2》票房惊人,入了全球票房榜。下面关于DeepSeek与《哪吒2》的描述成立的是()。 {{ select(1) }}
- 《哪吒2》是一款新型操作系统
- DeepSeek是深海钻探软件
- 《哪吒2》可以生成新的软件
- DeepSeek可以根据《哪吒2》的场景生成剧情脚本
- 在某集成开发环境中编辑一个源代码文件时不可以执行下面()操作。 {{ select(2) }}
- 修改变量定义
- 保存代码修改
- 撤销代码修改
- 插入执行截图
- 在C++中,下列可以做变量的是()。 {{ select(3) }}
- Var-1
- $1
- %%1
- Var 1
- 以下哪个是C++语言的关键字?() {{ select(4) }}
- abs
- cin
- do
- endl
- 下面的框架在L1和L2标记的两行处分别填写选项中的代码,哪组不能通过编译()。
int main() {
int i = 0;
// L1
break;
// L2
return 0;
}
{{ select(5) }}
- L1:
do {L2:} while (i != 0); - L1:
for (; i < 10; i++) {L2:} - L1:
if (i == 0) {L2:} - L1:
switch (i) {L2:}
- 下面C++语句()执行后的输出是_0322$$ {{ select(6) }}
- printf(" %2d%02d$$", 3, 22)
- printf(" %02d%2d$$", 3, 22)
- printf(" %02d%02d$$", 3, 22)
- printf(" %02d%02d$$", 3, 22)
- 有关下列C++代码的说法,错误的是()。
printf("我爱码代码!");
{{ select(7) }}
- 配对双引号内的汉字改为英文Hello,C++代码能正确执行
- 配对双引号内的汉字改为Hello代码!,C++代码能正确执行
- 代码中的每个双引号,都可以改为两个单引号
- 代码中的每个双引号,都可以改为三个双引号
- C++表达式16/4%2的值是()。 {{ select(8) }}
- 8
- 4
- 2
- 0
- N是C++的正整数,值为12,则cout << (N % 3 + N / 5)的输出是()。 {{ select(9) }}
- 6.4
- 2.4
- 6
- 2
- 下面C++代码执行后的输出是()。
int N = 10;
printf("{N}*{N}={%d*%d}", N, N, N*N);
{{ select(10) }}
- 执行下面的C++代码,在键盘上先后输入100和200,输出是( )。
#include <iostream>
using namespace std;
int main() {
int first, second;
cout << "请输入第1个正整数:";
cin >> first;
cout << "请输入第2个正整数:";
cin >> second;
cout << (first / second * second) << endl;
return 0;
}
{{ select(11) }}
- 200
- 100
- 1
- 0
- 下面C++代码执行后,将输出能被2整除且除以7余数为2的数。下列选项不能实现的是( )。
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 100; i++)
if ( /* Condition */ )
cout << i << " ";
return 0;
}
{{ select(12) }}
- ((i % 2 == 0) && (i % 7 == 2))
- ((!(i % 2)) && (i % 7 == 2))
- ((!(i % 2)) && (!(i % 7 - 2)))
- ((i % 2 != 1) && (i % 7 == 2))
- 下面C++代码执行后输出是( )。
#include <iostream>
using namespace std;
int main() {
int tnt = 0;
for (int i = -1000; i < 1000; i++)
tnt += i;
cout << tnt << endl;
return 0;
}
{{ select(13) }}
- -1000
- 0
- 999
- 1000
- 下面C++代码执行后输出的是( )。
#include <iostream>
using namespace std;
int main() {
int i;
for (i = 1; i < 100; i += 5)
continue;
cout << i << endl;
return 0;
}
{{ select(14) }}
- 101
- 100
- 99
- 96
- 下面C++代码执行后输出的是( )。
#include <iostream>
using namespace std;
int main() {
int tnt = 0;
for (int i = 5; i < 100; i += 5) {
if (i % 2 == 0)
continue;
tnt += 1;
if (i % 3 == 0 && i % 7 == 0)
break;
}
cout << tnt << endl;
return 0;
}
{{ select(15) }}
- 500
- 450
- 10
- 1
2. 判断题 (共 10 题)
(注意:判断题也使用 select 格式,选项为 True/False 或 对/错)
- C++、Python都是高级编程语言,它们的每条语句最终都要通过机器指令来完成。() {{ select(16) }}
- True
- False
- 在C++中表达式N*2%N中如果N的值为正整数,则其值为2。( ) {{ select(17) }}
- True
- False
- 执行如下C++代码如果在键盘上输入10,执行后将输出20。( )
#include <iostream>
#include <cstdio> // For printf used in the image
using namespace std;
int main() {
char N;
printf("请输入正整数:");
cin >> N;
printf("%d\\n", N*2);
return 0;
}
{{ select(18) }}
- True
- False
- 删除下面C++代码中的continue不影响程序的执行效果。()
#include <cstdio> // For printf used in the image
int main() {
for (int i = 0; i < 100; i++) {
if (i % 2 == 0) {
printf("偶数");
continue;
} else
printf("奇数");
}
return 0;
}
{{ select(19) }}
- True
- False
- 下面C++代码执行时将报错,因为_所在位置应该是变量名,而不可以做变量名。()
#include <iostream>
using namespace std;
int main() {
for (int _ = 0; _ < 100; _++)
cout << "*" << endl;
return 0;
}
{{ select(20) }}
- True
- False
- 下面C++代码被执行后,将先后输出3和5。()
#include <cstdio> // For printf used in the image
int main() {
for (int i = 3; i < 5; i += 2)
printf("%d", i);
return 0;
}
{{ select(21) }}
- True
- False
- 下面的C++代码执行后将先后输出7个true。( )
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 10; i++)
cout << boolalpha << (i * 2 < i * i) << " ";
return 0;
}
{{ select(22) }}
- True
- False
- 在C++代码中,user_Name_userName userName_都是合法的变量名。() {{ select(23) }}
- True
- False
- C++语言中 continue 语句可以来提前结束循环。() {{ select(24) }}
- True
- False
- C++中定义整型变量N,执行语句scanf("%d", &N); cout << N / 3*5;时输入3.6.则输出是6。( )
#include <iostream>
#include <cstdio> // For scanf used in the image
using namespace std;
int main() {
int N;
// Simulating input 3.6 for scanf("%d", &N) which reads 3
N = 3;
cout << N / 3 * 5;
return 0;
}
{{ select(25) }}
- True
- False