返回试卷目录

需要电子版时点「打印 / 保存为 PDF」,在打印对话框的「目标打印机」里选择「另存为 PDF」即可下载。登录后可下载,每天 10 次

信息素养大赛 C++ 丝路新程 · 2026 模拟卷

信息素养大赛 · C++ · 共 20 题 · 满分 100 分

姓名:____________日期:____________得分:____________

  1. 1.单选题5 分
    【丝路新程】唐代丝绸之路上,骆驼是沿途商队的重要交通工具,已知一头成年单峰骆驼的最大载重为 200公斤,运行下列代码,输入货物重量 n为 188,输出结果是什么?( )
    #include<iostream>using namespace std;int main(){    int n;    cin>> n;    if(n<= 200){        cout<<"剩余载重"<< 200- n;    } else{        cout<<"超重"<< n- 200;}    return 0;}
    • A.剩余载重 188
    • B.超重 12
    • C.剩余载重 12
    • D.超重 188
  2. 2.单选题5 分
    【驿站计数】商队途经 3个驿站,管事用循环统计驿站总数,以下代码执行后输出结果是?( )
    #include<iostream>using namespace std;int main(){    int cnt= 0;    for(int i= 0; i< 3; i++){        cnt++;}    cout<< cnt;    return 0;}
    • A.0
    • B.2
    • C.3
    • D.4
  3. 3.单选题5 分
    【物资分配】管事要将整数类型的货物重量赋值给变量,以下哪种写法正确?( )
    • A.int weight="150";
    • B.int weight= 150;
    • C.int weight= 150.5;
    • D.int weight='150';
  4. 4.单选题5 分
    【沙漠里程】商队每天行进 50公里,计算 3天的总里程,以下代码执行后输出结果是?( )
    #include<iostream>using namespace std;int main(){    int day= 3;    int km= 50;    cout<< day* km;    return 0;}
    • A.53
    • B.100
    • C.150
    • D.200
  5. 5.单选题5 分
    【驿站排序】管事要比较两个驿站的距离,以下代码执行后输出结果是?( )
    #include<iostream>using namespace std;int main(){    int a= 200, b= 400;    if(a> b){        cout<<"a更远";    } else{        cout<<"b更远";}    return 0;}
    • A.a更远
    • B.b更远
    • C.无输出
    • D.编译错误
  6. 6.单选题5 分
    【物资备份】管事要定义一个数组存储 5件物资名称,以下写法正确的是?( )
    • A.string goods[5];
    • B.string goods(5);
    • C.string goods=[5];
    • D.string goods{5};
  7. 7.单选题5 分
    【载重预警】骆驼载重超过 200公斤时输出警告,以下代码输入220后输出结果是?( )
    #include<iostream>using namespace std;int main(){    int n;    cin>> n;    if(n> 200){        cout<<"警告:超重";    } else{        cout<<"正常";}    return 0;}
    • A.警告:超重
    • B.正常
    • C.无输出
    • D.编译错误
  8. 8.单选题5 分
    【商队编号】管事要给 10头骆驼编号,以下循环执行次数是?( )
    for(int i= 1; i<= 10; i++){cout<< i;}
    • A.9
    • B.10
    • C.11
    • D.12
  9. 9.单选题5 分
    【里程计算】管事用浮点数记录每日行进里程,以下代码执行后输出结果是?( )
    #include<iostream>using namespace std;int main(){    double km= 55.5;    cout<< km;    return 0;}
    • A.55
    • B.55.5
    • C.56
    • D.55.0
  10. 10.单选题5 分
    【物资替换】管事要将数组中第 2件物资替换为「丝绸」,以下写法正确的是?( )
    string goods[]={"水囊","干粮","茶叶"};
    • A.goods[2]="丝绸";
    • B.goods[1]="丝绸";
    • C.goods[0]="丝绸";
    • D.goods[3]="丝绸";
  11. 11.单选题5 分
    【驿站距离】管事要计算两个驿站的距离差,以下代码执行后输出结果是?( )
    #include<iostream>using namespace std;int main(){    int a= 400, b= 200;    cout<< a- b;    return 0;}
    • A.200
    • B.400
    • C.600
    • D.800
  12. 12.单选题5 分
    【物资统计】管事要统计物资数量,以下代码执行后输出结果是?
    #include<iostream>using namespace std;int main(){    string goods[]={"水囊","干粮","茶叶","药品"};    cout<< sizeof(goods)/sizeof(goods[0]);    return 0;}
    • A.3
    • B.4
    • C.5
    • D.6
  13. 13.单选题5 分
    【天气判断】管事根据温度判断是否适合出行,以下代码输入 15后输出结果是?( )
    #include<iostream>using namespace std;int main(){    int temp;    cin>> temp;    if(temp> 20){        cout<<"适合出行";    } else if(temp> 10){        cout<<"尚可出行";    } else{        cout<<"不宜出行";}    return 0;}
    • A.适合出行
    • B.尚可出行
    • C.不宜出行
    • D.无输出
  14. 14.单选题5 分
    【函数封装】管事封装计算剩余载重的函数,以下代码执行后输出结果是?( )
    #include<iostream>using namespace std;int leftLoad(int max, int now){return max- now;}int main(){    cout<< leftLoad(200, 180);return 0;}
    • A.20
    • B.180
    • C.200
    • D.380
  15. 15.单选题5 分
    【异常处理】管事尝试访问数组越界元素,以下代码执行后会发生什么?( )
    #include<iostream>using namespace std;int main(){    int arr[3]={1,2,3};    cout<< arr[3];    return 0;}
    • A.输出 3
    • B.输出随机值
    • C.编译报错
    • D.程序崩溃
  16. 16.判断题5 分
    在 C++中,using namespace std;可以让代码直接使用标准库中的对象和函数。
  17. 17.判断题5 分
    for(int i= 0; i< 5; i++)循环会执行 5次。
  18. 18.判断题5 分
    C++中数组的下标从 1开始。
  19. 19.判断题5 分
    if-else语句中,else必须与最近的未匹配的 if配对。
  20. 20.判断题5 分
    cout用于向控制台输出数据,cin用于从控制台读取数据。