2002B试卷E.pdf
《2002B试卷E.pdf》由会员分享,可在线阅读,更多相关《2002B试卷E.pdf(8页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、C ProgrammingC ProgrammingTEST PAPERTEST PAPERTime: 8:30-10:30 am. June 20, 2003Important note: your answers must be written on the answer sheetImportant note: your answers must be written on the answer sheetSection 1: Single ChoiceSection 1: Single Choice(1 mark for each item, total 10 marks1 mark
2、for each item, total 10 marks)1.The precedence of operator_is the lowest one.A0|y0)is equivalent to_.A !(x0)&!(y0)B!x0&!y0C!x0|!y0D!(x0)|!(y0)4.The value of expression _ isnt 0。A1/2B!0C!EOFDNULL5.If x is a float variable,the value of expression (x=10/4) is _ 。A2.5B2.0C3D26.If variables are defined a
3、nd assigned correctly, the expression _ is wrong.Aa&bBabC&xDa, b7.According to the declaration: int a10, *p=a; the expression _ is wrong.Aa9Bp5C*p+Da+8._ is wrong.Achar str10; str=string;Bchar str =string;Cchar *p=string;Dchar *p; p=string;9.If all variables have been defined and declared in the fol
4、lowing program, all the variableswhich can be used in function fun() are _.#include void fun(int x)static int y;return;int z;void main( )int a,b;fun(a);Ax, yBx, y, zC a,b,y,zDa,b,x,y,z10. According to the declaration: int p5, *a5; the expression _ is correct.Ap=aBp0=aC*(a+1)=pDa0=2C ProgrammingTEST
5、PAPER, June 20, 20031 /8Section 2: Fill in the blanksSection 2: Fill in the blanks(2 mark for each item, total 30 marks2 mark for each item, total 30 marks)1.According to the declaration: int a234,the number of elements of array a is _.2.Writing conditional expression_ to calculate the value of y.1x
6、0y=0 x=0-1x03.The value of expression1105is _.4.The value of expression(101)&4is_.5.The value of expressionsizeof(“hello”)is_.6.The output of the following statements is _.int k, s;for(k=1, s=0; k10; k+)if (k%2=0) continue;s += k;printf(k=%d s=%d, k, s);7.The output of the following statements is _.
7、#define MM(x,y)(x*y)printf(%d, MM(2+3,15);8.The output of the following statements is _.int k=1, s=0;switch (k) case 1: s+=10;case 2: s+=20; break;default: s+=3;printf(k=%d s=%d, k, s);9.The output of the following program is _.# include int f( )static int k;return +k;void main( )int k;for(k=0;k3;k+
8、)printf(%d#, f( );10. The output of the following program is _.f (int x)C ProgrammingTEST PAPER, June 20, 20032 /8if(x=1) return 1;else return f(x-1)+f(x-2);void main( )printf(%d, f(4);11. The output of the following statements is _.int k=1, j=2, *p, *q, *t;p=&k; q=&j;t=p; p=q; q=t;printf(%d, %d,*p,
9、 k);12. The output of the following statements is _.int c =10, 30, 5;int *pc;for(pc=c; pcc+2; pc+)printf(%d#, *pc);13. The output of the following statements is _.char*st =ONE,TWO,FOUR,K;printf(%s, %cn, *(st+2), *st+1);14. The output of the following program is _.#include void p(int *x,int y)+ *x;y=
10、y+2;void main()int x=0, y=3;p(&y, y);printf(%d, %d, x, y);15. Writing the declaration_ with typedef, which makes CP a synonym for a characterpointer array, 10 elements.Section 3: Read each of the following programs and answer questions (5 marks for eachSection 3: Read each of the following programs
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2002 试卷
限制150内