算法创意实践挑战赛小学组2025初赛真题2
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
- 在
C++中,表示逻辑运算符"或"的是?( ) {{ select(1) }}
- ||
- &
- ==
- @
- 执行下列代码,输入
3,输出结果为?( )
#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << n-3;
return 0;
}
{{ select(2) }}
- -n
- 0
- 9
- 81
- 下列选项中,输出结果为
0的是?( ) {{ select(3) }}
- cout << "5 - 5";
- cout << 5 - 5;
- cout << 2 * 3;
- cout << 7 / 2;
- 执行下列代码段,输出结果为?( )
cout << 10 % 3;
{{ select(4) }}
- 1
- 2
- 5
- 10
- 下列不属于
C++基本程序框架的是?( ) {{ select(5) }}
- 头文件
- 命名空间
- 主函数
- 程序开发时间:2025-03-23
- 阅读以下程序,输入
1 5,输出的结果是?( )
int a,b;
cin >> a >> b;
a += b;
b *= a;
cout << a << " " << b << endl;
{{ select(6) }}
- 1 5
- 6 5
- 5 6
- 6 30
- 在
C++程序中,可以得到一个四位整数的十位上的数字的表达式是?( ) {{ select(7) }}
- number / 1000
- number / 100 % 10
- number / 10 % 10
- number % 10
- 以下程序的功能是对一个正整数
n进行数位分离,并按逆序打印每一位,①处应该填写?( )
#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
while(_①_) {
int d = n%10;
n /= 10;
cout << d << " ";
}
return 0;
}
{{ select(8) }}
- n > 0
- n >= 0
- n < 0
- n <= 0
- 下面程序输出的结果是"1 4 7 10",补全①处的代码。下列选项中哪一项正确?( )
#include<iostream>
using namespace std;
int main(){
for(int i = 1; i <= 10; _①_){
cout << i << " ";
}
return 0;
}
{{ select(9) }}
- i++
- i *= 2
- i += 3
- i * 2
- 执行下列代码,输出结果为?( )
for (int i = 1; i <= 5; i++) {
if (i % 2 == 0) {
continue;
}
cout << i << " ";
}
{{ select(10) }}
- 1
- 2 4
- 1 3 5
- 1 2 3 4
- 下图为
n = 5时输出的图案,输入一个正整数n,输出一个n+1行特殊的直角三角形,则①处应补充的代码为?( )
*
**
****
******
********
**********
int n;
cin >> n;
cout << "*" << endl;
for (int i = 1; i <= n; i++) {
for (int j = 1; _①_; j++) {
cout << "*";
}
cout << endl;
}
{{ select(11) }}
- j <= 2 * i
- j <= i
- j <= 2 * i - 1
- j <= 2 * i + 1
- 以下程序段输出的结果为?( )
int cnt = 0;
for(int i = 0; i < 5; i ++ ){
for(int j = 0; j < 4; j ++ ){
for(int k = 0; k < 2; k ++ ){
cnt++;
}
}
}
cout << cnt << endl;
{{ select(12) }}
- 40
- 60
- 90
- 120
- 阅读以下代码,输出的内容是?( )
#include <iostream>
using namespace std;
int main(){
for(int i = 1; i <= 4; i++){
for(int j = 5;j >= 1;j--) {
cout << j << " ";
}
cout << endl;
}
return 0;
}
{{ select(13) }}
-
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 -
5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 -
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 -
5 4 3 2 1 5 4 3 2 1 5 4 3 2 1
- 执行以下程序,输入
5,输出的结果是?( )
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++){
ans = ans + i*i;
}
cout << ans;
return 0;
}
{{ select(14) }}
- 5
- 30
- 55
- 85
- 运行以下程序,输入
6,输出的结果是?( )
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
if (n % 2 == 0){
cout << "QWER";
}else if (n % 3 == 0){
cout << "WERQ";
}else if (n % 5 == 0){
cout << "ERQW";
}else{
cout << "RQWE";
}
return 0;
}
{{ select(15) }}
- QWER
- WERQ
- ERQW
- RQWE
- 在
C++中,&&表示逻辑运算符“或” {{ select(16) }}
- 正确
- 错误
- 在
C++中 可以通过这种方式定义数组并初始化int c[3]={1,2,3,4,5}{{ select(17) }}
- 正确
- 错误
- 在C++语言中一维数组的下标是从
0开始的。 {{ select(18) }}
- 正确
- 错误
- 代码段
int i=5;
while(i>0){
i-=2;
}
最终的值是-1. {{ select(19) }}
- 正确
- 错误
- 定义
int arr[5];后,执行arr[5]=5不会导致数组越界。 {{ select(20) }}
- 正确
- 错误