2、io.h>intmain(){intG=5,k;voidprt_char();...k=prt_char(G);...}A.语句voidprt_char();有错,它是函数调用语句,不能用void说明B.变量名不能使用大写字母C.函数说明和函数调用语句之间有矛盾D.函数名不能使用下划线4.以下程序的运行结果是。#includeintfun(inta,intb){if(a>b)return(a+b);elsereturn(a-b);}intmain(){intx=3,y=8,z=6,r;r=fun(fun(x,y),2*z);printf("%d
3、n",r);return0;}A.-16B.-17C.17D.165.以下程序的功能是计算函数F(x,y,z)=(x+y)/(x-y)+(z+y)/(z-y)的值,请选择填空。#include#includefloatf(float,float);intmain(){floatx,y,z,sum;scanf("%f%f%f",&x,&y,&z);sum=f()+f();printf("sum=%f",sum);return0;}floatf(floata,floatb){floatvalue;value=a/b;returnv
4、alue;}A.x-y,x+yB.x+y,x-yC.z+y,z-yD.z-y,z+yA.x-y,x+yB.x+y,x-yC.z+y,z-yD.z-y,z+y6.以下程序可选出能被3整除且至少有一位是5的两位数,打印出所有这样的数及其个数。请选择填空。#includeintsub(intk,inth){inta1,a2;a2=;a1=k-;if((k%3==0&&a2==5)
5、
6、(k%3==0&&a1==5)){printf("%5d",k);h++;returnh;}elsereturn-1;}intmain(){intn=0,k,m;for(k
7、=10;k<=99;k++){m=sub(k,n);if(m!=-1)n=m;}printf("n=%d",n);return0;}A.k*10B.k%10C.k/10D.k*10%10A.a2*10B.a2C.a2/10D.a2%107.若用数组名作为函数调用的实参,则传递给形参的是。A.数组的首地址B.数组的第一个元素的值C.数组中全部元素的值D.数组元素的个数8.折半查找法的思路是:先确定待查元素的范围,将其分成两半,然后测试位于中间点元素的值。如果该待查元素的值大于中间点元素,就缩小待查范围,只测试中间点之后的元素;反之,测试中间点之前的元素,测试
8、方法同前。函数binary的作用是应用折半查找法从存有10个有序整数的a数组中对关键字m进行查找,若找到,返回其下标值;反之,返回-1。请选择填空。#includeintbinary(inta[10],intm){intlow=0,high=9,mid;while(low<=high){mid=(low+high)/2;if(ma[mid]);elsereturn(mid);}return-1;}intmain(){inta[10]={1,2,3,4,5,6,7,8,9,10};intm,index;scanf
9、("%d",m);index=binary(a,m);printf("%d",index);return0;}A.high=mid-1B.low=mid+1C.high=mid+1D.low=mid-1A.high=mid-1B.low=mid+1C.high=mid+1D.low=mid-19.以下程序的运行结果是。#includevoidfun(intx){if(x/2>0)fun(x/2-2);printf("%d",x);}intmain(){fun(20);printf("");return0;}A.2082-1B.2820C.
10、8D.-1