#G1045. 客观题

客观题

一、单选题(每题 2 分,共 30 分)

  1. 我国第一台大型通用电子计算机使用的逻辑部件是( )。

{{ select(1) }}

  • 集成电路
  • 大规模集成电路
  • 晶体管
  • 电子管
  1. 下列流程图的输出结果是( )。

{{ select(2) }}

  • 5  125\ \ 12
  • 12  512\ \ 5
  • 5  55\ \ 5
  • 12  1212\ \ 12
  1. 如果要找出整数 aabb 中较大一个,通常要用下面哪种程序结构?( )

{{ select(3) }}

  • 顺序结构
  • 循环结构
  • 分支结构
  • 跳转结构
  1. 以下不是 C\tt C++ 关键字的是( )。

{{ select(4) }}

  • continue
  • cout
  • break
  • goto
  1. C\tt C++ 表达式 int(-123.123 / 10) 的值是( )。

{{ select(5) }}

  • 124-124
  • 123-123
  • 13-13
  • 12-12
  1. 以下 C\tt C++ 代码实现从大到小的顺序输出 NN 的所有因子。例如,输入 N=18N = 18 时输出 18  9  6  3  2  118\ \ 9\ \ 6\ \ 3\ \ 2\ \ 1,横线处应填入( )。

    int N = 0;
    
    cin >> N;
    
    for (__________) // 此处填写代码
    	if (!(N % i))
    		cout << i << ' ';
    

{{ select(6) }}

  • ; ;
  • int i = 1; i < N; i++
  • int i = N; i > 0; i--
  • int i = N; i > 1; i--
  1. 如下图所示,输出 NNNN 列的矩阵,对角线为 11,横线处应填入( )。

    请输入行列数量:9
    1 0 0 0 0 0 0 0 0
    0 1 0 0 0 0 0 0 0
    0 0 1 0 0 0 0 0 0
    0 0 0 1 0 0 0 0 0
    0 0 0 0 1 0 0 0 0
    0 0 0 0 0 1 0 0 0
    0 0 0 0 0 0 1 0 0
    0 0 0 0 0 0 0 1 0
    0 0 0 0 0 0 0 0 1
    
    
    int N = 0;
    
    cout << "请输入行列数量:";
    cin >> N;
    
    for (int i = 1; i < N + 1; i++) {
    	for (int j = 1; j < N + 1; j++)
    		if (__________) // 此处填写代码
    			cout << 1 << " ";
    		else
    			cout << 0 << " ";
    
    	cout << endl;
    }
    

{{ select(7) }}

  • i = j
  • j != j
  • i >= j
  • i == j
  1. 下面 C\tt C++ 代码用于判断 NN 是否为质数(素数),约定输入 NN 为大于等于 22 的正整数,请在横线处填入合适的代码( )。

    int N = 0, i = 0;
    
    cout << "请输入一个大于等于 2 的正整数:";
    cin >> N;
    
    for (i = 2; i < N; i++)
    	if (N % i == 0) {
    		cout << "非质数";
    		_______________; // 此处填写代码
    	}
    
    if (i == N)
    	cout << "是质数";
    

{{ select(8) }}

  • break
  • continue
  • exit
  • return
  1. 下面 C\tt C++ 代码执行后的输出是( )。

    int N = 9;
    
    for (int i = 2; i < N; i++)
    	if (N % i)
    		cout << "1#";
    
    cout << "0" << endl;
    

{{ select(9) }}

  • 1#0
  • 1#
  • 1#1#1#1#1#1
  • 1#1#1#1#1#1#0
  1. 下面 C\tt C++ 代码执行后的输出是( )。

    int cnt = 0;
    
    for (int i = 1; i < 9; i++)
    	for (int j = 1; j < i; j += 2)
    		cnt += 1;
    
    cout << cnt;
    

{{ select(10) }}

  • 1616
  • 2828
  • 3535
  • 3636
  1. 下面 C\tt C++ 代码执行后的输出是( )。

    int cnt = 0;
    
    for (int i = 1; i < 13; i += 3)
    	for (int j = 1; j < i; j += 2)
    		if (i * j % 2 == 0)
    			break;
    		else
    			cnt += 1;
    
    cout << cnt;
    

{{ select(11) }}

  • 11
  • 33
  • 1515
  • 没有输出
  1. 下面 C\tt C++ 代码执行后的输出是( )。

    int x = 1;
    
    while (x < 100) {
    	if (!(x % 3))
    		cout << x << ",";
    	else if (x / 10)
    		break;
    	
    	x += 2;
    }
    
    cout << x;
    

