设有以下程序段 int x=0,s=O while(!x!=O) s+=++x; printf("%d",s); 则( )。
A.运行程序段后输出0
B.运行程序段后输出1
C.程序段中控制表达式是非法的
D.程序段执行无限次
A.运行程序段后输出0
B.运行程序段后输出1
C.程序段中控制表达式是非法的
D.程序段执行无限次
第1题
有以下程序: main() { int x[8]={8,7,6,5,O,0},*s; s=x+3; printf("%d\n",s[2]); } 执行后输出结果是()。
A.随机值
B.0
C.5
D.6
第2题
A.运行程序段后输出1
B.运行程序段后输出0
C.程序段执行无限次
D.程序段中的控制表达式是非法的
第3题
A.1
B.2
C.4
D.24
第4题
A.8
B.10
C.15
D.18
第5题
以下程序通过函数SunFun 求
。这里f(x) =x2+l, 由F函数实现。请填空。 main() { printf("The sum=%d\n", SunFun(10)); } SunFun(int n) { int x, s = 0; for (x = 0; x <= n; x++) S += F(______); return s; } F(int x) { return (______); }
第6题
以下程序中函数f的功能是在数组x的n个数(假定n个数互不相同)小找出最大最小数,将其中最小的数与第一个数对换,把最大的数与最后一个数对换。请填空。 include <stdio.h> void f(int x[],int n) { int p0,p1,i,j,t,m; i=j=x[0]; p0=p1=0; for(m=O;m<n;m++) { if(x[m]>i) {i=x[m]; p0=m;} else if(x[m]<j) {j=x[m];p1=m;) } t=x[p0];x[p0]=x[n-1];x[n-1]=t; t=x[pl];x[p1]=【 】;【 】=t } main() { int a[10],u; for(u=0;u<10;u++) scamp("%d",&a[u]); f(a,10); for(u=0;u<10;u++)printf("%d",a[u]); ptintf("\n"); }
第7题
第8题
A.aceg
B.abcdefg
C.abcd
D.ACEG
第9题
下面程序的运行结果:【 】。 int f(int a[], int n) { if(n>1) return a[0]+f(&a[1], n-1); else return a[o]; } main() { int aa[3]={1, 2, 3}, s; s=f(&aa[0], 3); printf("% d\n", s); }
第10题
下列程序的输出结果是______。 include<stdio.h> sb(int s[],int B) {static int n=3; b=s[n]; n--; return(B) ; } main() { int s[]={1,5,6,8}; int i,x=0; for(i=0;i<4;i++) {x=sb(s,x); printf("%d",x); } printf("\n"); }
第11题
以下程序段的输出结果是【 】。 int i =9; prinff("% o \n" ,i);