【计算机类职业资格】全国计算机等级考试三级信息管理技术机试真题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的方差,即得到奇数的方差。

展开阅读全文
相关资源
猜你喜欢
  • ISO 14152 CORR 1-2002 Neutron radiation protection shielding - Design principles and considerations for the choice of appropriate materials Technical Corrigendu.pdf ISO 14152 CORR 1-2002 Neutron radiation protection shielding - Design principles and considerations for the choice of appropriate materials Technical Corrigendu.pdf
  • ISO 14152-2001 Neutron radiation protection shielding - Design principles and considerations for the choice of appropriate materials《中子辐射保护屏蔽 设计原则和选择适用材料的考虑》.pdf ISO 14152-2001 Neutron radiation protection shielding - Design principles and considerations for the choice of appropriate materials《中子辐射保护屏蔽 设计原则和选择适用材料的考虑》.pdf
  • ISO 14155 CORR 1-2011 Clinical investigation of medical devices for human subjects - Good clinical practice Technical Corrigendum 1《用于人体的医疗器械临床研究 临床实践 技术勘误1》.pdf ISO 14155 CORR 1-2011 Clinical investigation of medical devices for human subjects - Good clinical practice Technical Corrigendum 1《用于人体的医疗器械临床研究 临床实践 技术勘误1》.pdf
  • ISO 14156 AMD 1-2007 Milk and milk products - Extraction methods for lipids and liposoluble compounds Amendment 1《奶和奶制品 脂类和脂溶性化合物的萃取方法》.pdf ISO 14156 AMD 1-2007 Milk and milk products - Extraction methods for lipids and liposoluble compounds Amendment 1《奶和奶制品 脂类和脂溶性化合物的萃取方法》.pdf
  • ISO 14156-2001 Milk and milk products - Extraction methods for lipids and liposoluble compounds《乳和乳制品 脂肪和可溶脂肪化合物的提取方法》.pdf ISO 14156-2001 Milk and milk products - Extraction methods for lipids and liposoluble compounds《乳和乳制品 脂肪和可溶脂肪化合物的提取方法》.pdf
  • ISO 14183 CORR 1-2010 Animal feeding stuffs - Determination of monensin narasin and salinomycin contents - Liquid chromatographic method using post-column deriv.pdf ISO 14183 CORR 1-2010 Animal feeding stuffs - Determination of monensin narasin and salinomycin contents - Liquid chromatographic method using post-column deriv.pdf
  • ISO 14183-2005 Animal feeding stuffs - Determination of monensin narasin and salinomycin contents - Liquid chromatographic method using post-column derivatizati.pdf ISO 14183-2005 Animal feeding stuffs - Determination of monensin narasin and salinomycin contents - Liquid chromatographic method using post-column derivatizati.pdf
  • ISO 14189-2013 Water quality - Enumeration of Clostridium perfringens - Method using membrane filtration《水质 产气荚膜梭菌的枚举 使用膜过滤法》.pdf ISO 14189-2013 Water quality - Enumeration of Clostridium perfringens - Method using membrane filtration《水质 产气荚膜梭菌的枚举 使用膜过滤法》.pdf
  • ISO 1419-1995 Rubber- or plastics-coated fabrics - Accelerated-ageing tests《橡胶或塑料涂覆织物 加速老化试验》.pdf ISO 1419-1995 Rubber- or plastics-coated fabrics - Accelerated-ageing tests《橡胶或塑料涂覆织物 加速老化试验》.pdf
  • 相关搜索

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

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