首页 > 餐饮服务人员
题目内容 (请给出正确答案)
[单选题]

有以下程序#include<string.h>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数组中都没有字符串结束符,故长度都不能确定

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下程序 #include<string.h> main(…”相关的问题
第1题
有以下程序#include "stdio.h"main(){ struct date {int year,month,day;}today; printf("%d\n",sizeof(struct date));}程序的运行结果是

A.6

B.8

C.12

D.10

点击查看答案
第2题
有以下程序#include <stdio.h>main(){ int x=1, y=2, z=3; if(x>y) if(y<z) printf(

有以下程序#include <stdio.h>main() { int x=1, y=2, z=3; if(x>y) if(y<z) printf("%d", ++z); else printf("%d", ++y); printf("%d\n", x++);}程序的运行结果是A.331 B.41 C.2 D.1

点击查看答案
第3题
有以下程序 #include<stdio.h> main() {int y=9; for(;y>0;y--) if(y%3==0)printf("%d",--y); } 程序的运行结粜是()。

A.741

B.963

C.852

D.875421

点击查看答案
第4题
(21 )有以下程序# include (stdio.h >main (){ int a = l ; b = 2 ;for (; a < 8 ; a++ ) { b

(21 )有以下程序

# include (stdio.h >

main ()

{ int a = l ; b = 2 ;

for (; a < 8 ; a++ ) { b+=a ; a+=2 ; }

printf (" %d , %d \ n ", a , b ) ;

}

程序运行后的输出结果是

A ) 9 , 18

B ) 8 , 11

C ) 7 , 11

D ) 10 , 14

点击查看答案
第5题
有以下程序:#include<stdio.h>void fun(char *a,char*B){while(*a=='*')a++;while(*b=*A){b++;a+

有以下程序: #include<stdio.h> void fun(char *a,char*B){while(*a=='*')a++; while(*b=*A){b++;a++;} } main() {char*s="****a*b****",t[80]; fun(s,t);puts(t); } 程序的运行结果是()。

A.*****a*b

B.a*b

C.a*b****

D.ab

点击查看答案
第6题
(25)有以下程序(说明:字母A的ASCII码值是65)#include <stdio.h>void fun(char *s){ while(

(25)有以下程序(说明:字母A的ASCII码值是65)

#include <stdio.h>

void fun(char *s)

{ while(*s)

{ if(*s%2) printf("%c",*s);

s++;

}

}

main()

{ char a[]="BYTE";

fun(a); printf("\n");

}

程序运行后的输出结果是

A)BY

B)BT

C)YT

D) YE

点击查看答案
第7题
有以下程序 #include <stdio.h> main() {int i,j,m=55; for(i=1;i<=3;i++) for(j=3;j<=i;j++)m=m%j; printf("%d\n",m); } 程序的运行结果是

A.0

B.1

C.2

D.3

点击查看答案
第8题
38) 有以下程序:#include <stdio.h>void fun(char *t,char *s){ while(*t!=0) t++;while((

38) 有以下程序:

#include <stdio.h>

void fun(char *t,char *s)

{ while(*t!=0) t++;

while((*t++=*s++)!=0);

}

main()

{ char ss[10]= " acc " ,aa[10]= " bbxxyy " ;

fun(ss,aa);

printf(" %s,%s\n " ,ss,aa);

}

程序运行结果是

A)accxyy,bbxxyy

B)acc, bbxxyy

C)accxxyy,bbxxyy

D) accbbxxyy,bbxxyy

点击查看答案
第9题
有以下程序#include<stdio.h> void fun(int *s) { static int j=0; do { s[j]=s[j]+s[j+1]

有以下程序

#include<stdio.h>

void fun(int *s)

{ static int j=0;

do { s[j]=s[j]+s[j+1]; )while(j<2);

}

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]);

printf("\n");

}

程序运行后的输出结果是

A) 12345

B)23445

C)34756

D) 35745

点击查看答案
第10题
有以下程序#include <stdio.h>#include <string.h>typedef struct{ char name[

有以下程序

#include <stdio.h>

#include <string.h>

typedef struct{ char name[9];char sex; float score[2]; } STU;

STU f(STU a)

{ STU b={"Zhao",'m',85.0,90.0}; int i;

strcpy(a.name,b.name);

a.sex=b.sex;

for(i=0;i<2;i++) a.score[i]=b.score[i];

return a;

}

main()

{ STU c={"Qian",'f',95.0,92.0},d;

d=f(c); printf("%s,%c,%2.0f,%2.0f\n",d.name,d.sex,d.score[0],d.score[1]);

}

程序的运行结果是

A)Qian,f,95,92

B)Qian,m,85,90

C)Zhao,m,85,90

D)Zhao,f,95,92

点击查看答案
第11题
试题32有以下程序#include <stdio.h>#include <string.h>main(){ char a[5][10]={“china”, “beijing”, “you”, “tiananmen”, “welcome”};int i,j; char t[10];for(i=0; i<4; i++)for(j=i+1; j<5; j++)if(strcmp(a[i], a[j])>0){ strcpy(t, a[i]); strcpy(a[i],a[j]); strcpy(a[j], t);}puts(a[3]);}程序运行后输出结果是()

A.beijing

B.china

C.welcome

D.tiananmen

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改