大学计算机系研究生入学考试试题001.docxVIP

  • 7
  • 0
  • 约3.03千字
  • 约 4页
  • 2021-02-08 发布于北京
  • 举报

大学计算机系研究生入学考试试题001.docx

个人资料整理,仅供个人学习使用 个人资料整理,仅供个人学习使用 PAGE PAGE # / 4 个人资料整理,仅供个人学习使用 个人资料整理,仅供个人学习使用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 PAGE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 PAGE # / 4 浙江大学2000年计算机系研究生入学考试试题 考试科目:计算机科学基础 一、根据下列各题要求填空 1 语句:讥価 5[]- ignidiwlc : printf( “ %s%d ,s+2,sizeqf(将输出: A) graduate 10 B)graduate 11 (C)raduate 10 D) raduate 11 矚慫润厲钐瘗睞枥庑赖賃 軔。 2对于int i, j,表达式l!j等价于: A) !(!i||j) B)!(!i j) C)! (Ij) D)i*!j 3下列程序段执行后 s值为: int I=1, s=0 do {if(!(i%2)) continue; s+=i;} while(++i10); A) 1 B)45 C)25 D)以上均不是 4执行下列语句后,a的值为: int a; #define M(x,y) (x/y) a=M(4+2,3); A) 2 B) 4 C) 5 D)以上均不是 5 对于: struct node { char s[10]; int i; }p[4]; 下列哪个赋值是不正确的: A)p[0].i=2 B)p[0].s= “ abc C)p-i=2 D)*(p- s)=聞創沟燴鐺險爱氇谴净祸測。 6、执行完下列语句段后,i值为: int f(int x) { return ((x0)?x*f(x-1):2);} int i; i=f(f(1)); A)2 B)4 C)8 D)无限递归 7下面的C代码段用于计算 s=x-x2/2+x3/3-X4/4+X5/5 ?的近似值,请填空: in t i=1; double t,s; t=x; s=t; while (fabs(t0.00001){ /*fabs(t):t 的绝对值 */ i=i+1; t=t* s+=t; } 8执行完下列语句段后,i值为: int f(int x) { static int k=0; x+=K++; return x; } int i; i=f(2)*f(2); 二阅读下列程序并回答相应问题 #in elude stdio.h int a[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}}; main () { int s, i; for(s=0, i=0;i3;i++) s+=*(a[i]+3-i); printf( “ %d” for(s=0, i=0; I3; i++) s+=*(*a=3-i); printf( “ %d ,s); } 问题:上述程序运行后,将输出。 #i nclude stdio.h #defin e f(x) ((x)*(x)-1) #define NEAR 1.0e-5 int g(float low, float upp, float * result) { float mid; if (f(low)*f(upp)=0||low?=upp) return 0;残骛楼諍锩瀨濟溆塹籟婭骤。 while (upp-lowNEAR) { mid=(low+upp)/2; if(f(upp)*f(mid)0) low=mid; else if (f(low)*f(mid)0) upp=mid; else break; } *result=mid; return 1; } main () { float *s; if(3(0.3^) prinif( %f n :#s); } 问题:函数int g(float low, float upp, float 8result)的功能是什么?请估计该程序的输出结果是 什么?酽锕极額閉镇桧猪訣锥顧荭。 三请用C编写一个用于对文本文件中的连续字符个数进行统计(即记录连续出现的字符个 数,格式:个数-字符,)的程序count.c.,运行方式为count fromfile tofile。如:当文本文件s.txt 内容为 “aaaabcccdd时,运行 count s.txt t.tx 后,文件文件 t.tx 的内容为 “4,1-b,3-c,2-d , ”。 请在程序中加必要的注释(12分)。彈贸摄尔霁毙攬砖卤庑诒尔。 四证明任一点个数为 n的二叉树的高度至少为 O(log n)。 五采秀顺序存储结构的二叉树。如下: 謀荞抟箧飆鐸怼类蒋薔點鉍

文档评论(0)

1亿VIP精品文档

相关文档