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

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

1、三级数据库技术机试-72 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编写函数 countValue(),其功能是:找出所有 100以内(含 100)满足 I,I+4,I+10 都是素数的整数I(I+10也是在 100以内)的个数 count,以及这些 I之和 sum。函数 WriteData()负责把结果输出到OUT.DAT文件中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 WriteData()的内容。试题程序:#includestdio.hint count,sum;void writeData();void

2、countValue()void main()count=sum=0:countValue();printf(“count=%sum=%d“,count,sum);writeData();void writeData()FILE*fp;fp=fopen(“OUT.DAT“,“w“);fprintf(fp,“%d%d“,count,sum);fclose(fp);(分数:100.00)_三级数据库技术机试-72 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编写函数 countValue(),其功能是:找出所有 100以内(含 100)满足

3、 I,I+4,I+10 都是素数的整数I(I+10也是在 100以内)的个数 count,以及这些 I之和 sum。函数 WriteData()负责把结果输出到OUT.DAT文件中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 WriteData()的内容。试题程序:#includestdio.hint count,sum;void writeData();void countValue()void main()count=sum=0:countValue();printf(“count=%sum=%d“,count,sum);writeData();void writeDat

4、a()FILE*fp;fp=fopen(“OUT.DAT“,“w“);fprintf(fp,“%d%d“,count,sum);fclose(fp);(分数:100.00)_正确答案:(void countValue()int i,j,k,d3,flag;for(i=0;i=100-10;i+)d0=i;d1=i+4;d2=i+10;/将三个数存入数组flag=0;/将标志位清零for(k=0;k3;k+)for(j=2;jdk;j+)/判断是否为素数if(dk%j=0)/如果一个数除了自身和 1之外还有其他余数,则该数不是素数flag=1;/将标志位置 1break;/一旦发现不满足条件的数就退出循环if(flag=0)/如果满足条件sum+=i;/将该数加入总和count+;/计数器加 1)解析:解析 本题主要考查素数的判断问题。判断是否为素数:素数的定义是,若一个数除了其自身和 1再没有其他的除数,则该数就是素数。故用其定义可以很容易判断,在 2到所判断数之间的数进行扫描,若有一个除数,则该数就不是素数;判断4个数是不是都是素数,若有一个不是,则不符合要求,即可进行下一轮判断。

展开阅读全文
相关资源
猜你喜欢
  • ISO 17212-2012 Structural adhesives - Guidelines for the surface preparation of metals and plastics prior to adhesive bonding《结构胶黏剂 粘接前金属和塑料表面处理导则》.pdf ISO 17212-2012 Structural adhesives - Guidelines for the surface preparation of metals and plastics prior to adhesive bonding《结构胶黏剂 粘接前金属和塑料表面处理导则》.pdf
  • ISO 17214-2011 Space data and information transfer systems - Spacecraft onboard interface services - Time access service《空间数据和信息传输系统 宇宙飞船上的接口服务 时间访问服务》.pdf ISO 17214-2011 Space data and information transfer systems - Spacecraft onboard interface services - Time access service《空间数据和信息传输系统 宇宙飞船上的接口服务 时间访问服务》.pdf
  • ISO 1722-1974 Rock drilling Extension drill-steel equipment for percussive long-hole drilling Reverse-buttress-threaded equipments 1 1 2 to 2 1 2 in (38 to 64 m.pdf ISO 1722-1974 Rock drilling Extension drill-steel equipment for percussive long-hole drilling Reverse-buttress-threaded equipments 1 1 2 to 2 1 2 in (38 to 64 m.pdf
  • ISO 17223-2014 Plastics - Determination of yellowness index and change in yellowness index《塑料 黄度指数及其变化的测定》.pdf ISO 17223-2014 Plastics - Determination of yellowness index and change in yellowness index《塑料 黄度指数及其变化的测定》.pdf
  • ISO 17230-2006 Leather - Physical and mechanical tests - Determination of water penetration pressure《皮革 物理和机械试验 水渗透压力测定》.pdf ISO 17230-2006 Leather - Physical and mechanical tests - Determination of water penetration pressure《皮革 物理和机械试验 水渗透压力测定》.pdf
  • ISO 17231-2006 Leather - Physical and mechanical tests - Determination of water repellency of garment leather《皮革 物理和机械试验 服饰皮革的拒水性测定》.pdf ISO 17231-2006 Leather - Physical and mechanical tests - Determination of water repellency of garment leather《皮革 物理和机械试验 服饰皮革的拒水性测定》.pdf
  • ISO 1724-2003 Road vehicles - Connectors for the electrical connection of towing and towed vehicles - 7-pole connector type 12 N (normal) for vehicles with 12 V.pdf ISO 1724-2003 Road vehicles - Connectors for the electrical connection of towing and towed vehicles - 7-pole connector type 12 N (normal) for vehicles with 12 V.pdf
  • ISO 1726-1-2000 Road vehicles - Mechanical coupling between tractors and semi-trailers - Part 1 Interchangeability between tractors and semi-trailers for genera.pdf ISO 1726-1-2000 Road vehicles - Mechanical coupling between tractors and semi-trailers - Part 1 Interchangeability between tractors and semi-trailers for genera.pdf
  • ISO 17262 CORR 1-2013 Intelligent transport systems - Automatic vehicle and equipment identification - Numbering and data structures Technical Corrigendum 1《智能运.pdf ISO 17262 CORR 1-2013 Intelligent transport systems - Automatic vehicle and equipment identification - Numbering and data structures Technical Corrigendum 1《智能运.pdf
  • 相关搜索

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

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