#GESP0307. [GESP202312 三级]选择+判断

[GESP202312 三级]选择+判断

  1. 下面 C++ 数组的定义中,会丢失数据的是

{{ select(1) }}

  • char dict_key[] = {'p','t','o'};
  • int dict_value[] = {33,22,11};
  • char dict_name[]={'chen','wang','zhou'};
  • float dict_value[]={3,2,1};
  1. 在下列编码中,不能够和二进制"1101 1101"相等的是()。

{{ select(2) }}

  • (221)10(221)_{10} 进制
  • (335)8(335)_8 进制
  • (dd)16(dd)_{16} 进制
  • (5d)16(5d)_{16} 进制
  1. 下面 C++ 代码执行后不能输出"GESP"的是()。

{{ select(3) }}

  • string str("GESP"); cout<<str<<endl;
  • string str="GESP"; cout<<str<<endl;
  • string str("GESP"); cout<<str[1]<<str[2]<<str[3]<<str[4]<<endl;
  • string str{"GESP"}; cout<<str<<endl;
  1. 执行下面C++代码输出是()。
int temp=0;
for(int i=1;i<7;i++)
{
 for(int j=1;j<5;j++)
 {
 if(i/j==2)
 {
 temp++;
 }
 }
}
cout<<temp<<endl;

{{ select(4) }}

  • 10
  • 8
  • 4
  • 3
  1. 执行下面 C++ 代码后,输出是()。
string str=("chen");
int x=str.length();
int temp=0;
for(int i=0;i<=x;i++)
{
 temp++;
}
cout<<temp<<endl;

{{ select(5) }}

  • 44
  • 22
  • 55
  • 33
  1. 第6题 执行下面 C++ 代码后输出的是()。
string str=("chen");
int x=str.length();
cout<<x<<endl;

{{ select(6) }}

  • 44
  • 33
  • 22
  • 55
  1. 执行下面 C++ 代码后输出的是()。
string str=("chen");
cout<<str[5]<<endl;

{{ select(7) }}

  • 输出未知的数
  • 输出'n'
  • 输出'\0'
  • 输出空格
  1. 下面 C++ 代码执行后的输出是()。
char ch[10]={'1'};
cout<<ch[2]<<endl;

{{ select(8) }}

  • 00
  • 11
  • 输出空格
  • 什么也不输出
  1. 下面 C++ 代码用于统计每种字符出现的次数,当输出为 3 时,横线上不能填入的代码是()。
string str="GESP is a good programming test!";
int x=0;
for(int i=0;i<str.length();i++)
{
 if(_________)
 {
 x++;
 }
}
cout<<x<<endl;

{{ select(9) }}

  • str[i]=='o'
  • str[i]=='a'+14
  • str[i]==115
  • str[i]==111
  1. 32 位计算机中,C++ 的整型变量 int 能够表示的数据范围是()。

{{ select(10) }}

  • 231(231)12^{31} \sim (2^{31})-1
  • 2322^{32}
  • 231+(231)1-2^{31} \sim +(2^{31})-1
  • (231)+1231-(2^{31})+1 \sim 2^{31}
  1. 下面 C++ 程序执行的结果是()。
int cnt=0;
for(int i=0;i<=20;i++)
{
 if(i%3==0&&i%5==0)
 {
 cnt++;
 }
}
cout<<cnt;

{{ select(11) }}

  • 22
  • 33
  • 55
  • 44
  1. C++ 的数据类型转换让人很难琢磨透,下列代码输出的值是()。
int a=3;
int b=2;
cout<<a/b*1.0<<endl;

{{ select(12) }}

  • 1.51.5
  • 11
  • 22
  • 1.501.50
  1. C++ 代码用于抽取字符串中的电话号码。约定:电话号码全部是数字,数字之间没有其他符号如连字符或空格等。代码中变量 strSrc 仅仅是示例,可以包含更多字符。下面有关代码说法,正确的说法是()。
string strSrc="红十字:01084025890火警电话:119急救电话:120紧急求助:110";
string tel="";
for(int i=0;i<=strSrc.length();i++)
{
 if(strSrc[i]>='0'&&strSrc[i]<='9')
 {
 tel=tel+strSrc[i];
 }
 else if(tel!="")
 {
 cout<<tel<<endl;
 tel="";
 }
}

{{ select(13) }}

  • 代码将换行输出各个含有数字的电话号码。
  • 代码将不换行输出各个含有数字的电话号码,号码中间没有分隔。
  • 代码将不换行输出各个含有数字的电话号码,号码中间有分隔。
  • 不能够输出数字电话号码。
  1. 某公司新出了一款无人驾驶的小汽车,通过声控智能驾驶系统,乘客只要告诉汽车目的地,车子就能自动选择一条优化路线,告诉乘客后驶达那里。请问下面哪项不是驾驶系统完成选路所必须的。()

{{ select(14) }}

  • 麦克风
  • 扬声器
  • 油量表
  • 传感器
  1. 现代计算机是指电子计算机,它所基于的是()体系结构。

{{ select(15) }}

  • 艾伦·图灵
  • 冯·诺依曼
  • 阿塔纳索夫
  • 埃克特-莫克利
  1. 执行C++代码 cout<<(5&&2)<<endl; 后将输出 1。()

{{ select(16) }}

  • T
  • F
  1. C++程序执行后,输入 chen a dai 输出应该为:chen。()
string str;
cin>>str;
cout<<str;

{{ select(17) }}

  • T
  • F
  1. 执行 C++ 代码 cout<<(5||2); 后将输出 1。()

{{ select(18) }}

  • T
  • F
  1. 执行下面 C++ 代码后将输出"China"。()
string a="china";
a.replace(0,1,"C");
cout<<a<<endl;

{{ select(19) }}

  • T
  • F
  1. 执行 C++ 代码将输出 0 5,5 之后还有一个空格。()
int list[10]={1,2,3,4,5,6,7,8,9,10};
for(int i=0;i<10;i++)
{
 if(i%5==0)
 {
 cout<<list[i]<<" ";
 }
}

{{ select(20) }}

  • T
  • F
  1. 下面 C++ 代码将输出 1。()
int list[10]={1};
cout<<list<<endl;

{{ select(21) }}

  • T
  • F
  1. 下面 C++ 程序将输出 1。()
int arr[10]={1};
cout<<arr[0]<<endl;

{{ select(22) }}

  • T
  • F
  1. 执行 C++ 代码,将输出 1 3 5 7 9,9 之后还有一个空格。()
int list[10]={1,2,3,4,5,6,7,8,9,10};
for(int i=0;i<10;i+=2)
{
 cout<<list[i]<<" ";
}

{{ select(23) }}

  • T
  • F
  1. 小杨最近在准备考 GESP,他用的 Dev C++ 来练习和运行程序,所以 Dev C++ 也是一个小型操作系统。()

{{ select(24) }}

  • T
  • F
  1. 任何一个 while 循环都可以转化为等价的 for 循环()。

{{ select(25) }}

  • T
  • F