#sy0012. 2026算法应用 智传民韵 C++ 模拟题2

2026算法应用 智传民韵 C++ 模拟题2

单选题(15题,共75分)

第1题(5分)
在 C++ 中,想要在屏幕上输出“欢迎来到苗族织锦技艺展!”,应该使用以下哪条语句?

{{ select(1) }}

  • cout << "欢迎来到苗族织锦技艺展!";
  • cin >> "欢迎来到苗族织锦技艺展!";
  • print("欢迎来到苗族织锦技艺展!");
  • printf("欢迎来到苗族织锦技艺展!")

第2题(5分)
已知变量 brocade 表示织锦数量,刺绣数量比织锦多 6 件。以下哪行代码可以正确计算刺绣数量并存入变量 embroidery?

{{ select(2) }}

  • embroidery = brocade + 6;
  • embroidery == brocade + 6;
  • brocade + 6 = embroidery;
  • embroidery = brocade - 6;

第3题(5分)
牧民有羊群 200 只,每只羊产羊毛约 4 千克。以下哪段代码能正确计算总羊毛产量并存入变量 total?

{{ select(3) }}

  • total = 200 * 4;
  • total = "200" * 4;
  • total = 200 + 4;
  • total = 200 / 4;

第4题(5分)
下列哪个变量名符合 C++ 命名规则?

{{ select(4) }}

  • 2_herb
  • herb-name
  • herb_name
  • herb name

第5题(5分)
已有 int tea = 35; 执行 tea = tea - 5; 后,tea 的值是多少?

{{ select(5) }}

  • 5
  • 30
  • 35
  • 40

第6题(5分)
阅读以下代码,程序运行后会输出什么?

#include <iostream>
using namespace std;
int main() {
  string craft = "苗绣";
  cout << "我们传承的技艺是:" << craft << endl;
  return 0;
}

{{ select(6) }}

  • 我们传承的技艺是:
  • 我们传承的技艺是:苗绣
  • 我们传承的技艺是:"苗绣"
  • 编译报错

第7题(5分)
如果要从键盘输入一个整数表示梯田亩数,并存入变量 area,应使用以下哪条语句?

{{ select(7) }}

  • cin >> area;
  • cout << area;
  • cin << area;
  • cout >> area;

第8题(5分)
下列哪个运算符用于判断两个数是否不相等?

{{ select(8) }}

  • =
  • ==
  • !=
  • >=

第9题(5分)
阅读以下程序,如果用户输入数字 3,输出结果是什么?

#include <iostream>
using namespace std;
int main() {
  int choice;
  cout << "请选择纹样:1.云纹 2.水纹 3.回纹" << endl;
  cin >> choice;
  if (choice == 1) {
    cout << "您选择了云纹" << endl;
  } else if (choice == 2) {
    cout << "您选择了水纹" << endl;
  } else {
    cout << "您选择了回纹" << endl;
  }
  return 0;
}

{{ select(9) }}

  • 您选择了云纹
  • 您选择了水纹
  • 您选择了回纹
  • 程序报错

第10题(5分)
在 C++ 中,循环 for(int i = 1; i <= 5; i++) 的循环体将执行多少次?

{{ select(10) }}

  • 4 次
  • 5 次
  • 6 次
  • 不确定

第11题(5分)
要计算“梯田插秧 6 天的总进度”,已知每天插秧 3 亩,且使用循环累加,以下哪种写法正确?

{{ select(11) }}

  • int total = 0;
    for(int i = 0; i < 6; i++) {
      total = total + 3;
    }
    
  • int total = 0;
    for(int i = 0; i < 6; i++) {
      total = 3;
    }
    
  • int total = 0;
    while(total < 6) {
      total = total + 3;
    }
    
  • int total = 0;
    for(int i = 0; i <= 6; i++) {
      total = total + 3;
    }
    

第12题(5分)
以下代码横线处填入哪个选项,能正确输出数组内容?

#include <iostream>
using namespace std;
int main() {
  string herbs[3] = {"三七", "天麻", "石斛"};
  cout << "药材清单:";
  for(int i = 0; i < 3; i++) {
    cout << ______ << " ";
  }
  return 0;
}

{{ select(12) }}

  • herbs
  • herbs[i]
  • herbs[3]
  • "herbs"

第13题(5分)
阅读以下程序,它的功能是什么?

#include <iostream>
using namespace std;
int main() {
  int weight;
  cout << "请输入药材重量(克):";
  cin >> weight;
  if (weight > 100) {
    cout << "使用大号药碾" << endl;
  } else {
    cout << "使用小号药碾" << endl;
  }
  return 0;
}

{{ select(13) }}

  • 计算药材总价
  • 判断使用哪种规格的药碾
  • 计算药碾数量
  • 输出药材种类

第14题(5分)
以下代码运行后,变量 result 的值是多少?

int brocade = 10;
int embroidery = 6;
int dye = 4;
int result = brocade + embroidery * 2 - dye;

{{ select(14) }}

  • 16
  • 18
  • 20
  • 28

第15题(5分)
在 C++ 中,如果要存储多个相同类型的数据(如不同民族的特色符号),通常使用以下哪种数据类型?

{{ select(15) }}

  • int
  • string
  • 数组
  • bool

判断题(5题,共10分)

第1题(2分)
C++ 中,单行注释使用 //,多行注释使用 /* */

{{ select(16) }}

  • 正确
  • 错误

第2题(2分)
语句 cout << 2 + 3 * 4; 的输出结果是 20。

{{ select(17) }}

  • 正确
  • 错误

第3题(2分)
可以使用 sizeof() 运算符获取数组占用的内存字节数。

{{ select(18) }}

  • 正确
  • 错误

第4题(2分)
循环 for(int i = 2; i <= 5; i++) 的循环体将执行 3 次。

{{ select(19) }}

  • 正确
  • 错误

第5题(2分)
条件语句中,else 必须与 if 配对使用,不能单独出现。

{{ select(20) }}

  • 正确
  • 错误