


版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
浙江大學(xué)2006-2007學(xué)年夏季學(xué)開(kāi)課學(xué)院:計(jì)算機(jī)學(xué)院 考試形式:閉考試時(shí)間:2007年7月7日,所需時(shí)間:120分鐘,任課教師考生: (注意:答題內(nèi)容必須寫在答題卷上,寫在本試題卷上無(wú)效Section1:SingleChoice(2marksforeachitem,total20Inthefollowings, isthecorrectcharacter Accordingtothedeclaration:floatx=3;thevalue expressionx=(int)x/2*2is Inthefollowingoperators, hasthemosthighlevelofprecedence. Toexpresswhetherthecharactervariablechisuppercaseletter, isthecorrect Thefollowingprogramfragmentwillprintout intn=0;while(n++<=2); D.syntaxTheexpression!Eofthestatementwhile(!E);isequivalentto Inthefollowingstatements, can’tinitializethetwo-dimensionarrayacorrectly.A.inta[2][3]={0}; B.inta[][3]={{1,2},{0}};C.int D.intTojudgewhetherthecharacterstringaisthesameasb,thecorrectcodefragment if B.ifC.if D.ifGiventhefollowingdeclaritions:inta=10,b=20,*p1=&a,*p2=&b;asshowninfigure1.Ifwewanttogettheresultsasshowninfigure2,wemustchoosethecorrectassignmentstatement figure figure Accordingtothedeclaritionandstatement:inta[2][3],(*p)[3];p=a;thecorrectreferencetotheelementofarrayais Section2:Fillintheblanks(2marksforeachitem,total30Accordingtothedeclarations:intm=5;y=2;thevalueofthevariableyis aftercalculatingtheexpressiony+=y-=m*=y.Accordingtothedeclarations:inta=3,b=2,c=1;Thevalueofexpressiona>b>cis Accordingtothedeclarations:intx,y,z;Theexpressiontodescribe“twoofx,yandzarenegative”is Accordingtothedeclarations:inta=1,b=0;thevalueof ++a*--a==b?12%5:’x’ Wheninput2473<CR>fromkeyboard,thefollowingprogramwillprintout #include<stdio.h>void{intc;switch(c-‘2’)casecase1:case2:putchar(c+4);break;case3:putchar(c+3);default:putchar(c+2);break;}}Thefollowingprogramprintsout #include<stdio.h>intintf(int{staticintfor(;k<=m;k++)s++;returns;}voidmain({ints=1;printf("%d#%d#",s,}Accordingtothefunctiondeclarition:voidmain(intargc,char*argv[])inthefilelearn.c,runthecommand:learntheCprogramminglanguage,thevalueofexpression Thefollowingprogramfragmentprintsout charstr[]=”abc\0def\0ghi”,*p=str;Accordingtothedeclarations:inta[2][3]={2,4,6,8,10,12},*p=a;thevalueofexpression*(p+5)is Assumethatthetwo-dimensionarrayahasmcolumns,thenumberoftheelementsbeforea[i][j]is Thefollowingprogramfragmentprintsout swap(int*p1,int*p2){intp=p1;p1=p2;}inta=5,b=7;Theexpression istotestwhetherthe6thbitofcharactervariablechis1(Assumethatthemost-rightbitisthe1stbit).UsetypedeftodefineapointertypePAthatpointstoanone-dimensionarraywhichcontains10elementsoftypeint Forthefollowingrecursionfunctionf,thefunctioncallf(3)willreturn f(intn) return((n>0)?2*f(n-1)+f(n-2):- Forthefollowingdefinitions,thevalueofexpressionpn->b/n.a*++pn->b is struct{inta;int}}}Section3:Readeachofthefollowingprogramsandanswerquestions(5marksforeachitem,totalmarks:30)Theoutputofthefollowingprogramis #include<stdio.h>void{intintfor(i=0;i<10-n;i++){for(j=i+1;j<10-n;j++)if(a[j]==c){for(k=j;k<10-n;k++)}}for(i=0;i<(10-n);i++)}Theoutputofthefollowingprogramis #definePRIprintf#defineNL“\n”#defineD“%d”#defineD1DNL#defineD2DDNL#defineD3DDDNL#defineD4DDDDNL#defineS“%s”void{inta=1;b=2;c=3;d=4;Theoutputofthefollowingprogramis #include<stdio.h>char*c[]={"ENTER","NEW","POINT",char**cp[]={c+3,c+2,c+1,c};char***cpp=cp;{printf("%s#",**++cpp);printf("%s#",*--*++cpp);}Wheninput6<CR>fromkeyboard,theoutputofthefollowingprogramis #include<stdio.h>#includevoidfun(char*a,charb);voidmain(){chars[]=”97531”,c;}voidfun(char*a,char{}Theoutputofthefollowingprogramis #include<stdio.h>#defineNUM5voidp1(charv[]){intfor(i=1;i<NUM;for(j=i-1;j>=0&&v[j]<v[j+1];j--temp=v[j],v[j]=v[j+1],voidp2(charv1[],char{inti=0,while(i<NUM&&if(v1[i]>v2[j])putchar(v1[i++]); while(i<NUM)putchar(v1[i++]);while(j<NUM)}void{chars[2][5]={‘v’,’d’,’x’,’c’,’b’,’e’,’a’,’y’,’z’,’w’};}Therearethreetextfilesf1.txt,f2.txtandf3.txt,eachcontainsthefollowingcontents:filename ThereisanotherCsourcefileex12.cwiththefollowingcontents:#include<stdio.h>voidmain(intargc,char{FILEvoidsub(FILE*);inti=1;if((fp=fopen(argv[i++],“r”))==NULL){printf(“Cannotopenfile!\n”);}else}}voidsub(FILE{char}Aftercompilingandlinking,theexecutableprogramex12.execanbeobtained.RunthecommandlineundertheDOSprompt:ex12f1.txtf2.txtf3.txt,theoutputis Section4:Accordingtothespecification,completeeachprogram(2marksforeachblank,total:20marks)Thefollowingprogramchangesthepositiveintegernumberfromindecimaltoinhexadecimal.Fillintheblankstocompletetheprogram.#include<stdio.h>#include<string.h>voidmain(){inta,i;chars[20];voidc10_16(char*,int);printf(“Inputa:”);for(i=_(1)_;i>=0;i--)printf(“%c”,*(s+i));}c10_16(char*p,int{intj;{if(_(2)_)*p=j+’0’;else*p=j-10+’A’;_(3)}}Thefollowingprogramwillconstructalinkednodessequencewhichstorestheeverycharcterofaninputcharactersline(forexample:a,b,c,…,x,y,z)toeachnodeofthelistinreverseorder.Thatis,thecharacterinputatfirstistobestoredintothetailnodeofthechainlist(asshowninthefollowingfigure),andtobeoutputinreverseorderofinputcharacters.Thenfreeallthenodes.Fillintheblankstocompletetheprogram.ZYa…ZYa#include#definegetnode(type) _(4)_malloc(sizeof(type))voidmain(){struct{charstructnodecharc; (5){p=getnode(structnode);}{ (6) }}Thereisatextfile,whichcontainsanumber(lessthan100)ofpositivedecimalintegers一100個(gè)的十進(jìn)制正整數(shù)).Writeacommand-lineprogramprog.ctoreadinthesenumbers,counttheaveragevalueofallevennumbers(偶數(shù)),andfindoutthenumber(s)whichsumofalldigitsofeachnumber(各位數(shù)字之和)isgreaterthan10,andstoretheseresultsaboveintotheothertextfile.Requirements:taketheinputandoutputfilenamesascommand-lineparameters.Iftheoutputfilenameisomited(省略),thedefaultoutputwillbethestandardterminal.Fillintheblanks.ForThecommand-lineproginfile.txtTheinputtextfileinfile.txtcontainsthefollo
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 草房子讀后感成長(zhǎng)中的困惑與希望
- 節(jié)約用水產(chǎn)品推廣合作協(xié)議
- 數(shù)據(jù)驅(qū)動(dòng)的智能營(yíng)銷策略推廣合同
- 紅色經(jīng)典故事紅巖讀后感
- 社交電商大數(shù)據(jù)驅(qū)動(dòng)平臺(tái)
- 專利使用費(fèi)支付協(xié)議
- 桃花源記情景劇教案
- 農(nóng)業(yè)生產(chǎn)資源節(jié)約與環(huán)境保護(hù)行動(dòng)計(jì)劃
- 產(chǎn)品設(shè)計(jì)思路表格
- 高考語(yǔ)文的文言文翻譯誤區(qū)分析
- GB/T 17421.2-2023機(jī)床檢驗(yàn)通則第2部分:數(shù)控軸線的定位精度和重復(fù)定位精度的確定
- 重慶市渝北區(qū)大灣鎮(zhèn)招錄村綜合服務(wù)專干模擬預(yù)測(cè)(共500題)筆試參考題庫(kù)+答案詳解
- 矢量分析和場(chǎng)論基礎(chǔ)
- 進(jìn)步粘滯流體阻尼器埋件的一次驗(yàn)收合格率
- 小升初面試英語(yǔ)自我介紹范文4篇
- 高職院校創(chuàng)新創(chuàng)業(yè)教育數(shù)字化轉(zhuǎn)型和改革研究
- 酒店住宿水單模板-可修改
- 合作公司變更函范文(必備6篇)
- 全國(guó)2017年10月自考00043經(jīng)濟(jì)法概論(財(cái)經(jīng)類)試題及答案
- 2023年山東力明科技職業(yè)學(xué)院?jiǎn)握忻嬖嚹M試題及答案解析
- 少兒美術(shù)繪本教案課件-3-6歲 《100層巴士》
評(píng)論
0/150
提交評(píng)論