版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
浙江大学2005-2006学年冬季开课学院:计算机学院,考试时间:2006年1月11日,所需时间:120分钟,任课教师考生: (注意:答题内容必须写在答题卷上,写在本试题卷上无效Section1:SingleChoice(2markforeachitem,total20Ifxisafloat thevalueofexpression(x=7/2,x+1)is Thevalueof Thestatement iscorrectifaisanintegervariableandbisadoubleprecisionfloatvariable.scanf(“%d,%f”,&a, B.scanf(“a=%db=%*f”,&a,C.scanf(“%d%*lf”,&a, D.scanf(“%d%*lf”,&aThevalueofexpression strcmp(“internet”,“intranet”) The isequivalent Ifvariablesaredefined, thevalueofexpression isnot1. Ifvariablesaredefinedandassignedcorrectly, theexpression iswrong. Thefollowingcodefragmentprintsout inti=5;while(i--if(i%2)printf("*");elsecontinue;} D.Withregardtothefollowingdefinition:struct{intchar} operator++intheexpression*p++->strisappliedon B.pointerpC.thecontentwhichppoints D.NoneoftheAmongthefollowingstatements, isthemostcorrectstatement.char*p,str[]=“ strcpy(p, Section2:Fillintheblanks(2markforeachitem,total30Ifchisanuppercasecharacter theexpressioncanbewrittenas accordingtothechangingrule:’A’->’Z’,’B’->’Y’,’C’-Thevalueof Thefollowingcodefragmentprintsout printf("%o\n",(010<<1^1)&(0xe<<1));Writeaconditionalexpression tocalculatethevalueofy. - Thefollowingcodefragmentprintsout #defineFB(a,b) intk=3;Afterrunningthefollowingcodefragment,thevalueofais inta=-1,x=10,y=20,ok1=5,ok2=0;if(ok2)Thefollowingcodefragmentprintsout inti,j,k=0;for(i=0,j=10;i<=j;i++,j--)printf("%d,%d,%d",Thefollowingcodefragmentprintsout intk=2,a=1;while(k--!=-1)do}while(k--}Thefollowingcodefragmentprintsout intx=1,y=0,a=0,b=0;switch(x)caseswitch(y)case0:a++;break;case1:b++;}casea++;b++;}Writingthedeclarationwithtypedef,whichmakesNAMEasynonymforacharacterpointerarray,20elements Withthecodefragmentbellow,functioncallf(3),thereturnvalueis f(intn) return((n>0)?f(n-1)+2*f(n-2) Theoutputofthefollowingprogramis #include<stdio.h>int staticintk=0;return}void int printf(“%d”,}Theoutputofthefollowingprogramis #include<stdio.h>{intints(int,int*);}ints(inta,int{intm=*b-=a;returnm;}Inthefollowingcommand-lineprogramrun.c,theoutputafterrunning“run–abc–nlsworld” #include<stdio.h>main(intagrc,char*argv[]){}Afterexecutingthefollowingblock,thevalueofvariableiis staticinta[3][4]={{1,2,3},{4,5,6}},i;i=a[2][-2]+Section3:Readeachofthefollowingprogramsandanswerquestions(5marksforeachitem,totalmarks:30)Theoutputofthefollowingprogramis #include<stdio.h>void{intx,y=-if((z=y)<0)x=4;elseif(y==0)x=5;elsex=6;}Theoutputofthefollowingprogramis #include<stdio.h>intx,y,z;voidp(intx,int int}void x=y=p(y,&x);}Theoutputofthefollowingprogramis #include<stdio.h>voidmain( charch,*s="ACEDB";intx;while(*s!=f(*s++,&x);printf("%d#",x);}}intf(charch,int{*x=0;switch(ch)case'A':*x=95;break;case'B':*x=85;break;case'C':*x=75;break;case'D':*x=60;}}Theoutputofthefollowingprogramis #include<stdio.h>void voiddiv(int*,inta[5]={-1,0,60,45,34},i=0,j=while(a[i]<=0) while(a[i]!=1) div(a+i,&j);}voiddiv(int*n,int if(*n%*k==0)*n/=}else}Theoutputofthefollowingprogramis #include<stdio.h>intf(inta[],int intcur,final,j;for(j=0;j<n;j++){cur+=if(cur>final) final=cur;elseif(cur<0)cur=0;}return}void{ printf(“%d\n”,f(a,}Theoutputofthefollowingprogramis #include<stdio.h>intf(intn,int intn1,m1,result=0;if(n&&m){if(n1==m1)result=f(n/10,elseresult=f(n/10,m/10)*10+((n1>m1)?n1:m1);returnresult; elsereturn}void{}Section4:Accordingtothespecification,completeeachprogram(2markforeachblank,total:20marks)Thefollowingprogramistocalculatethesumofthefirstnitemsofthesequenceas1/2, #include<stdio.h> floatx,y,t,sum=0;inti,n;scanf("%d", ;i++){sum+=x/y; }printf("%f",}Thereisanincreasingorderedcharacterlistinatextfilefile1.Thefollowingprogramreadinthislistcalculatethenumberofduplicates(重复andwriteeachcharacteranditsfrequencyofoccurrence1)(1的出现次数)intothefilefile2.Forexample,ifthefile1containslist“abbcdddeffg”,thelist“ab2cd3ef2g”willbewrittenintofile2.#include<stdio.h> FILE*fp1,*fp2;charlast,c;intif( )exit(0);while( ){if(c!=last)if(count>1) }}}Thereisasimplechaininglisth(maybeNULL).Thefollowingtwofunctions:voidpush(inttoinsertthenintotheheadofthelist,an
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 胸大肌形态与肌肉疲劳研究
- 2025-2030智慧农业设备市场发展趋势深度分析及提高产量与投资价值研究
- 2025-2030智慧农业科技市场供需现状与发展投资评估规划分析研究报告
- 2025-2030智慧农业技术行业市场供需分析及农业投资发展评估规划报告
- 2025-2030智慧公路行业市场技术发展趋势及交通管理智能化升级方案报告
- 刘秀祥先进事迹(资料15篇)
- 2026年设备维护与腐蚀防护的结合
- 渔区光伏发电效率提升方案
- 污水管网修复完善工程可行性研究报告
- 2026年城市无线网络建设对智慧城市的影响
- DB15∕T 4266-2026 防沙治沙工程建设成效评价技术规程
- 重庆市康德2026届高三高考模拟调研卷(三)英语试卷(含答案详解)
- 电梯文明施工方案(3篇)
- 2026年警示教育活动计划
- 2026年山西经贸职业学院单招职业适应性测试题库附参考答案详解(综合题)
- 统编版二年级语文下册1 神州谣 课件
- 4.1权利与义务相统一 课件 (共28张)
- 60岁以上用工免责协议书模板
- 龙门吊基础施工工艺方案
- DB11∕T 2408.1-2025 城市管理大数据平台 第1部分:架构及接口规范
- 2025年心内科面试题库大全答案
评论
0/150
提交评论