#G035. GESP level2 2023年9月二级试题

GESP level2 2023年9月二级试题

GESP level2 - 2023年9月二级试题

  1. 我国第一台大型通用电子计算机使用的逻辑部件是()。 {{ select(1) }}
  • 集成电路
  • 大规模集成电路
  • 晶体管
  • 电子管
  1. 下列流程图的输出结果是()? {{ select(2) }}
  • 5 12
  • 12 5
  • 5 5
  • 12 12
  1. 如果要找出整数a、b中较大的一个,通常要用下面哪种程序结构?()。 {{ select(3) }}
  • 顺序结构
  • 循环结构
  • 分支结构
  • 跳转结构
  1. 以下不是C++关键字的是()。 {{ select(4) }}
  • continue
  • cout
  • break
  • goto
  1. C++表达式int(-123.123 / 10) 的值是()。 {{ select(5) }}
  • -124
  • -123
  • -13
  • -12
  1. 以下C++代码实现从大到小的顺序输出N的所有因子。例如,输入N=18时输出18 9 6 3 2 1,横线处应填入()。
    int N=0;
    cin>> N;
    for (______)
    cout <<i<<' ';
    {{ select(6) }}
  • ; ;
  • int i = 1; i < N; i++
  • int i = N; i > 0; i--
  • int i = N; i > 1; i--
  1. 如下图所示,输出N行N列的矩阵,对角线为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++代码用于判断N是否为质数(素数),约定输入N为大于等于2的正整数,请在横线处填入合适的代码()。
    int N=0,i=0;
    cout<<"请输入一个大于等于2的正整数";
    cin>>N;
    for (i=2; i<N; i++)
    if(N%i0){
    cout<<"非质数";
    ______;
    }
    if(iN)
    cout<<"是质数";
    {{ select(8) }}
  • break
  • continue
  • exit
  • return
  1. 下面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++代码执行后的输出是()。
    int cnt=0;
    for (int i=1;i<9;i++)
    for(int j=1;j<i;j+=2)
    cnt +=1;
    cout<<cnt;
    {{ select(10) }}
  • 16
  • 28
  • 35
  • 36
  1. 下面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) }}
  • 1
  • 3
  • 15
  • 没有输出
  1. 下面C++代码执行后的输出是()。
    int x=1;
    while(x<100){
    if(!(x%3))
    cout<<x<<,;
    else if(x/10)
    break;
    x+=2;
    }
    cout<<x;
    {{ select(12) }}
  • 1
  • 3,9,11
  • 3,6,9,10
  • 1,5,7,11,13,15
  1. 下面图形每一行从字母A开始,以ABC方式重复。行数为输入的整数。请在C++代码段横线处填入合适代码()。
    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. 输入行数,约定1≤lineCount ≤9,输出以下图形。应在C++代码横线处填入()。
    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++代码横线处应填入是()。
    double totalScore=0;//总分
    int studCount=0;//总人数
    double score;
    while(______){// 此处填写代码
    cin>>score;
    if(score<0)
    break;
    totalScore += score;
    studCount +=1;
    }
    cout<<"平均分="<<totalScore/studCount;
    {{ select(15) }}
  • true
  • false
  • True
  • False
  1. 我们常说的互联网(Internet)是一个覆盖全球的广域网络,它不属于任何一个国家。 {{ select(16) }}
  • 正确
  • 错误
  1. 神威·太湖之光超级计算机是中国自主研制的超级计算机,在全球超级计算机TOP500排行榜中多次荣膺榜首。 {{ select(17) }}
  • 正确
  • 错误
  1. C++表达式7.8 / 2 的值为3.9,类型为float。 {{ select(18) }}
  • 正确
  • 错误
  1. C++表达式(2 * 3) || (2 + 5) 的值为67。 {{ select(19) }}
  • 正确
  • 错误
  1. 如果m和n为int类型变量,则执行for(m=0, n=1; n<9; n=((m=3 * n, m+1), m - 1))之后n的值为偶数。 {{ select(20) }}
  • 正确
  • 错误
  1. 如果a为int类型的变量,则表达式(a>=5 && a<=10)与(5<=a<=10)的值总是相同的。 {{ select(21) }}
  • 正确
  • 错误
  1. 下面C++代码执行后的输出为10。
    int cnt=0;
    for(int i=1;i<10;i++){
    cnt +=1;
    i+=1;
    }
    cout<<cnt;
    {{ select(22) }}
  • 正确
  • 错误
  1. 执行以下C++代码后的输出为0。
    int rst=0;
    for(int i=-100;i<100;i+=2)
    rst +=i;
    cout<<rst;
    {{ select(23) }}
  • 正确
  • 错误
  1. 执行以下C++代码后的输出为30。
    int rst=0;
    for(int i=0;i<10;i+=2)
    rst +=i;
    cout<<rst;
    {{ select(24) }}
  • 正确
  • 错误
  1. C++是一种高级程序设计语言。 {{ select(25) }}
  • 正确
  • 错误