【计算机类职业资格】全国计算机等级考试三级信息管理技术机试真题2011年9月及答案解析.doc

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

1、全国计算机等级考试三级信息管理技术机试真题 2011年 9月及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制函数 ReadDat()实现从文件 in.dat中读取 1000个十进制整数到数组 xx中;请编制函数Compute()分别计算出 xx中奇数的个数 odd,奇数的平均值 avel,偶数的平均值 ave2以及所有奇数的方差 totfc的值,最后调用函数 WriteDat()把结果输出到 out.dat文件中。计算方差的公式如下:(分数:100.00)_全国计算机等级考试三级信息管理技术机试真题 2011年 9月答案解析(总分:1

2、00.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制函数 ReadDat()实现从文件 in.dat中读取 1000个十进制整数到数组 xx中;请编制函数Compute()分别计算出 xx中奇数的个数 odd,奇数的平均值 avel,偶数的平均值 ave2以及所有奇数的方差 totfc的值,最后调用函数 WriteDat()把结果输出到 out.dat文件中。计算方差的公式如下:(分数:100.00)_正确答案:(int ReadDat(void)FILE*fP;int i,j;if(fp=fopen(“iN.DAT“,“r“)=NULL)return 1;

3、for(i=0;i100:i+)for(j=0;j10;j+)fscanf(fp,“%d,“,&xxi*10+j);fscanf(fp,“/n“);if(feof(fp)break;fclose(fp);return 0;void Compute(void)int i,aaMA)(;for(i=0;i1000;i+)if(xxi%2) /*若 xxEi是奇数*/odd+; /*奇数计数值增 1*/ave1+=xxi; /*将 xxi累加到 ave1中*/aaodd-1=xxi; /*将 xxi顺放入临时数组 aa中*/else /*若 xxi是偶数*/even+; /*偶数计数值增 1*/av

4、e2+=xxi; /*将 xxi累加到 ave2中*/ave1/=odd; /*求奇数的平均值*/ave2/=even; /*求偶数的平均值*/for(i=0;iodd;1+) /*求方差*/totfc+=(aai-ave1)*(aai-ave1)/odd;)解析:解析 本题主要考查的是方差问题,同时考查了学生对于读入输出数据的函数。本题要注意读入函数的格式输入符后面一定要加上迈号,因为文件 IN.DAT里面的数据是用逗号隔开的,对于 100行 10列的二维数组中的数据读入 xx一维数组时,其下标变为 i*10+j,feo()函数用来判断是否已经到达文件的末尾。Compute()函数首先使用 for循环对数组 xx遍历,遇到奇数 odd增 1,并将该数累加到 ave1且将此数存入临时数组 aa中,遇到偶数 even增 1,并且将该数累加到 ave2,遍历完以后分别求出奇数和偶数的平均值,根据方差公式,使用 for循环求出数组 aa的方差,即得到奇数的方差。

展开阅读全文
相关资源
猜你喜欢
  • EEMUA PUB NO 213-2012 Emission reduction from oil storage tanks and loading operations (Edition 1)《储油罐的减排和装载作业(第1版)》.pdf EEMUA PUB NO 213-2012 Emission reduction from oil storage tanks and loading operations (Edition 1)《储油罐的减排和装载作业(第1版)》.pdf
  • EEMUA PUB NO 215-2009 Design Maintenance and Operation of Industrial Cooling Tower Fans and Fin Fans (Edition 1)《工业冷却塔风机和翅片风机的设计 维护和操作(第1版)》.pdf EEMUA PUB NO 215-2009 Design Maintenance and Operation of Industrial Cooling Tower Fans and Fin Fans (Edition 1)《工业冷却塔风机和翅片风机的设计 维护和操作(第1版)》.pdf
  • EEMUA PUB NO 217-2011 Safe and effective operation of storage tanks for oil movements (Edition 1)《石油运动存储罐的俺有有效操作(第1版)》.pdf EEMUA PUB NO 217-2011 Safe and effective operation of storage tanks for oil movements (Edition 1)《石油运动存储罐的俺有有效操作(第1版)》.pdf
  • EEMUA PUB NO 218-2010 Quality requirements for the manufacture and supply of duplex stainless steels (Edition 1)《双相不锈钢生产和供应的质量要求(第1版)》.pdf EEMUA PUB NO 218-2010 Quality requirements for the manufacture and supply of duplex stainless steels (Edition 1)《双相不锈钢生产和供应的质量要求(第1版)》.pdf
  • EEMUA PUB NO 222-2009 Guide to the Application of IEC 61511 to safety instrumented systems in the UK process industries (Edition 1 NO CD INCLUDED-CD IS SAME AS DOCUMENT )《英国加工工业安全仪.pdf EEMUA PUB NO 222-2009 Guide to the Application of IEC 61511 to safety instrumented systems in the UK process industries (Edition 1 NO CD INCLUDED-CD IS SAME AS DOCUMENT )《英国加工工业安全仪.pdf
  • EEMUA PUB NO 223-2010 Pressure equipment testing after repair modifications or re-rating A guide to the pressure test waiver (Edition 1)《修理 修改或重估后的压力设备试验 压力试验豁免(第1版)》.pdf EEMUA PUB NO 223-2010 Pressure equipment testing after repair modifications or re-rating A guide to the pressure test waiver (Edition 1)《修理 修改或重估后的压力设备试验 压力试验豁免(第1版)》.pdf
  • EEMUA PUB NO 224-2013 A guide to risk-based procurement Quality assurance of safety-critical engineering equipment and materials (Edition 1).pdf EEMUA PUB NO 224-2013 A guide to risk-based procurement Quality assurance of safety-critical engineering equipment and materials (Edition 1).pdf
  • EEMUA PUB NO 225-2017 Above ground plastic tanks A guide to their specification installation commissioning inspection maintenance repair and disposal (Edition 1).pdf EEMUA PUB NO 225-2017 Above ground plastic tanks A guide to their specification installation commissioning inspection maintenance repair and disposal (Edition 1).pdf
  • EEMUA PUB NO 226-2012 Design and installation of on-line analyser systems A guide to technical enquiry and bid evaluation (Edition 1)《在线分析系统的设计和安装 技术咨询和评标指南(第1版)》.pdf EEMUA PUB NO 226-2012 Design and installation of on-line analyser systems A guide to technical enquiry and bid evaluation (Edition 1)《在线分析系统的设计和安装 技术咨询和评标指南(第1版)》.pdf
  • 相关搜索

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

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