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

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

1、计算机三级数据库技术-146 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是从文件 IN.DAT 中读取 1000 个十进制整数到数组 xx 中。请编写函数 Compute()分别计算出 xx 中偶数的个数 even、奇数的平均值 ave1、偶数的平均值 ave2 及所有偶数的方差 totfc 的值,最后调用函数 WriteDat(),把结果输出到 OUT.DAT 文件中。 计算方差的公式如下: (分数:100.00)_计算机三级数据库技术-146 答案解析(总分:100.00,做题时间:90 分钟)一、上

2、机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是从文件 IN.DAT 中读取 1000 个十进制整数到数组 xx 中。请编写函数 Compute()分别计算出 xx 中偶数的个数 even、奇数的平均值 ave1、偶数的平均值 ave2 及所有偶数的方差 totfc 的值,最后调用函数 WriteDat(),把结果输出到 OUT.DAT 文件中。 计算方差的公式如下: (分数:100.00)_正确答案:()解析:void Compute(void) int i,ttMAX; /*定义数组 tt 计算总和*/ for(i=0;i1000;i+) if(xxi%2!=0)

3、 /*判断当前数的奇偶性*/ odd+; /*统计奇数的个数*/ ave1+=xxi; /*求奇数的总和*/ else even+; /*统计偶数的个数*/ ave2+=xxi; /*求偶数的总和*/ tteven-1=xxi; /*将偶数存入数组 tt 中*/ ave1/=odd; /*求奇数的平均数*/ ave2/=even; /*求偶数的平均数*/ for(i=0;ieven;i+) /*求所有偶数的方差*/ totfc+=(tti-ave2)*(tti-ave2)/even; 解析 本题属于数学类问题,主要考查的是奇偶数的判断和方差的求法。 解本题的思路为:用循环控制取每一个数进行判断,若一个数除以 2 取余得 0,则该数是偶数,否则为奇数。分别统计奇数和偶数的个数、总和,并且保存所有满足条件的偶数。最后由方差公式可知,这是求一些连续的数的表达式的和,所以可以使用循环求得方差。

展开阅读全文
相关资源
猜你喜欢
  • DIN 4020 Bb 1-2003 Geotechnical investigations for civil engineering purposes - Aids to application supplementary information《土木工程的土质调查 使用辅助 注释》.pdf DIN 4020 Bb 1-2003 Geotechnical investigations for civil engineering purposes - Aids to application supplementary information《土木工程的土质调查 使用辅助 注释》.pdf
  • DIN 4020-2010 Geotechnical investigations for civil engineering purposes - Supplementary rules to DIN EN 1997-2《土木工程用土工调查 DIN EN 1997-2的补充条例》.pdf DIN 4020-2010 Geotechnical investigations for civil engineering purposes - Supplementary rules to DIN EN 1997-2《土木工程用土工调查 DIN EN 1997-2的补充条例》.pdf
  • DIN 40200-1981 Nominal value limiting value rated value rating - concepts《公称值,极限值,额定值,额定数据 概念》.pdf DIN 40200-1981 Nominal value limiting value rated value rating - concepts《公称值,极限值,额定值,额定数据 概念》.pdf
  • DIN 4023-2006 Geotechnical investigation and testing - Graphical presentation of logs of boreholes trial pits shafts and adits《土工调查和检验 矿井孔、试验坑、竖井和入口测井记录的图示法》.pdf DIN 4023-2006 Geotechnical investigation and testing - Graphical presentation of logs of boreholes trial pits shafts and adits《土工调查和检验 矿井孔、试验坑、竖井和入口测井记录的图示法》.pdf
  • DIN 403-1973 Knurling wheels《滚花轮》.pdf DIN 403-1973 Knurling wheels《滚花轮》.pdf
  • DIN 4030-1-2008 Assessment of water soil and gases for their aggressiveness to concrete - Part 1 Principles and limiting values《对混凝土有侵蚀性的水、土壤和气体的评估 第1部分 原理和限值》.pdf DIN 4030-1-2008 Assessment of water soil and gases for their aggressiveness to concrete - Part 1 Principles and limiting values《对混凝土有侵蚀性的水、土壤和气体的评估 第1部分 原理和限值》.pdf
  • DIN 4030-2-2008 Assessment of water soil and gases for their aggressiveness to concrete - Part 2 Sampling and analysis of water and soil samples《对混凝土有侵蚀性的水、土壤和气体的评估 第2部分 水和土壤样品的取样和.pdf DIN 4030-2-2008 Assessment of water soil and gases for their aggressiveness to concrete - Part 2 Sampling and analysis of water and soil samples《对混凝土有侵蚀性的水、土壤和气体的评估 第2部分 水和土壤样品的取样和.pdf
  • DIN 4034-10-2012 Prefabricated concrete manholes unreinforced steel fibre and reinforced - Part 10 Brick manhole bases for buried drains and sewers - Requirements and testing《预制混凝土.pdf DIN 4034-10-2012 Prefabricated concrete manholes unreinforced steel fibre and reinforced - Part 10 Brick manhole bases for buried drains and sewers - Requirements and testing《预制混凝土.pdf
  • DIN 4034-2-2013 Prefabricated concrete manholes unreinforced steel fibre and reinforced - Part 2 Manholes for well construction and drain construction《未配筋 钢纤维和钢筋预制混凝土检修孔 第2部分 井建设和排.pdf DIN 4034-2-2013 Prefabricated concrete manholes unreinforced steel fibre and reinforced - Part 2 Manholes for well construction and drain construction《未配筋 钢纤维和钢筋预制混凝土检修孔 第2部分 井建设和排.pdf
  • 相关搜索

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

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