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

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

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

2、一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 IN.dat中读取 1000个十进制整数到数组 xx中。编写函数 Compute(),其功能是:分别计算出 xx数组中奇数的个数 odd、奇数的平均值 ave1、偶数的个数 even、偶数的平均值ave2,以及所有奇数的方差 totfc的值。调用函数 WritcDat(),把结果输出到 OUT.dat文件中。计算方差的公式如下:(分数:100.00)_正确答案:(void Compute (void) int i, yyMAX;for (i=0; i1000; i+)if (xxi %2) odd+;ave1

3、 xxi;yyodd-1 = xxi;else even+;ave2 += xxi;ave1 /= odd;ave2 /= even;for (i=0; iodd; i+)totfc += (yyi-ave1)* (yyi-ave1)/odd;)解析:解题思路 对数组 xxi中的 1000个整数逐个进行扫描处理,如果 xxi对 2的余数为 1,则xxi为奇数,变量 odd加 1,把 xxi的值加到变量 ave1中,同时把 xxi的值输给数组 yy:否则 xxi为偶数,变量 even加 1,把 xxi的值加到变量 ave2中。循环结束后,变量 ave1的值即为所有奇数的和,用 ave1的值除以奇数的个数 odd,就得到所有奇数的平均值;变量 ave2 的值即为所有偶数的和,用ave2的值除以偶数的个数 even,就得到所有偶数的平均值。最后在 for循环语句中根据方差的公式求出所有奇数的方差。

展开阅读全文
相关资源
猜你喜欢
  • UL 2900-2-1-2017 UL Standard for Safety Software Cybersecurity for Network-Connectable Products Part 2-1 Particular Requirements for Network Connectable Components of Healthcare anh.pdf UL 2900-2-1-2017 UL Standard for Safety Software Cybersecurity for Network-Connectable Products Part 2-1 Particular Requirements for Network Connectable Components of Healthcare anh.pdf
  • UL 2901-2013 Outline of Investigation for Antifreeze Solutions for Use in Fire Sprinkler Systems (Issue 1)《消防喷淋系统中使用的防冻液的调查大纲 (议题1)》.pdf UL 2901-2013 Outline of Investigation for Antifreeze Solutions for Use in Fire Sprinkler Systems (Issue 1)《消防喷淋系统中使用的防冻液的调查大纲 (议题1)》.pdf
  • UL 291-2012 UL Standard for Safety Automated Teller Systems (Sixth Edition Reprint with Revisions Through and Including July 20 2016)《自动对讲系统》.pdf UL 291-2012 UL Standard for Safety Automated Teller Systems (Sixth Edition Reprint with Revisions Through and Including July 20 2016)《自动对讲系统》.pdf
  • UL 294 CRD-2014 UL Standard for Safety Access Control System Units - Section  Paragraph Reference Table 4 1 and Section 33 2 2 Subject Single Point Locking Devices C Tiered Attack .pdf UL 294 CRD-2014 UL Standard for Safety Access Control System Units - Section Paragraph Reference Table 4 1 and Section 33 2 2 Subject Single Point Locking Devices C Tiered Attack .pdf
  • UL 294 CRD-2017 UL Standard for Safety Access Control System Units - Section  Paragraph Reference 80 Subject Revision of Ultraviolet Light and Water Exposure Test (Edition 6 May 10.pdf UL 294 CRD-2017 UL Standard for Safety Access Control System Units - Section Paragraph Reference 80 Subject Revision of Ultraviolet Light and Water Exposure Test (Edition 6 May 10.pdf
  • UL 294-2013 UL Standard for Safety Access Control System Units (Sixth Edition Reprint with revisions through and including February 2 2015)《访问控制系统单元》.pdf UL 294-2013 UL Standard for Safety Access Control System Units (Sixth Edition Reprint with revisions through and including February 2 2015)《访问控制系统单元》.pdf
  • UL 294-2018 UL Standard for Safety Access Control System Units (Seventh Edition).pdf UL 294-2018 UL Standard for Safety Access Control System Units (Seventh Edition).pdf
  • UL 294B-2013 UL Standard for Safety Power Over Ethernet (PoE) Power Sources for Access Control Systems and Equipment (First Edition Reprint with revisions through and including Feb.pdf UL 294B-2013 UL Standard for Safety Power Over Ethernet (PoE) Power Sources for Access Control Systems and Equipment (First Edition Reprint with revisions through and including Feb.pdf
  • UL 294B-2013 UL Standard for Safety Power Over Ethernet (PoE) Power Sources for Access Control Systems and Equipment (First Edition Reprint with revisions through and including Feb_1.pdf UL 294B-2013 UL Standard for Safety Power Over Ethernet (PoE) Power Sources for Access Control Systems and Equipment (First Edition Reprint with revisions through and including Feb_1.pdf
  • 相关搜索

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

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