模拟试题客观题模拟3
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
信阳市中小学人工智能教育创意大赛模拟试题(C++)
题目描述
本试卷共20道单项选择题,考察基本语法、逻辑结构和简单算法。
第1题
在C++中,下列哪个关键字用于定义一个整型变量?
{{ select(1) }}
floatdoubleintstring
第2题
以下哪个是合法的C++变量名?
{{ select(2) }}
2varmy-var_countfloat
第3题
在C++中,用于输出到控制台的关键字是?
{{ select(3) }}
printcoutprintfoutput
第4题
下列哪个运算符用于求余数?
{{ select(4) }}
+-*%
第5题
在C++中,bool类型的值可以是?
{{ select(5) }}
- 0和1
- true和false
- 1和2
- yes和no
第6题
以下哪个头文件用于输入输出操作?
{{ select(6) }}
<cmath><string><iostream><algorithm>
第7题
在C++中,注释单行使用的符号是?
{{ select(7) }}
///*#--
第8题
下列哪个语句可以正确声明一个整数数组?
{{ select(8) }}
int array[10];array int[10];int[10] array;array[10] int;
第9题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int a = 5, b = 2;
cout << a / b;
return 0;
}
{{ select(9) }}
- 2
- 2.5
- 3
- 编译错误
第10题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int x = 10;
if (x > 5) {
cout << "A";
} else {
cout << "B";
}
return 0;
}
{{ select(10) }}
- A
- B
- AB
- 编译错误
第11题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 3; i++) {
cout << i;
}
return 0;
}
{{ select(11) }}
- 012
- 123
- 013
- 编译错误
第12题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int i = 1;
while (i <= 3) {
cout << i;
i++;
}
return 0;
}
{{ select(12) }}
- 123
- 012
- 013
- 无限循环
第13题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int arr[3] = {1, 2, 3};
cout << arr[1];
return 0;
}
{{ select(13) }}
- 1
- 2
- 3
- 0
第14题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int a = 5;
int b = a++;
cout << a << b;
return 0;
}
{{ select(14) }}
- 55
- 56
- 65
- 66
第15题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int sum = 0;
for (int i = 1; i <= 3; i++) {
sum += i;
}
cout << sum;
return 0;
}
{{ select(15) }}
- 6
- 5
- 4
- 3
第16题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int x = 5;
if (x == 5) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
{{ select(16) }}
- Yes
- No
- 编译错误
- 运行错误
第17题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int a = 10, b = 3;
cout << a % b;
return 0;
}
{{ select(17) }}
- 1
- 3
- 0
- 编译错误
第18题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
bool flag = true;
cout << !flag;
return 0;
}
{{ select(18) }}
- 1
- 0
- true
- false
第19题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int x = 5;
cout << (x > 3 ? "Big" : "Small");
return 0;
}
{{ select(19) }}
- Big
- Small
- 5
- 编译错误
第20题
以下代码的输出结果是什么?
#include <iostream>
using namespace std;
int main() {
int i = 0;
do {
cout << i;
i++;
} while (i < 2);
return 0;
}
{{ select(20) }}
- 01
- 12
- 0
- 无限循环