设已执行预编译命令#include<string.h>,以下程序段的输出结果是( )。 char s[]=" an apple" ; printf(" %d\n" ,strlen(s));
A.7
B.8
C.9
D.10
第1题:
以下程序输出的结果是 #include<stdio.h> #include<string.h> main() { char w[][10]={"ABCD","EFGH","IJKL","MNOP"},k; for(k=1;k<3;k++) printf("%s\n",&w[k][k]);}
A.ABCD FGH KL
B.ABC EFG U M
C.EFG JK O
D.FGH KL
第2题:
当执行下面的程序时,如果输入ABC,则输出结果是 ( ) # include<stdio.h> # include<string.h> main( ) { char ss [10] ="12345"; gets(ss);strcat(ss"6789");printf("%s\n",ss); }
A.ABC6789
B.ABC67
C.12345ABC6
D.ABC456789
第3题:
下列程序执行的输出结果是( )。 #include<stdio.h> main() { char a[2][4]; strcpy(a,"are");strcpy(a [1],"you"); a[0][3]='&'; printf("%s\n",a); }
A.are&you
B.you
C.are
D.&
第4题:
下列程序的运行结果是( )。
#include<stdio.h>
#include<string.h>
main()
{ char*s1="abDuj";
char*s2="ABdUG";
int t;
t=strcmp(s1,s2) ;
printf("%d",t);
}
A.正数
B.负数
C.零
D.不确定的值
第5题:
有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。
A.15
B.16
C.12
D.59
第6题:
以下程序运行后的输出结果是( )。 include<string.h> main() {char ch[]="abcd",x[4][4];int i; for(i=0;i<4;i++)strcpy(x[i],ch); for(i=0;i<4;i++)printf("%s",&x[i][i]); printf("\n"); }
第7题:
以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd\n\123\xab"; printf("%d",(str)); } 运行后的输出结果是( )。
A.10
B.9
C.7
D.14
第8题:
有以下程序 #include.<string.h> main() { char *p="abcde\ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是
A.12
B.15
C.6
D.5
第9题:
设已包含头文件<string.h>,下列程序段的运行结果是( )。
char s1[]={"ACDEF"};
char s2[]="ABC";
strcpy(s1,s2) ;
printf("%d",strlen(s1) );
A.3
B.4
C.6
D.5
第10题:
下面程序的输出结果是 ( ) # include<stdio.h> # include<string.h> { char * p1="abc" , * p2=" ABC ",str[50]="xyz"; strcpy(str+2.strcat (pi,p2)); printf("%s\n",str);}
A.xyzabcAB
B.zabcABC
C.yzabcABC
D.xycbcABC
第11题:
以下程序的输出结果是______。 #include <string.h> main() { char*a="abcdefghi";int k fun(a);puts(a); } fun(char*s) { int x,y; char c for(x=0,y=strlen(s)-1;x<y:x++,y--) {c=s[y];s[y]=s[x];s[x]=c;} }
A.ihgfedcba
B.abcdefghi
C.abcdedeba
D.ihgfefghi
第12题:
下列程序执行后的输出结果是( )。 #include<stdio.h> #include <string.h> main() { char arr[2][4]; strcpy(arr[0],"you");strcpy(arr[1],"me"); arr[0][3]='&'; Printf("%s\n",arr); }
A.you&me
B.you
C.me
D.err
第13题:
以下程序的输出结果是【 】。
include<iostream.h>
include <string.h>
void main 0 {
char s[50];
strcpy(&s[O], "No" );
strcpy(&s[1], "123" );
strcpy (&s[2], "23456" );
cout<<s;
}
第14题:
以下程序的输出结果是( ) #include<stdio.h> #include<string.h> main() {char str[12]={'s','t','r','i','n','g'}; printf("%d\n",strlen(str)); }
A.6
B.7
C.11
D.12
第15题:
有以下程序: #include<string.h> void f(char *s,char *t) {char k; k=*s; +s=*t; *t=k; S++; t--; if(*s) f(s,t); } main() {char.str[10]="abcdefg",*p; p=str+strlen(str) /2+1; f(p,p-2); printf("%s\n",str); } 程序运行后的输出结果是 ______。
A.abcdefg
B.gfedcba
C.gbcdefa
D.abedcfg
第16题:
有以下程序: #include <string.h> main() { char str[][20]={"Hello","Beijing"}*p=str; printf("%\n",strlen(p+20)); } 程序运行后的输出结果是
A.0
B.5
C.7
D.20
第17题:
以下程序运行后输入:3,abcde<回车>,则输出结果是【 】
include <string.h>
move(char *str, int n)
{ char temp; int i;
temp=str[n-1];
for(i=n-1;i>0;i--) str[i]=str[i-1];
str[0]=temp;
}
main( )
{ char s[50]; int n, i, z;
scanf("%d,%s",&n,s);
z=strlen(s);
for(i=1; i<=n; i++) move(s, z);
printf("%s\n",s);
}
第18题:
有以下程序: #include <string.h> main() {char *p="abcde\Ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是( )。
A.12
B.15
C.6
D.5
第19题:
下列程序的输出结果是( )。 #include<stdio.h> #include<string.h> main() { char a[]="\n123\\"; printf("%d,%d\n",strlen(a),sizeof(a)); }
A.5,6
B.5,5
C.6,6
D.6,5
第20题:
下列程序的输出结果是( )。 #include<stdio.h> #include<string.h> main() { char a[]="\n123\\"; printf ("%d,%d\n",strlen(a),sizeof(a)); }
A.5,6
B.5,5
C.6,6
D.6,5
第21题:
有以下程序: #include <stdio.h>#include <string.h>void f(char * s,char*t){ char k; k=*s; *s=*t; *t=k; s++; t--; if( * s) f(s,t);}main( ){ char str[10] :"abedefg", * p; p = str + strlen(str)/2+1; f(p,p -2); printf( "% s \n" ,str);程序运行后的输出结果是( )。
A.abcdefg
B.gfedcba
C.gbcdefa
D.abedcfg
第22题:
设已执行预编译命令#include<string.h>,以下程序段的输出结果是
char s[]=" an apple" ;
printf(" %d\n",strlen(s));
A.7
B.8
C.9
D.10
第23题:
有以下程序: #include <stdio.h> #include <string.h> main() { char *p[10]={"abc","aabdfg","dcdbe","abbd","cd"}; printf("%d\n",strlen(p[4])); } 执行后的输出结果是( )。
A.2
B.3
C.4
D.5