{{ select(12) }}

  • 11
  • 3,9,113,9,11
  • 3,6,9,103,6,9,10
  • 1,5,7,11,13,151,5,7,11,13,15
  1. 下面图形每一行从字母 A\tt A 开始,以 ABC\tt ABC 方式重复。行数为输入的整数。请在 C\tt C++ 代码段横线处填入合适代码( )。

    请输入字母行数:7
    A 
    AB 
    ABC 
    ABCA
    ABCAB
    ABCABC
    ABCABCA
    
    int N = 0;
    
    cout << "请输入行列数量:";
    cin >> N;
    
    for (int i = 1; i < N + 1; i++) {
    	for (int j = 0; j < i; j++)
    		cout << __________; // 此处填写代码
    	cout << endl;
    }
    

{{ select(13) }}

  • 'A' + j / 3
  • (char)('A' + j / 3)
  • 'A' + j % 3
  • (char)('A' + j % 3)
  1. 输入行数,约定 1lineCount91 \le lineCount \le 9,输出以下图形。应在 C\tt C++ 代码横线处填入( )。

    输入行数量:9
                    1
    			  1 2 1
    			1 2 3 2 1
    		  1 2 3 4 3 2 1
    	    1 2 3 4 5 4 3 2 1
          1 2 3 4 5 6 5 4 3 2 1
    	1 2 3 4 5 6 7 6 5 4 3 2 1
      1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
    1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
    
    int lineCount = 0;
    
    cout << "请输入行数量:";
    cin >> lineCount;
    
    for (int i = 0; i < lineCount; i++) {
    	for (int j = 0; j < __________; j++) // 此处填写代码
    		cout << ' ';
    	for (int j = 1; j < i + 1; j++)
    		cout << j << " ";
    	for (int j = i + 1; j > 0; j--)
    		cout << j << " ";
    	
    	cout << endl;
    }
    

{{ select(14) }}

  • (lineCount - i - 1) * 2
  • (lineCount - i) * 2
  • lineCount - i - 1
  • lineCount - i
  1. 某班级人数不知,连续输入成绩直到输入负数停止,输入结束后求出平均成绩。在以下 C\tt C++ 代码横线处应 填入是( )。

    double totalScore = 0; // 总分
    int studCount = 0;     // 总人数
    
    while (__________) {   // 此处填写代码
    	cin >> score;
    
    	if (score < 0)
    		break;
    	
    	totalScore += score;
    	studCount += 1;
    }
    
    cout << "平均分=" << totalScore / studCount;
    

{{ select(15) }}

  • true
  • false
  • True
  • False

二、判断题(每题 2 分,共 20 分)

  1. 我们常说的互联网(Internet\tt Internet)是一个覆盖全球的广域网络,它不属于任何一个国家。( )

{{ select(16) }}

  • 正确
  • 错误
  1. 神威·太湖之光超级计算机是中国自主研制的超级计算机,在全球超级计算机 TOP500\tt TOP500 排行榜中多次荣膺榜首。( )

{{ select(17) }}

  • 正确
  • 错误
  1. C\tt C++ 表达式 7.8 / 2 的值为 3.93.9,类型为 float。( )

{{ select(18) }}

  • 正确
  • 错误
  1. C\tt C++ 表达式 (2 * 3) || (2 + 5) 的值为 6767。( )

{{ select(19) }}

  • 正确
  • 错误
  1. 如果 mmnnint 类型变量,则执行 for (m = 0, n = 1; n < 9; ) n = ((m = 3 * n, m + 1), m - 1); 之后 nn 的值为偶数。( )

{{ select(20) }}

  • 正确
  • 错误
  1. 如果 aaint 类型的变量,则表达式 (a >= 5 && a <= 10)(5 <= a <= 10) 的值总是相同的。( )

{{ select(21) }}

  • 正确
  • 错误
  1. 下面 C\tt C++ 代码执行后的输出为 1010。( )

    int cnt = 0;
    
    for (int i = 1; i < 10; i++) {
    	cnt += 1;
    	i += 1;
    }
    
    cout << cnt;
    

{{ select(22) }}

  • 正确
  • 错误
  1. 执行以下 C\tt C++ 代码后的输出为 00。( )

    int rst = 0;
    
    for (int i = -100; i < 100; i += 2)
    	rst += i;
    
    cout << rst;
    

{{ select(23) }}

  • 正确
  • 错误
  1. 执行以下 C\tt C++ 代码后的输出为 3030。( )

    int rst = 0;
    
    for (int i = 0; i < 10; i += 2)
    	rst += i;
    
    cout << rst;
    

{{ select(24) }}

  • 正确
  • 错误
  1. C\tt C++ 是一种高级程序设计语言。( )

{{ select(25) }}

  • 正确
  • 错误