【计算机类职业资格】三级信息管理技术机试-47及答案解析.doc

上传人:jobexamine331 文档编号:1320797 上传时间:2019-10-17 格式:DOC 页数:3 大小:27.50KB
下载 相关 举报
【计算机类职业资格】三级信息管理技术机试-47及答案解析.doc_第1页
第1页 / 共3页
【计算机类职业资格】三级信息管理技术机试-47及答案解析.doc_第2页
第2页 / 共3页
【计算机类职业资格】三级信息管理技术机试-47及答案解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、三级信息管理技术机试-47 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:找出所有 100 以内(含 100)满足 I,I+4,I+10 都是素数的整数重(I+10 也是在 100以内)的个数 cnt,以及这些 I 之和 sum。请编制函数 countValue()实现程序要求,最后调用函数writeDAT()把结果 cnt 和 sum 输出到文件 out64.dat 中(数值 1 不是素数)。注意:部分源程序已给出。请勿改动主函数 main()和输出数据函数 writeDAT()的内容。试题程序:#includestd

2、ioh int cnt,sum;int isPrime (int number)int i,tag=l;if (number= 1 )return 0;for(i=2;tag i+)if (number%i=0) tag=0;return tag;void countValue ( )void main ( )cnt=sum=0;countValue ( );printf (“满足条件的整数的个数=%d/n“, cnt);printf (“满足条件的整数的和值=%d/n“, sum);writeDAT ( );writeDAT ( )FILE *fp;fp=fopen(“out64.dat“

3、 “w“);fprintf (fp, “%d/n%d/n“, cnt, sum);fclose (fp);(分数:100.00)_三级信息管理技术机试-47 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:找出所有 100 以内(含 100)满足 I,I+4,I+10 都是素数的整数重(I+10 也是在 100以内)的个数 cnt,以及这些 I 之和 sum。请编制函数 countValue()实现程序要求,最后调用函数writeDAT()把结果 cnt 和 sum 输出到文件 out64.dat 中(数值 1 不是素数)

4、注意:部分源程序已给出。请勿改动主函数 main()和输出数据函数 writeDAT()的内容。试题程序:#includestdioh int cnt,sum;int isPrime (int number)int i,tag=l;if (number= 1 )return 0;for(i=2;tag i+)if (number%i=0) tag=0;return tag;void countValue ( )void main ( )cnt=sum=0;countValue ( );printf (“满足条件的整数的个数=%d/n“, cnt);printf (“满足条件的整数的和值=%d

5、/n“, sum);writeDAT ( );writeDAT ( )FILE *fp;fp=fopen(“out64.dat“ , “w“);fprintf (fp, “%d/n%d/n“, cnt, sum);fclose (fp);(分数:100.00)_正确答案:(void countValue ( )int i,count=0,xx30;int j, k, m;cnt=0;sum=0;for (i=2; i90; i+) /*找数的范围为 100 以内*/if (isPrime (i) /*如果该数为素数,则将它存入数组 xx 中,并统计个数*/xx count =i;count+;

6、for (i=0; icount; i+) /*如果数组 xx 中的素数加 4 和加 10 得到的数仍为素数*/if (isPrime (xx i +4) /*统计满足条件的数的个数*/sum+=xx i; /*将满足条件的数组 xx 中的数求和*/) )解析:解析 本题考查的知识点如下:(1)循环结构与判断结构的嵌套使用。(2)判断结构中多个条件的布尔运算。题中要求判断在 100 以内,i,i+4,i+10 都是素数的个数。因为 i+10 也必须在 100 以内,1 不是素数,我们可以从 2 开始判断到 89 即可(90 是偶数,明显不是素数)。可以先找出 2 到 89 之间素数的个数,再判断这些素数加 4 和加 10 后是否还是素数。加 4 是素数与加 10 是素数必须同时满足,所以两个条件间用“与”运算。

展开阅读全文
相关资源
猜你喜欢
  • IEC 60151-7-1964 Measurements of the electrical properties of electronic tubes Part 7  Measurement of equivalent noise resistance《电子管电性能的测量 第7部分 等效噪声电阻的测量》.pdf IEC 60151-7-1964 Measurements of the electrical properties of electronic tubes Part 7 Measurement of equivalent noise resistance《电子管电性能的测量 第7部分 等效噪声电阻的测量》.pdf
  • IEC 60151-8-1966 Measurements of the electrical properties of electronic tubes Part 8  Measurement of cathode heating time and heater warm-up time《电子管电性能的测量 第8部分 阴极加热时间和热丝加热时间的测量》.pdf IEC 60151-8-1966 Measurements of the electrical properties of electronic tubes Part 8 Measurement of cathode heating time and heater warm-up time《电子管电性能的测量 第8部分 阴极加热时间和热丝加热时间的测量》.pdf
  • IEC 60151-9-1966 Measurements of the electrical properties of electronic tubes Part 9  Methods of measuring the cathode-interface impedance《电子管电性能的测量 第9部分 阴极中间层阻抗的测量方法》.pdf IEC 60151-9-1966 Measurements of the electrical properties of electronic tubes Part 9 Methods of measuring the cathode-interface impedance《电子管电性能的测量 第9部分 阴极中间层阻抗的测量方法》.pdf
  • IEC 60152-1963 Identification by hour numbers of the phase conductors of 3-phase electric systems《用小时数标识三相电力系统的相导线》.pdf IEC 60152-1963 Identification by hour numbers of the phase conductors of 3-phase electric systems《用小时数标识三相电力系统的相导线》.pdf
  • IEC 60153-1-2016 Hollow metallic waveguides - Part 1 General requirements and measuring methods《空心金属波导.第1部分 一般要求和测量方法》.pdf IEC 60153-1-2016 Hollow metallic waveguides - Part 1 General requirements and measuring methods《空心金属波导.第1部分 一般要求和测量方法》.pdf
  • IEC 60153-2-2016 Hollow metallic waveguides - Part 2 Relevant specifications for ordinary rectangular waveguides《空心金属波导 第2部分 普通矩形波导的有关规范》.pdf IEC 60153-2-2016 Hollow metallic waveguides - Part 2 Relevant specifications for ordinary rectangular waveguides《空心金属波导 第2部分 普通矩形波导的有关规范》.pdf
  • IEC 60153-3-1964 Hollow metallic waveguides Part 3  Relevant specifications for flat rectangular waveguides《空心金属波导 第3部分 扁矩形波导的有关规范》.pdf IEC 60153-3-1964 Hollow metallic waveguides Part 3 Relevant specifications for flat rectangular waveguides《空心金属波导 第3部分 扁矩形波导的有关规范》.pdf
  • IEC 60153-4-1973 Hollow metallic waveguides Part 4  Relevant specifications for circular waveguides《空心金属波导 第4部分 圆波导的有关规范》.pdf IEC 60153-4-1973 Hollow metallic waveguides Part 4 Relevant specifications for circular waveguides《空心金属波导 第4部分 圆波导的有关规范》.pdf
  • IEC 60153-6-1967 Hollow metallic waveguides Part 6  Relevant specifications for medium flat rectangular waveguides《空心金属波导 第6部分 中等扁矩形波导的有关规范》.pdf IEC 60153-6-1967 Hollow metallic waveguides Part 6 Relevant specifications for medium flat rectangular waveguides《空心金属波导 第6部分 中等扁矩形波导的有关规范》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1