C++基础能力测试题

推荐等级:
发布时间:
2024-5-23
试卷分类: 计算机C ++
卷面总分: 100分
答题时间: 120分钟
试卷类型: 模拟试题
试卷题量: 20
试卷预览
获取报告/答案
扫码用手机做题

真题示例

1
单选题 2分
1.在C++中,以下哪些变量的名称是合法的?
  • A. _name
  • B. $value
  • C. Student
  • D. uuuuuuuuuuw RRRRERSDQQ ASass q 2018
查看答案
开始做题
2
单选题 2分

#include <iostream>

using namespace std;

int main()

{

    int d = 10;

  c = ++d;

  cout << c << endl ;

  c = d--;

  cout << c << endl ;

return 0;

}

 

以上代码两次输出的c的值分别是多少?

  • A. 10,10
  • B. 10, 11
  • C. 11, 11
  • D. 11,10
查看答案
开始做题
3
单选题 2分

#include

using namespace std;

int main ()

{

  int a = 10;

  do{

          if( a == 15){

                             a++;

                             continue;

           }

           a++;

           cout << a << endl;

      }while( a < 20 );

  return 0;

}

 

以上代码的输出结果中,有以下哪个数?

  • A. 10
  • B. 15
  • C. 16
  • D. 21
查看答案
开始做题
4
单选题 2分

#include

using namespace std;

int main()

{

  int s=1,n=0;

  while(n<3)

{

n++;

s=2*s+2;

}

  cout<<s<<endl;

}

 

以上代码的输出结果是什么?

  • A. 4
  • B. 10
  • C. 22
  • D. 46
查看答案
开始做题
5
单选题 2分

#include <iostream>

#include <string>

using namespace std;

int main()

{

char word[6];

int n=5;

for(int i=1;i<6;i++)

cin>>word[i];

while(n!=0)

{

cout<<word[n];

n--;

}

return 0;

}

若输入CHINA

则输出是什么?

  • A. CHINA
  • B. ANIHC
  • C. 54321
  • D. 12345
查看答案
开始做题
6
单选题 2分

#include <iostream>

using namespace std;

int sum(int a, int b=100)

{

int result;

result = a + b;

return (result);

}

int main ()

{

int a = 2018;

int b = 1;

int result;

result = sum(a, b);

cout <<result << endl;

result = sum(a);

cout << result << endl;

return 0;

}

以上代码两次输出结果分别是什么?

  • A. 2019,2118
  • B. 2018, 2019
  • C. 2019, 2018
  • D. 2118, 2118
查看答案
开始做题
站内搜索
热门课程

翰衡竞赛资料库

国际竞赛类资料

热门竞赛咨询