智汇少年编程邀请赛(模拟二)小高
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
一、单选题(共20题)
1.
执行以下代码,输出结果是( )
#include <iostream>
using namespace std;
int main() {
int a = 5;
cout << a++ + ++a;
}
{{ select(1) }}
- 10
- 11
- 12
- 13
2.
下面程序输出结果为( )
#include <iostream>
using namespace std;
int main() {
int x = 17;
cout << x % 5;
}
{{ select(2) }}
- 2
- 3
- 4
- 5
3.
下面代码运行后输出( )
#include <iostream>
using namespace std;
int main() {
int s = 0;
for(int i=1;i<=5;i++)
s += i;
cout << s;
}
{{ select(3) }}
- 10
- 15
- 20
- 25
4.
以下哪个循环一定至少执行一次( )
{{ select(4) }}
- for
- while
- do...while
- if
5.
下面程序输出结果是( )
#include <iostream>
using namespace std;
int main() {
int a = 3, b = 4;
if(a > 2 && b < 5)
cout << "YES";
else
cout << "NO";
}
{{ select(5) }}
- YES
- NO
- 3
- 4
6.
数组 int a[10]; 的下标范围是( )
{{ select(6) }}
- 1~10
- 0~9
- 0~10
- 1~9
7.
下面程序输出( )
#include <iostream>
using namespace std;
int main() {
int x = 1;
while(x < 10)
x *= 2;
cout << x;
}
{{ select(7) }}
- 8
- 10
- 16
- 32
8.
以下哪个不是关系运算符( )
{{ select(8) }}
- (>)
- (<)
- (&&)
- (==)
9.
执行代码后,输出结果是( )
#include <iostream>
using namespace std;
int main() {
int a = 8;
if(a % 2 == 0)
cout << a / 2;
else
cout << a * 2;
}
{{ select(9) }}
- 2
- 4
- 8
- 16
10.
下面程序输出( )
#include <iostream>
using namespace std;
int main() {
int a = 1;
for(int i=1;i<=4;i++)
a *= 2;
cout << a;
}
{{ select(10) }}
- 4
- 8
- 16
- 32
11.
下列哪个可以正确交换两个变量( )
{{ select(11) }}
- a = b; b = a;
- t = a; a = b; b = t;
- a = a + b;
- a = b + a;
12.
下面程序输出( )
#include <iostream>
using namespace std;
int main() {
int n = 123;
cout << n / 10;
}
{{ select(12) }}
- 1
- 12
- 23
- 123
13.
下面程序输出( )
#include <iostream>
using namespace std;
int main() {
int n = 123;
cout << n % 10;
}
{{ select(13) }}
- 1
- 2
- 3
- 12
14.
以下哪个语句用于跳过本次循环( )
{{ select(14) }}
- break
- stop
- continue
- exit
15.
执行程序后输出( )
#include <iostream>
using namespace std;
int main() {
int s = 0;
for(int i=2;i<=6;i+=2)
s += i;
cout << s;
}
{{ select(15) }}
- 6
- 10
- 12
- 14
16.
下面代码输出( )
#include <iostream>
using namespace std;
int main() {
int a = 5;
if(a == 5)
cout << "A";
if(a > 3)
cout << "B";
}
{{ select(16) }}
- A
- B
- AB
- BA
17.
以下哪个是二维数组定义( )
{{ select(17) }}
- int a[5];
- int a(5);
- int a[3][4];
- int[3][4] a;
18.
程序输出结果是( )
#include <iostream>
using namespace std;
int main() {
int a = 9;
cout << (a % 2 == 1);
}
{{ select(18) }}
- 0
- 1
- 9
- true
19.
下面程序输出( )
#include <iostream>
using namespace std;
int main() {
int s = 1;
for(int i=1;i<=3;i++)
s *= i;
cout << s;
}
{{ select(19) }}
- 3
- 5
- 6
- 9
20.
以下哪个复杂度最高( )
{{ select(20) }}
- 单层循环
- 双层循环
- 输出一句话
- 定义变量
二、多选题(共10题)
21.
下面哪些属于循环结构( )
{{ multiselect(21) }}
- for
- while
- do...while
- if
22.
下面哪些是合法的数据类型( )
{{ multiselect(22) }}
- int
- double
- char
- bool
23.
关于 break,下列正确的是( )
{{ multiselect(23) }}
- 可以结束循环
- 可以结束 switch
- 可以跳过本次循环
- break 后面的代码本轮不会执行
24.
关于 continue,下列正确的是( )
{{ multiselect(24) }}
- 跳过本次循环
- 结束整个循环
- 后面的本轮代码不执行
- 常用于循环
25.
下面哪些属于逻辑运算符( )
{{ multiselect(25) }}
- &&
- ||
- !
- ==
26.
关于数组,下列正确的是( )
{{ multiselect(26) }}
- 下标从0开始
- 可以存多个数据
- 元素类型必须相同
- 可以用循环遍历
27.
下面哪些可以作为循环变量( )
{{ multiselect(27) }}
- i
- cnt
- sum
- k
28.
关于二维数组,下列正确的是( )
{{ multiselect(28) }}
- 有行和列
- 可以表示地图
- 下标从1开始
- 可以嵌套循环遍历
29.
下面哪些属于赋值运算( )
{{ multiselect(29) }}
- =
- +=
- -=
- ==
30.
下面哪些属于 C++ 输入输出语句( )
{{ multiselect(30) }}
- cin
- cout
- scanf
- printf
三、判断题(共10题)
31.
for循环可以没有初始化部分。
{{ select(31) }}
- 正确
- 错误
32.
数组越界是安全的。
{{ select(32) }}
- 正确
- 错误
33.
二维数组可以看成表格。
{{ select(33) }}
- 正确
- 错误
34.
continue 会直接结束整个循环。
{{ select(34) }}
- 正确
- 错误
35.
while 条件为真时才会继续循环。
{{ select(35) }}
- 正确
- 错误
36.
n % 2 == 0 可以判断偶数。
{{ select(36) }}
- 正确
- 错误
37.
C++ 中变量必须先定义再使用。
{{ select(37) }}
- 正确
- 错误
38.
双层循环时间复杂度通常高于单层循环。
{{ select(38) }}
- 正确
- 错误
39.
数组中的元素可以是不同类型。
{{ select(39) }}
- 正确
- 错误
40.
break 可以用于 switch 中。
{{ select(40) }}
- 正确
- 错误
粤公网安备44195502000195号