资源描述:
《上海计算机的二级考试(c语言)复习资料题目答案》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、--上海电机学院上海市计算机二级考试(C语言)复习资料题目解答第一部份:基础知识1.B2.C3.C4.B5.D6.A7.A8.C9.C10.A11.C12.A13.B15.C16.B17.D18.B19.A20.C21.C23.B24.C25.D26.B27.B28.D29.C30.C31.D32.C33.C34.B35.C36.D37.C38.B39.C40.B41.C42.B43.C44.B46.A47.D48.D49.D50.D51.A53.(Sqrt(x)+sqrt(y))/2/(x+y)orsimilar54.23455
2、.B56.D57.D58.B59.C60.D61.B62.D63.A64.D65.C70.C71.A72.A74.B75.C76.C77.C79.D80.B81.D83.C84.D85.B86.D87.B88.D89.B91.C92.B93.B94.B95.N+'0'96.0x140097.1ornot098.8599.14100.x=-60第二部分读程序,写结果1.0,2,4,32.3.1423.84.m/10%10*100+m/100*10+m%105.?uoy_era_woHHwaeyu6.7,37.546568.Athe=
3、biggestnumber,b=ismostthefraction9.110.5,511.987654321012.1357913.j=0m=4Thefirstk:4j=1m=414.Thesecondk:515.Count=0,position=0(didnotfindout)16.0-30----14.输出121422243234,函数s是用插入法对数组a的前n个元素从小到大排序15.输出23571113函数p的功能是求k(包括k)以内的质数16.输出 n=91,a[]=0,10,21,3117.输出 Feith18.输出 7
4、256384919.8181818120.k=521.122.923.用递归函数实现10->2进制转换第三部分程序改错1.#4scanf(“%d”,&x);#10low=m+1#11high=m-12.#7scanf(“%c”,&str[i]);#8break3.#7x,n#13n==0#15x*xn(x,n-1)4.#5t=t*x/i#15e=ex(x)6.#3fun(str[])#5while(*(str+num)!=’ ’)num++;#9charstr[10],*p=str;7.#14flag=0;#19flag=1;i
5、++;9.#5n=n/10;#6while(!n);#12scanf(“%ld”,&n);11.#6a=1.0;#8a/=i;#9e+=a;12.#6char*temp;#10if(strcmp(temp,name[i])>0)#12printf(“%s”,temp);13.#3str[i]!=’ ’#4str[i]>=’0’&&str[i]<=’9’#10data=data*16+n;14.#3intn1=0,n2=0,i;#6if(str[i]==’#’)#8if(str[i]>=’0’&&str[i]<=’9’)#9n
6、2++;}15.#5i=eps)#13return(2*s);19.#3longfun(char*p)#17num+=p[i]-48;或num+=p[i]-‘0’;#29printf(“%ld”,n);/*必须有%ld*/20.#9a[j]a[j]&&a[j]#18a[j]=b[k]22.#2…(char*s)#4(*
7、p)或…(*p!=0)或…(*p!=' ’)#9gets(x);23.#6t=n%10;#10n/=10;#11}while(n);或}while(n!=0);24.#4{for(j=0;j<=20-i;j++)#5printf("");#8printf("");25.#2char*fun(char*s,char*t)#4a=0;(或a=NULL;)#8if(*r==*p){r++;p++;}第四部分编程序1.设有链表结点的结构及变量如下:)structst{intnum;structst*next;};structst*h
8、ead,*p1,*p2;编写函数create(),是个无参数函数,创建链表,num=0结束,返回指针值,指向首结点head。#defineNULL0#defineLENsizeof(structst)structst{intnum;structst