更多"[单选题]有以下程序
#include 'stdio.h'
f(ch"的相关试题:
[单选题]有以下程序
#include
void fun(char *s)
{ while(*s)
{ if (*s%2==0) printf("%c",*s);
s++;
}
}
void main()
{
char a[]={"good"};
fun(a);
printf("\n");
}
执行后的输出结果是( )。
A.a
B.b
C.c
D.d
[单选题]有以下程序
#include
void fun(char *c)
{ while(*c)
{ if(*c>='a'&&*c<='z') *c=*c-('a'-'A');
c++;
}
}
void main()
{ char s[81];
gets(s); fun(s); puts(s):
}
当执行程序时从键盘上输入Hello Beijing<回车>,则程序的输出结果是( )。
A.hello beijing
B. Hello Beijing
C.HELLO BEIJING
D. hELLO Beijing
[单选题]有以下程序
#include "stdio.h"
void main()
{ char s[12]= "a book";
printf("%.4s",s);
}
执行后的输出结果是( )。
A.a book!
B.a book![四个空格]
C.a bo
D.格式描述错误,输出不确定
[单选题]有以下程序
#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数组中都没有字符串结束符,故长度都不能确定
[单选题]有以下程序
#include
main()
{char ch[3][5]={“AAAA”,”BBB”,”CC”};
printf(“%s\n”,ch[1]);
}
程序运行后的输出结果是()。
A.AAAA
B. CC
C.BBBCC
D. BBB
[单选题]有以下程序
#include
void fun (char*c,int d)
{*c=*c+1;d=d+1;
printf("%c,%c,",*c,d);
}
void main()
{char b='a',a='A';
fun(&b,a); printf("%c,%c\n",b,a);
}
执行后的输出结果是( )。
A.b,B,b,A
B.b,B,a,A
C.b,b,a,a
D.b,b,A,a
[单选题]下面程序的输出结果是()。
#include
#include
main()
{ char *p1="abc",*p2="ABC",str[50]= "xyz";
strcpy(str+2,strcat(p1,p2));
printf("%s\n",str);}
A.xyzabcABC
B.zabcABC
C.xyabcABC
D.yzabcABC
[单选题]#include "stdio.h"
void main( )
{ char str[80];
scanf("%s",str);
insert(str);
}
insert(char s[])
{
int i;
for(i=strlen(s);i>0;i--)
{ s[2*i]=s[i];
s[2*i-1]=' ';
}
printf("%s",s);
}
如果输入的字符串是abcd, 则程序的运行结果是 ( ) 。
A.
a
b
c
d
B.a c b d
C.a b c d
D.d
c
b
a
[单选题]#include
int streql(char *str1,char *str2)
{ while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
return((*str1==NULL)&&(*str2==NULL));
}
void main()
{
printf("%d",streql("abc","Abc"));
}
程序的运行结果是 ( ) 。
A.0
B.1
C.2
D.3
[单选题]#include
void disp(char *string)
{
if(*string)
{
disp( string+1);
putchar (*string);
}
}
void main()
{
disp("abcdefg");
}
程序的运行结果是( )。
A.abcdefg
B. gfedcba
C. abcd
D. dcba
[单选题]有以下程序
void ss(char *s,char t)
{ while(*s)
{ if(*s==t)*s=t-′a′+′A′;
s++; } }
main()
{ char str1[100]="abcddfefdbd",c=′d′;
ss(str1,c); printf("%s\n",str1);}
程序运行后的输出结果是( )。
A.ABCDDEFEDBD
B.abcDDfefDbD
C. abcAAfefAbA
D.Abcddfefdbd
[单选题]有以下程序
main()
{ char s[ ]= "abcde"; s+=2; printf("%d\n",s[0]); }
执行后的结果是()。
A.输出字符a的ASCII码
B.输出字符c的ASCII码
C.输出字符c
D.程序出错
[单选题]有以下程序
main()
{union
{char ch[2];
int d;
}s;
s.d=0x4321;
printf("%x,%x\n",s.ch[0],s.ch[1]);
}
在16位编译系统上,程序执行后的输出结果是()。
A.21,43
B.43,21
C.43,00
D.21,00
[单选题]有以下程序
main()
{char s[ ]={ "aeiou"},*ps;
ps=s; printf("%c\n",*ps+4);}程序运行后的输出结果是()。
A.a
B.e
C.u
D.元素s[4]的地址
[单选题]有以下程序
#include
struct S
{ int a,b;}data[2]={10,100,20,200};
main()
{ struct S p=data[1];
printf("%d\n",++(p.a));
}
程序运行后的输出结果是()。
A.10
B.11
C.20
D.21
[单选题]有以下程序
#include
double f(double x);
main()
{double a=0; int i;
for(i=0;i<30;i+=10) a+=f((double)i);
printf(“%5.0f\n”,a);
}
double f(double x)
{return x*x+1;}
程序运行后的输出结果是()。
A.503
B.401
C.500
D.1404
[单选题]有以下程序
#define N 5
#define M N+1
#define f(x) (x*M)
main()
{int i1,i2;
i1=f(2);
i2=f(1+1);
printf(“%d %d\n”,i1,i2); }
程序的运行结果是()。
A.12 12
B.11 7
C.11 11
D.12 7