下面程序的输出结果是() main() {int a〔 〕={1,2,3},s,b,*p; S=l: P=a: for(b=0;b<3.b++) s*=*(p+b); printf(”s=%d\n”,s);}
第1题:
下面程序的功能是输出数组s中最大元素的下标,请填空。
main()
{ int k, p,s[]={1, -9, 7, 2, -10, 3};
for(p =0, k =p; p< 6; p++)
if(s[p]>s[k])【13】
printf("%d\n", k);
}
第2题:
下面程序的功能是输出数组s中最小元素,请填空。
include<iostream.h>
void main(){
int k, p, s[]={1,-9,7,2,-10,3};
k=s[0];
for(p=0;p<6;p++)
if(s[p]<k) 【 】;
cout<<k;
}
第3题:
设有如下程序: fun(float*p1,int n,float*p2,int m,float*s) {int i; *s=0.0; for(i=0;i<n;i++)*s+=*p1++; for(i=0;i<m;i++)*s+=*p2++; } main() { float a[]={1.1,2.2},b[]={1.0,2.0,3.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是______。
A.8.2
B.9.3
C.3.3
D.1.1
第4题:
以下程序运行后,输出结果为______。 main() { int a[2][3]={1,3,5,7,9,11},*s[2],**pp,*p: s[0]=a[0],s[1]=a[1]; pp=s; p=(int*)malloc(sizeof(int)); **pp=s[1][1]; p=*pp; printf("%d\n",*p); }
A.1
B.7
C.9
D.11
第5题:
以下程序运行后的输出结果是【 】。
struct NODE
{int num;struct NODE *next;
};
main()
{struct NODE s[3]={{1,'\0'},{2,'\0'},{3,'0'}},*p,*q,*r;
int sum=0;
s[0].next=s+1;s[1].next=s+2;s[2].next=s;
p=s; q=p->next; r=q->next;
sum+=q->next->num; sum+=r->next->next->num;
printf("%d\n",sum);
}

第6题:
下面程序的输出结果是______。 #include<string.h> main() { char*p1="abc",*p2="ABC",s[20]="xyz"; strcpy(s+1,p2); strcat(s+2,p1); printf("%s\n",s); }
A.xABCabc
B.zABCabc
C.yzabcABC
D.xyzABCabc
第7题:
有以下程序 #include<stdio.h> void fun(float * p1,int n1,float,*p2,int n2,float * s) { int i; s=(float *)calloc(1,sizeof(float)); *s=0; for(i=0;i<n1;i++) *s+=*p1++; for(i=0;i<n2;i++) *s+=*p2++; } main() { float a[2]={1.1,2.2},b[3]={10.0,20.0,30.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是( )
A.60
B.3.3
C.63.3
D.1.1
第8题:
下面程序运行后的输出结果是______。 struct abc { int a,b,c; } main() { struct abc s [2]={{1,2,3},{4,5,6}}; int t=-s[0].a+s[1].b; printf("%d\n",t); }
A.5
B.6
C.7
D.8
第9题:
下面程序的输出是______。 fun(char *s,int p1,int p2) { char c; while(p1<p2) { c=s[p1];s[p1]=s[p2];s[p2]=c;p1++;p2--;} } main() { char a[]="ABCDEFG",k,*p; fun(a,0,2);fun(a,4,6); printf("%s\n ",a); }
A.ABCDEFG
B.DEFGABC
C.GFEDCBA
D.CBADGFE
第10题:
以下程序运行后,输出结果是( ) #include<stdio.h> ss(char *s) { char*p=s; while(*p) p++ return(p-s); } main() { char *a="abded" int i; i=ss(a) ; printf("%d\n",i); }
A.8
B.7
C.6
D.5
第11题:
以下程序运行后的输出结果是______。 ss(char*s) { char*p=s; while(*p)p++; return(p-s); } main() { char*a="abded";int i; i=ss(a); printf("%d\n",i); }
A.8
B.7
C.6
D.5
第12题:
ABCDEFGHIJKLMNOP
ABCDEFGHHKL
ABCD
AEIM
第13题:
有以下程序 main( ) { char *s[ ]={"one","two","three"},*p; p=s[1]; printf("%c,%s\n",*(p+1),s[0]); } 执行后输出结果是
A.n,two
B.t,one
C.w,one
D.o,two
第14题:
下列程序的输出结果是______。# include<stdio.h>f(char 8s){ char *p=s; while(*p!='\0')p++; return(p-s);}main(){ printf("%d\n",f("ABCDEF"));}
A.3
B.6
C.8
D.0
第15题:
下列程序的输出结果是( )。 #include <stdio.h> struct abc { int a, b, c, s;}; main() { struct abc s[2]={{1,2,3},{4,5,6}}; int t; t=s[0].a+s[1].b; printf("%d\n",t); }
A.5
B.6
C.7
D.8
第16题:
以下程序的输出结果是main(){ char s[]="abcdef"; s[3]=’\0’; printf("%s\n",s);}
第17题:
下面程序的运行结果是( )。 include<stdio.h> main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m<=4){n=n*a;s=s+n;++m;} printf("s=%d",s); }
第18题:
请读程序: # include<stdio.h> f(char * s) {cahr * p=s; while(* p!='\0')p++; return(p-s); } main() {printf("%d\n”,f("ABCDEF"));} 上面程序的输出结果是 ( )
A.3
B.6
C.8
D.0
第19题:
下面程序的功能是输出数组s中最大元素的下标,请填空。main(){ int k, p,s[]={1, -9, 7, 2, -10, 3}; for(p =0, k =p; p< 6; p++) if(s[p]>s[k]) ; printf("%d\n", k);}
第20题:
下列程序中,正确的为______。
A.main() { int *pb=&b; float 1>=15.25; print f("%d\n" ,*pb); }
B.amin() { int a,*pa; a=10; *pa=a; prinffC%d",*pa); }
C.main() { char s[20]; char *ps=&s; scanf("%s",*p); printf("%s",*p); }
D.main() { char str[10]; int *ps=str[0]; str="abcdefg"; printf("%s",*p); }
第21题:
下面程序的输出结果是( )。 char s()="ABCD",*p; main() { for(p=s;p<s+4;p++)printf("%s\n",p); )
A.ABCD BCD CD D
B.A B C D
C.D C B A
D.ABCD ABC AB A
第22题:
n-1;i++)fo
有以下程序: struct S{int n;int a[20];}; void f(struct S*P) { int i,j,t; for(i=0;i<P->n-1;i++) for(j=j+1;j<P->n-1;j++) if(p->a[i]>p->a[j]) {t=P->a[i];p->a[i]=P->a[j];p->a[j]=t} } main() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。
A.3
B.4
C.5
D.6
第23题:
s=l
s=2
s=3
s=6