【计算机类职业资格】三级数据库技术-506及答案解析.doc

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

1、三级数据库技术-506 及答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat中读取 1000个十进制整数到数组 xx中;请编制函数 compute()分别计算出 xx中数值为奇数的个数 odd,偶数的个数 even,平均值 aver以及方差 totfc的值,最后调用函数WriteDat()把结果输出到 out.dat文件中。 计算方差的公式如下: (分数:100.00)_三级数据库技术-506 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.0

2、0)1.函数 ReadDat()实现从文件 in.dat中读取 1000个十进制整数到数组 xx中;请编制函数 compute()分别计算出 xx中数值为奇数的个数 odd,偶数的个数 even,平均值 aver以及方差 totfc的值,最后调用函数WriteDat()把结果输出到 out.dat文件中。 计算方差的公式如下: (分数:100.00)_正确答案:()解析:/*循环变量 i从 0开始,每次增加 1,计算奇数的个数 odd,偶数的个数 even,所有数组元素的和aver*/ int i; for(i=0; iMAX; i+) if(xxi%2) /如果 xxi是奇数 odd+; /

3、odd加 1 else /否则, xxi是偶数 even+; /even加 1 aver+=xxi; /把所有数组的元素 xxi累加到变量 aver aver/=1000.0;/变量 aver除以 1000.0得到所有数组元素的算术平均值 /*根据计算方差的公式,计算所有数组元素的方差+/ for(i=0;iMAX;i+) totfc+=(xxi-aver)*(xxi-aver);/把(xxi-aver)的平方累加到变量 totfc totfc/=1000.0; /变量 totfc除以 1000.0得到所有数组元素的方差 解析 读取 1000个数,奇数个数、偶数个数、平均值及方差。 相对来说更简单一些,通过审题可以发现本题有两个不同点:求所有数的平均值,此时只需要将数组中所有元素的值累加到变量 aver中,最后除以 1000(因为数组中有 1000个元素)即可得到平均值,参考答案的第 8条和第 10条语句。求所有数的方差,可先利用 for循环将(xxi-aver)的平方累加到变量totfc,然后再除以 1000即可得到所有数的方差,参考答案的第 1113 条语句。

展开阅读全文
相关资源
猜你喜欢
  • CEN TS 16675-2014 Characterisation of waste - Test methods for the determination of the monolithic status of waste《废物特性 测定废弃物整体状态的测定方法》.pdf CEN TS 16675-2014 Characterisation of waste - Test methods for the determination of the monolithic status of waste《废物特性 测定废弃物整体状态的测定方法》.pdf
  • CEN TS 16685-2014 Information technology - Notification of RFID - The information sign to be displayed in areas where RFID interrogators are deployed《信息技术 射频识别技术的通告 信息符号的显示和RFID读写器.pdf CEN TS 16685-2014 Information technology - Notification of RFID - The information sign to be displayed in areas where RFID interrogators are deployed《信息技术 射频识别技术的通告 信息符号的显示和RFID读写器.pdf
  • CEN TS 16692-2015 Water quality - Determination of tributyltin (TBT) in whole water samples - Method using solid phase extraction (SPE) with SPE disks and gas chromatography with t.pdf CEN TS 16692-2015 Water quality - Determination of tributyltin (TBT) in whole water samples - Method using solid phase extraction (SPE) with SPE disks and gas chromatography with t.pdf
  • CEN TS 16700-2014 Paints and varnishes - Coating materials and coating systems for exterior wood - Assessment of resistance to impact of a coating on a wooden substrate《色漆和清漆 涂层材料和.pdf CEN TS 16700-2014 Paints and varnishes - Coating materials and coating systems for exterior wood - Assessment of resistance to impact of a coating on a wooden substrate《色漆和清漆 涂层材料和.pdf
  • CEN TS 16702-1-2014 Electronic fee collection - Secure monitoring for autonomous toll systems - Part 1 Compliance checking《电子收费 自动收费系统的安全监控 第1部分 合规性检查》.pdf CEN TS 16702-1-2014 Electronic fee collection - Secure monitoring for autonomous toll systems - Part 1 Compliance checking《电子收费 自动收费系统的安全监控 第1部分 合规性检查》.pdf
  • CEN TS 16702-2-2015 Electronic fee collection - Secure monitoring for autonomous toll systems - Part 2 Trusted recorder《电子收费 自动收费系统的安全监控 第2部分 可信记录器》.pdf CEN TS 16702-2-2015 Electronic fee collection - Secure monitoring for autonomous toll systems - Part 2 Trusted recorder《电子收费 自动收费系统的安全监控 第2部分 可信记录器》.pdf
  • CEN TS 16707-2014 Foodstuffs - Methods of analysis for the detection of genetically modified organisms and derived products - Polymerase chain reaction (PCR) based screening strate.pdf CEN TS 16707-2014 Foodstuffs - Methods of analysis for the detection of genetically modified organisms and derived products - Polymerase chain reaction (PCR) based screening strate.pdf
  • CEN TS 16717-2015 Surface for sports areas - Method of test for the determination of shock absorption vertical deformation and energy restitution using the advanced artificial athl.pdf CEN TS 16717-2015 Surface for sports areas - Method of test for the determination of shock absorption vertical deformation and energy restitution using the advanced artificial athl.pdf
  • CEN TS 16731-2014 Foodstuffs - Determination of hydride-reactive arsenic compounds in rice by atomic absorption spectrometry (Hydride- AAS) following acid extraction《食品 酸提取之后用原子吸收光.pdf CEN TS 16731-2014 Foodstuffs - Determination of hydride-reactive arsenic compounds in rice by atomic absorption spectrometry (Hydride- AAS) following acid extraction《食品 酸提取之后用原子吸收光.pdf
  • 相关搜索

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

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