更多"[单选题]有以下程序
#include<stdio.h>
voi"的相关试题:
[单选题]有以下程序
#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
[单选题]有以下程序
#include
void fun(int *p)
{printf(“%d\n”,p[5]);}
main()
{int a[10]={1,2,3,4,5,6,7,8,9,10};
fun(&a[3]);
程序运行后的输出结果是()。
A.5
B.6
C.8
D.9
[单选题]下列程序的运行结果是()。
void fun(int *a, int *b)
{ int *k;
k=a; a=b; b=k;
}
main()
{ int a=3, b=6, *x=&a, *y=&b;
fun(x,y);
printf("%d %d", a, b);
}
A.6 3
B.3 6
C.编译出错
D.0 0
[单选题]有以下程序
#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
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,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
[单选题]有以下程序
void fun1(char *p)
{char *q;
q=p;
while(*q!='\0')
{ (*q)++; q++;
}
main()
{char a[]={"Program"}, *p;
p=&a[3];fun1(p);printf("%s\n",a);
}
程序执行后的输出
A.Prohsbn
B.Prphsbn
C.Progsbn
D.Program
[单选题]有以下程序
void fun2(char a, char b){printf(“%c%c”,a,b);}
char a= 'A',b= 'B';
void fun1( ){ a= 'C'; b= 'D'; }
main( )
{ fun1( ) ;
printf( “%c%c”,a,b);fun2('E', 'F'); }
程序的运行结果是()。
A.CDEF
B.ABEF
C.ABCD
D.CDAB
[单选题]有以下程序
int fun(int x,int y,int *cp,int *dp)
{ *cp=x+y; *dp=x-y; }
main()
{ int a, b, c, d;
a=30; b=50;
fun(a,b,&c,&d);
printf("%d,%d\n", c, d);
}
输出结果是()。
A.50,30
B.30,50
C.80,-20
D.80,20
[单选题]有以下程序
int fun(int x[],int n)
{static int sum=0,i;
for(i=0;iA.45
B.50
C.60
D.55
[单选题]有以下程序
fun(int x)
{ int p;
if(x==0||x==1) return(3);
p=x-fun(x-2);
return p;
}
main()
{ printf("%d\n",fun(7)); }
执行后的输出结果是( )。
A.7
B.3
C.2
D.0
[单选题]下面的程序执行后,文件test中的内容是 ()。
void fun(char *fname,char *st)
{ FILE *myf; int i;
myf=fopen(fname,"w" );
for(i=0;st[i];i++)
fputc(st[i],myf);
fputc('\0',myf);
fclose(myf);
}
main()
{ fun("test","new world"); fun("test","hello,");}
A.hello,
B.new worldhello,
C.new world
D.hello, rld
[单选题]有以下程序
fun(int x)
{int p;
if(x==0║x==1) return(3);
p=x-fun(x-2); return p; }
main()
{ prinf("%d\n",fun(7));}
执行后的输出结果是()。
A.7
B.3
C.2
D.0
[单选题]有以下程序
fun(int x,int y)
{static int m=0,i=2; i+=m+1;m=i+x+y; return m; }
main()
{int j=1,m=1,k;
k=fun(j,m); printf("%d,",k);
k=fun(j,m);
printf("%d\n",k);
}
执行后的输出结果
A.5,5
B.5,11
C.11,11
D.11,5
[单选题]有以下程序段
struct st
{int x;int *y;}*pt;
int a[]={1,2},b[]={3,4};
struct st c[2]={10,a,20,b};
pt=c;
以下选项中表达式的值为11的是()。
A.*pt->y
B.pt->x
C.++pt->x
D.(pt++)->x
[单选题]有以下程序
fun(int x,int y){return(x+y);}
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
[单选题]以下程序的输出是()。
struct st
{ int x; int *y;} *p;
int dt[4]={ 10,20,30,40 };
struct st aa[4]={ 50,&dt[0],60,&dt[0],60,&dt[0],60,&dt[0],};
main()
{ p=aa;
printf("%d\n",++(p->x));
}
A.10
B.11
C.51
D.60
[单选题]22.设有以下程序段
int x=0,s=0;
while(!x!=0)s+=++x;
printf("%d",s);
则()。
A.运行程序段后输出0
B.运行程序段后输出1
C.程序段中的控制表达式是非法的
D.程序段执行无限次
[单选题]有以下程序
#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