APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
有以下程序
#include
main()
{ char p[]={′a′, ′b′, ′c′},q[10]={ ′a′, ′b′, ′c′};
printf("%d%d\n",strlen(p),strlen(q));}
以下叙述中正确的是 ( )。

A、在给p和q数组置初值时,系统会自动添加字符串结束符,故输出的长度都为3

B、 由于p数组中没有字符串结束符,长度不能确定,但q数组中字符串长度为3

C、由于q数组中没有字符串结束符,长度不能确定,但p数组中字符串长度为3

D、由于p和q数组中都没有字符串结束符,故长度都不能确定

答案:A

信息技术知识竞赛c语言
若有定义:int b[5];则以下对b 数组元素的正确引用是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651a.html
点击查看题目
以下叙述正确的是 ()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651f.html
点击查看题目
在嵌套使用if语句时,C语言规定else总是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346508.html
点击查看题目
有以下程序
#include
void fun(int *s)
{ static int j=0;
do
{ s[j]+=s[j+1];
}while(++j<2);
}
void main()
{ int k,a[10]={1,2,3,4,5};
for(k=1;k<3;k++)
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346518.html
点击查看题目
有以下程序
#include “stdio.h”
fun(int x, int y){ return (x+y); }
void main()
{ int a=1, b=2, c=3, sum;
sum=fun((a++,b++,a+b),c++);
printf("%d\n",sum);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346511.html
点击查看题目
有如下程序
main()
{ char ch[2][5]={"6937","8254"},*p[2];
int i,j,s=0;
for(i=0;i<2;i++)p[i]=ch[i];
for(i=0;i<2;i++)
for(j=0;p[i][j]>'\0';j+=2)
s=10*s+p[i][j]-'0';
printf("%d\n",s);}
该程序的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650c.html
点击查看题目
有以下程序
  #include
  int fun (int x,int y)
  { if (x!=y) return ((x+y)/2);
  else return (x);
  }
  main()
  { int a=4,b=5,c=6;
  printf("%d\n",fun(2*a,fun(b,c)));
  }
  程序运行后的输出结果是 ()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346523.html
点击查看题目
有以下程序
main()
{char s[ ]={ "aeiou"},*ps;
ps=s; printf("%c\n",*ps+4);}程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346503.html
点击查看题目
有以下程序
main()
{ int i, j;
for(j=10;j<11;j++)
{ for(i=9;i<=j-1;i++)printf("%d",j);
}
}
输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346512.html
点击查看题目
执行下列程序时输入123<空格>456<空格>789<回车> 输出结果是 ()。
main()
{ char s[100]; int c, i;
scanf("%c",&c); scanf("%d",&i); scanf("%s",s);
printf("%c,%d,%s\n",c,i,s);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346522.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
信息技术知识竞赛c语言

有以下程序
#include
main()
{ char p[]={′a′, ′b′, ′c′},q[10]={ ′a′, ′b′, ′c′};
printf("%d%d\n",strlen(p),strlen(q));}
以下叙述中正确的是 ( )。

A、在给p和q数组置初值时,系统会自动添加字符串结束符,故输出的长度都为3

B、 由于p数组中没有字符串结束符,长度不能确定,但q数组中字符串长度为3

C、由于q数组中没有字符串结束符,长度不能确定,但p数组中字符串长度为3

D、由于p和q数组中都没有字符串结束符,故长度都不能确定

答案:A

信息技术知识竞赛c语言
相关题目
若有定义:int b[5];则以下对b 数组元素的正确引用是()。

A. *b[5]

B. b+2

C. *(*(b+2))

D. *(b+2)

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651a.html
点击查看答案
以下叙述正确的是 ()。

A. 在C程序中,每行中只能写一条语句

B. 若a是实型变量,C程序中允许赋值a=10,因此实型变量中允许存放整型数

C. C程序中,无论是整数还是实数,都能被准确无误地表示

D. 在C程序中,%是只能用于整数运算的运算符

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651f.html
点击查看答案
在嵌套使用if语句时,C语言规定else总是()。

A. 和之前与其具有相同缩进位置的if配对

B. 和之前与其最近的if配对

C. 和之前与其最近的且不带else的if配对

D. 和之前的第一个if配对

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346508.html
点击查看答案
有以下程序
#include
void fun(int *s)
{ static int j=0;
do
{ s[j]+=s[j+1];
}while(++j<2);
}
void main()
{ int k,a[10]={1,2,3,4,5};
for(k=1;k<3;k++)
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]);
}
执行后的输出结果是( )。

A. 35756

B. 23445

C. 35745

D. 12345

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346518.html
点击查看答案
有以下程序
#include “stdio.h”
fun(int x, int y){ return (x+y); }
void main()
{ int a=1, b=2, c=3, sum;
sum=fun((a++,b++,a+b),c++);
printf("%d\n",sum);
}
执行后的输出结果是( )。

A. 6

B. 7

C. 8

D. 9

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346511.html
点击查看答案
有如下程序
main()
{ char ch[2][5]={"6937","8254"},*p[2];
int i,j,s=0;
for(i=0;i<2;i++)p[i]=ch[i];
for(i=0;i<2;i++)
for(j=0;p[i][j]>'\0';j+=2)
s=10*s+p[i][j]-'0';
printf("%d\n",s);}
该程序的输出结果是()。

A. 69825

B. 63825

C. 6385

D. 693825

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650c.html
点击查看答案
有以下程序
  #include
  int fun (int x,int y)
  { if (x!=y) return ((x+y)/2);
  else return (x);
  }
  main()
  { int a=4,b=5,c=6;
  printf("%d\n",fun(2*a,fun(b,c)));
  }
  程序运行后的输出结果是 ()。

A. 3

B. 6

C. 8

D. 12

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346523.html
点击查看答案
有以下程序
main()
{char s[ ]={ "aeiou"},*ps;
ps=s; printf("%c\n",*ps+4);}程序运行后的输出结果是()。

A. a

B. e

C. u

D. 元素s[4]的地址

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346503.html
点击查看答案
有以下程序
main()
{ int i, j;
for(j=10;j<11;j++)
{ for(i=9;i<=j-1;i++)printf("%d",j);
}
}
输出结果是()。

A. 11

B. 10

C. 9

D. 10 11

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346512.html
点击查看答案
执行下列程序时输入123<空格>456<空格>789<回车> 输出结果是 ()。
main()
{ char s[100]; int c, i;
scanf("%c",&c); scanf("%d",&i); scanf("%s",s);
printf("%c,%d,%s\n",c,i,s);
}

A. 123456789

B. 1456789

C. 1,23,456,789

D. 1,23,456

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346522.html
点击查看答案
试题通小程序
试题通app下载