2008春浙江省二级考试试卷.doc

上传人:罗晋 文档编号:8934817 上传时间:2021-01-25 格式:DOC 页数:6 大小:50KB
返回 下载 相关 举报
2008春浙江省二级考试试卷.doc_第1页
第1页 / 共6页
2008春浙江省二级考试试卷.doc_第2页
第2页 / 共6页
2008春浙江省二级考试试卷.doc_第3页
第3页 / 共6页
2008春浙江省二级考试试卷.doc_第4页
第4页 / 共6页
2008春浙江省二级考试试卷.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《2008春浙江省二级考试试卷.doc》由会员分享,可在线阅读,更多相关《2008春浙江省二级考试试卷.doc(6页珍藏版)》请在三一文库上搜索。

1、2008年春浙江省高等学校计算机等级考试试卷(二级C)说明:(1) 考生应将所有试题的答案填写在答卷上。其中试题1到试题6请在答卷上各小题正确选项的对应位置处填“”;(2) 请将你的准考证号的后五位填写在答卷右下角的指定位置内;(3) 考试时间为90分钟。试题1(每小题3分,共12分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】输入1个正整数n(n=2),输出菲波那契(Fibonacci)序列的前n项,每行输出6个数。菲波那契(Fibonacci)序列:1,1,2,3,5,8,13,数列的前两个数都是1,从第三个数开始,每个数是前两个数之和。运行示例:E

2、nter n:10 1 1 2 3 5 813 21 34 55【程序】#include main( )int count, i, n, x1, x2, x;printf(”Enter n:”);scanf(”%d”,&n);x1 = x2 = 1;printf(”%6d%6d”,x1, x2); (1) ; for(i = 1; i = n-2; i+) (2) ; printf(”%6d”, x);count+;if( (3) )printf(”n”);x1 = x2; (4) ;【供选择的答案】(1)A、count = 2B、count = 0C、count = 1D、count = -

3、1(2) A、x = x1 x2B、x = x1 + x2 C、x = x1D、x = 2(3) A、count / 6 = 0B、count % 6 != 0 C、count % 6 = 0D、count / 6 != 0 (4) A、x = x1 +x2 B、x2 = x1C、x = x2 D、x2 = x试题2(每小题3分,共12分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】输入2个正整数m和n(1=mn=500),统计并输出m和n之间的素数个数以及这些素数的和。要求定义和调用函数prime(m)判断m是否为素数,当m为素数时返回1,否则返回0。

4、素数就是只能被1和自身整除的正整数,1不是素数,2是素数。 运行示例:Enter m, n: 1 10count = 4, sum = 17【程序】#include #include int prime(int m) int i, n; if(m = 1) return (5) ;n = sqrt(m); for(i = 2; i = n; i+) if(m % i = 0) return (6) ;return (7) ;main()int count = 0, i, m, n, sum = 0;printf(”Enter m, n:”);scanf(”%d%d”,&m, &n);for(i

5、 = m; i = n; i+)if( (8) )sum += i;count+; printf(count=%d, sum=%dn, count, sum); 【供选择的答案】(5) A、1 B、mC、m = 1 D、0(6) A、m B、1 C、0 D、n(7) A、m B、1 C、0 D、i = n(8) A、prime(i) != 0 B、prime(i) = 0 C、i = prime(i) D、!prime(i)试题3(每小题3分,共12分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】输入一个2 * 3的二维数组,找到最大值以及它的行下标和列

6、下标,并输出该矩阵。运行示例:Enter a array(2*3):3 2 10 -9 6 -1max = a02 = 103 2 10 -9 6 -1【程序】#include main( ) int col, i, j, row;int a23;printf(Enter array(2*3):); for(i = 0; i 2; i+)for(j = 0; j 3; j+)scanf(%d, (9) ); (10) ;for(i = 0; i 2; i+)for(j = 0; j arowcol) (11) ;printf(”max = a%d%d = %dn”, row, col, aro

7、wcol);for(i = 0; i 2; i+)for(j = 0; j 3; j+)printf(”%4d”, aij); (12) 【供选择的答案】(9) A、&aijB、&aji C、aijD、aji(10) A、row = col = 2;B、row = col = 0; C、arowcol = 0; D、arowcol = -1;(11) A、row = j; col = i;B、arowcol = aij; C、row = i; col = j;D、arowcol = aji;(12)A、printf(”n”);B、printf(”n”); C、; D、printf(”n”);试

8、题4(每小题3分,共12分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】#include main() int op1, op2, res; char operator;scanf(”%d”, &op1);operator = getchar();while(operator != =)scanf(”%d”, &op2);switch(operator)case +: res = op1+op2; break;case -: res = op1-op2; break;case *: res = op1*op2; break;case /: res = op1

9、/op2; break;default: res = 0;op1 = res;operator = getchar();printf(”%dn”, res);(13) 程序运行时,输入2*3-2=,输出 (13) 。 A、6B、2C、0 D、4(14) 程序运行时,输入15+2/3=,输出 (14) 。 A、16B、15C、6 D、5(15) 程序运行时,输入1+2*10-10/2=,输出 (15) 。 A、10B、16C、15 D、25(16) 程序运行时,输入1+3*5/2-7=,输出 (16) 。 A、3B、1C、-2 D、-3试题5(每小题3分,共12分)阅读下列程序并回答问题,在每小

10、题提供的若干可选答案中,挑选一个正确答案。【程序】#include #define MAXLEN 80main () int k = 0, number = 0;char strMAXLEN;while(strk = getchar() != #)k+;strk = 0;for(k = 0; strk != 0; k+) if(strk=0&strk= 0&strk = 9)number = number * 12 + strk 0;else if(strk = A|strk = B)number = number * 12 + strk A + 10;else;/*第15行*/ else b

11、reak; /*第16行*/printf(”%dn”,number);(17) 程序运行时,输入10#,输出 (17) 。 A、16 B、10 C、12 D、1(18) 程序运行时,输入1a0#,输出 (18) 。 A、264 B、10 C、1 D、12(19) 将第16行改为“;”后,程序运行时,输入A*0#,输出 (19) 。 A、0 B、120 C、10 D、12(20) 将第16行改为“else break;”后,删除第15行,程序运行时,输入1b0#,输出 (20) 。 A、10 B、12 C、276 D、1试题6(每小题3分,共12分)#include main()char *s2

12、 = ”*”, ”*”;while(*s1 != 0)printf(”%sn”, s0+strlen(s1)-1);s1+;(21) 程序运行时,第1行输出 (21) 。A、* B、* C、* D、* (22) 程序运行时,第2行输出 (22) 。A、* B、* C、* D、* (23) 程序运行时,第3行输出 (23) 。A、* B、* C、* D、* (24) 程序运行时,第3行输出 (24) 。A、* B、* C、* D、* 试题7 (28分)(1) 定义函数fact(n)计算n的阶乘:n!=1*2*n,函数返回值类型是double。(2) 定义函数cal(m, n)计算累加和:,函数返

13、回值类型是double。(3) 定义函数main(),输入正整数n,计算并输出下列算式的值。该算式中,每一项的分子是累加和,要求调用函数cal(m,n)计算;每一项的分母是阶乘,要求调用函数fact(n)计算n!。(4) y=1+计算机等级考试参考答案(二级C)试题16 (每小题3分) A B C D D C B A A B C D D D A A C C B B (21)D (22)C (23)B (24)A试题7 (28分)#include double fact(int n) int i; double p=1; for(i=1;i=n;i+) p*=i; return(p);double cal(int m,int n) int i; double s=0; for(i=m;i=n;i+) s+=i; return(s);void main() int i,n; double y=0; printf(Please input n:n); scanf(%d,&n); for(i=1;i=n;i+) y+=cal(1,i)/fact(i); printf(The result is:%fn,y);

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1