. string ;
. undefined;
. object ;
. String;
第1题:
若输入bcdefgh、m、abcdefg,以下程序的输出结果为( )。 #include<stdio.h> #include<string.h> main() { int i; char string[20],str[3][20]; for(i=0;i<3;i++)gets(str[i]); if(strcmp(str[0],str[1])>0) strcpy(string,str[0]); else strcpy(string,str[1]); if(strcmp(str[2],string)>0) strcpy(string,str[2]); printf("%s",string); }
A.bcdefgh
B.m
C.abcdefg
D.bcdefgh或abcdefg
第2题:
以下C程序段的输出结果是(30)。 #include <stdio. h> void abc(char *str){ int a, b; for(a=b=0;str[a]!='\O';a++)if(str[a]!='c') str[b++]=str[a]; str[b]='\O'; } void main(){ char str[]="abcdef"; abc(str); printf("str[]=%s",str); }
A.str[]=a
B.str[]=ab
C.str[]=abdef
D.str[]=abcdef
第3题:
以下程序的输出结果是 _[13]_______ .
#include <stdio.h>
#include <string.h>
char *fun(char *t)
{ char *p=t;
return(p+strlen(t)/2);
}
main()
{ char *str="abcdefgh";
str=fun(str);
puts(str);
}
第4题:
若有以下程序:
include <iostream>
using namespace std;
int main()
{
char str[10];
cin>>str;
cout<< str<<end1;
return 0;
}
当输入为:
This is a program!
那么执行程序后的输出结果是【 】。
第5题:
以下程序的输出结果是【 】。
include <stdio.h>
include <string.h>
char *fun(char *0
{ char *p--t;
return (p+strlen(t)/2);
}
main()
{ char *str="abcdefgh";
str=ftm(str);
puts(str);
}
第6题:
A. var str string
B. str := ""
C. str = ""
D. var str = ""
第7题:
执行下列语句后,输出结果为steven的是
char*str="steven";
eout.write(str, );
A.strlen(str)
B.sizeof(str)
C.strlen(str+1)
D.sizeof(str-1)
第8题:
当运行以下程序时,输入 abcd ,程序的输出结果是 : 【 9 】 。
insert(char str[])
{ int i;
i=strlen(str);
while(i>0)
{ str[2*i]=str[i];str[2*i-1]='*'; i--;}
printf(" % s\n",str);
}
main()
{ char str[40];
scanf(" % s",str);insert(str);
}
第9题:
以下程序段运行后消息框的输出结果为______。
s="Access"
Dim str As String
For i=1 To Len(s)
str=UCase(Mid(S,I,I))+str
Next i
MsgBox str
第10题:
以下程序的输出结果是( )。 char str[15]=”hello!”; printf(“%d\n”,strlen(str));
A.15
B.14
C.7
D.6