2022年上海市计算机二级考试复习资料题目答案.docx





《2022年上海市计算机二级考试复习资料题目答案.docx》由会员分享,可在线阅读,更多相关《2022年上海市计算机二级考试复习资料题目答案.docx(46页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、名师归纳总结 精品学习资料 - - - - - - - - - - - - - - -上海理工高校上海市运算机二级考试 第一部份:基础学问C 语言 复习资料题目 解答1. B 2. C 3. C 4. B 5. D 6. A 7. A 8. C 9. C 10. A 11. C 12. A 13. B 14. B 15. C 16. B 17. D 18.B 19. A 20. C 21. C 22. B 23. B 24. C 25. D 26. B 27. B 28. D 29. C 30. C 31. D 32. C 33. C 34. B 35. C 36. D 37. C 38. B
2、 39. C 40. B 41. C 42. B 43. C 44. B 45. B 46. A 47. D 48. D 49. D 50. D 51. A 52. C 53. Sqrt x+ sqrt y/2/ x+ y or similar 54. The 234 is namely the string234 55. B 56.D 57.D 58. B 59. C 60.D 61.B 62. D 63.A 64.D 65.C 66.B 67.C 68. D 69. C 70.C 71.A 72.A 73.B 74.B 75.C 76. C 77.C 78.A 79.D 80.B 81.D
3、 82.D 83.C 84.D 85.B 86.D 87.B 88.D 89.B 90.C 91.C 92.B 93.B 94.B 95. N+0 96. 0The x1400 moves is ex-, binary system 00010100 Bs or eight enter the 024 Qs of system 97. The first answer 65 ds or 41 hses or a the second answer 1 or not0 98. 85 99. 14 100. x=-60 其次部分 读程序 ,写结果1. 0,2,4,3 2. 3.142 3. 8 4
4、. m/10%10*100+m/100*10+m%10 5. .uoy_era_woHHwaeyu 6. 7,3 7. 54656 8. A the = biggest number, b= is most the fraction 9. 1 10. 5,5 11. 9876543210 12. 1 3 5 7 9 13. j=0 m=4 The first k : 4 j=1 m=4 14. The second k : 5 15. Count=0, position=0 did not find out 细心整理归纳 精选学习资料 - - - - - - - - - - - - - - -
5、 第 1 页,共 23 页 - - - - - - - - - 名师归纳总结 精品学习资料 - - - - - - - - - - - - - - -16. 0 -30 17. 输出 12 14 22 24 32 34,函数 s 是用插入法对数组 a 的前 n 个元素从小到大排序18. 输出 2 3 5 7 11 13 函数 p 的功能是求 k(包括 k )以内的质数 19. 输出 n=91, a=0, 10, 21, 31 20. 输出 Feith 21. 输出 72 56 38 4922. 81818181 23. k=5 24. 1 25. 9 26. 用递归函数实现 10-2 进制转换
6、第三部分 程序改错1. #4 scanf“ %d” ,&x; #10 low=m+1 #11 high=m-1 2.#7 scanf“ %c” ,&stri; #8 break 3. #7 x , n #13 n=0 #15 x*xnx,n-1 4. #5 t=t*x/i #15 e=exx 5. #4 scanf%d” ,&x; #10 low=m+1 #11 high=m-1 6. #3 funstr #5 while *str+num.=0 num+;#9 char str10,*p=str; 7. #14 flag=0 ; #19 flag=1; i+; 8. #3 funcstr #
7、5 while *str+num.=0 num+; #9 char str10,*p=str; 9. #5 n=n/10; #6 while .n; #12 scanf“ %ld” ,&n; 10. #10 else if xam low=m+1; #11 else high=m-1; 11. #6 a=1.0; #8 a/=i; #9 e+=a; 12. #6 char *temp; #10 ifstrcmptemp,namei0 #12 printf“ %s n” , temp ; 9 第 2 页,共 23 页 13. #3 stri.=0 & stri= 0细心整理归纳 精选学习资料 -
8、 - - - - - - - - - - - - - - - - - - - - - - - 名师归纳总结 精品学习资料 - - - - - - - - - - - - - - -#10 data = data*16 + n; 14. #3 int n1=0,n2=0, i; #6 if stri= #9#8 if stri=0&stri=#9 n2+; 15. #5 i=eps #13 return 2*s; 19. #3 long funchar *p #17 num+=pi-48; 或 num+=pi-0; #29 printf“ %l n” ,n; /* 必需有 %ld */ 20.
9、#9 ajaj&aj #18 aj=bk 21. #2 void printcolint *pN, int row, int col #6 printf“ tt%dn”,*p+i+col; #14 while colN-1; 22. #2 char *s 或 *p.=0 #4 *p 或 *p.=0 #9 getsx; 23. #6 t=n%10; #10 n/=10; #11 whilen; 或 while n.=0; 24. #4 for j=0;jnum,&p1-score; head=NULL; while p1-num.=0 n=n+1; if n=1 head=p1; else p2
10、-next=p1; p2=p1; p1=struct st *mallocLEN; scanf%u,%d,&p1-num,&p1-score; p2-next=NULL; return head; 2. 对 N个数据 , 降序排列并输出 #define N 10 main int aN=1,5,0,3,-6,9,-8,7,2,4; int i,j,t; for i=0;iN-1;i+ for j=i;jN;j+ if aiaj t=ai; ai=aj;aj=t; for i=0;iN;i+ printf%3d,ai; 3. 有二维数组如下1 2 3 4 5 6 7 8 9 10 11 12 现
11、要求输入某元素所在的行和列,将其后的全部元素输出,必需用指针技术编程;例如,输入2 , 3 表示从其次行第三列元素7 开头输出其余元素7 8 9 10 11 12 main int a34=1,2,3,4,5,6,7,8,9,10,11,12; int *p,i,j; scanf%d%d,&i,&j; p=&ai-1j-1; for ;p&a00+12;p+ printf%5d,*p; 4. 将一个磁盘文件的数据读到一个链表中去,队列或堆栈不论;要求如下:细心整理归纳 精选学习资料 磁盘文件放在A 盘的一级目录(即一级子文件夹)abc下,文件名是flile.dat 第 4 页,共 23 页 -
12、 - - - - - - - - - - - - - - - - - - - - - - - 名师归纳总结 精品学习资料 - - - - - - - - - - - - - - -链表结点的结构为 struct node char val; strct node *next; 工作用的指针名为 #include h 和 p #include struct node char val; struct node *next; ; struct node *createFILE *fp struct node *p,*h; char d; h=NULL; fp=fopena:abcfile.dat,
13、r; while .feoffp fread&d,2,1,fp; p=struct node *mallocsizeofstruct node; p-val=d; p-next=h; h=p; fclosefp; printfn; printlkh; return h; printlkstruct node *h struct node *p; printfprint link.n; p=h; while p printf%c,p-val; p=p-next; main struct node *h,*p; FILE *fp; fp=fopenrd_data,r; if fp=NULL pri
14、ntfread data error.n; exit0; h=createfp; printlkh; exit0; 5. 试写一个函数 函数名为 f ,以十进制正整数n 为整型参数,函数的返回值是n 的位数(例: 第 5 页,共 23 页 278 是三位数);要求循环结构需用do_while掌握结构;细心整理归纳 精选学习资料 - - - - - - - - - - - - - - - - - - - - - - - - 名师归纳总结 精品学习资料 - - - - - - - - - - - - - - -int flong n int c=0; do c+; n=n/10; while n;
15、 return c; main long n; int num; scanf%ld,&n; num=fn; printf%ld has %d numbersn,n,num; 6将一个 n n 的矩阵行列转置后输出,转置功能由函数reverse实现,试编程;#define N 3 void reversefloat xN,int n int i,j; float t; for i=0;in;i+ for j=i;jn;j+ t=xij; xij=xji; xji=t; void prtablefloat xN,int n int i,j; for i=0;in;i+ for j=0;jn;j+
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022 上海市 计算机 二级 考试 复习资料 题目 答案

限制150内