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

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

1、三级数据库技术机试-296 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:利用以下所示的简单迭代方法求方程:cos(x)-x=0 的一个实根。xn+1=cos(xn)迭代步骤如下:(1)取 x1 初值为 0.0。(2)x0=x1,把 x1 的值赋给 x0。(3)x1=cos(x0),求出一个新的 x1。(4)若 x0-x1 的绝对值小于 0.000001,执行步骤(5),否则执行步骤(2)。(5)所求 x1 就是方程 cos(x)-x=0 的一个实根,作为函数值返回。请编写函数 countValue()实现程序要求,最后

2、调用函数 writeDAT()把结果输出到文件 out41.dar 中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writeDAT()的内容。试题程序:#includeconio.h#includemath.h#includestdio.hfloat countvalue( )main ( )clrscr( );printf(“实根=%f/n“,countValue( );printf(“%f/n“,cos(countValue( )countValue( );writeDAT( );writeDAT( )FILE *wf;wf=fopen(“out41.dat“,“w“)

3、fprintf(wf,“%fln“,countValue(fclose(wf);(分数:100.00)_三级数据库技术机试-296 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:利用以下所示的简单迭代方法求方程:cos(x)-x=0 的一个实根。xn+1=cos(xn)迭代步骤如下:(1)取 x1 初值为 0.0。(2)x0=x1,把 x1 的值赋给 x0。(3)x1=cos(x0),求出一个新的 x1。(4)若 x0-x1 的绝对值小于 0.000001,执行步骤(5),否则执行步骤(2)。(5)所求 x1 就是方程

4、cos(x)-x=0 的一个实根,作为函数值返回。请编写函数 countValue()实现程序要求,最后调用函数 writeDAT()把结果输出到文件 out41.dar 中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writeDAT()的内容。试题程序:#includeconio.h#includemath.h#includestdio.hfloat countvalue( )main ( )clrscr( );printf(“实根=%f/n“,countValue( );printf(“%f/n“,cos(countValue( )countValue( );write

5、DAT( );writeDAT( )FILE *wf;wf=fopen(“out41.dat“,“w“);fprintf(wf,“%fln“,countValue(fclose(wf);(分数:100.00)_正确答案:(float countValue() float x0,x1=0.0;while(1) x0=x1; /*将 x1 赋值给 x0*/x1=cos(x0); /*求出新的 x1*/if(fabs(x0-x1)1e-6)break; /*若 x0-x1 的绝对值小于 0.000001,则结束循环*/return x1;)解析:解析 本题考查的知识点如下:(1)数学函数 double cos(double x)及 double fabs(double x)的使用。(2)使用循环结构实现迭代。在本题中,因为要求一个实数的余弦值,在结束迭代的时候要判断绝对值,所以这里要用到数学函数 cos(double x)和 fabs(double x)。先设一个条件永远为真的 while 循环结构,按照步骤提示,要先为 x1取初值,将 x1 的值赋给 x0,使 xl=cos(x0),判断 x0-x1 的绝对值将其作为强行退出循环的条件。

展开阅读全文
相关资源
猜你喜欢
  • BS EN 61179-1993 Specification for helical-scan digital composite video cassette recording system using 19 mm magnetic tape format D2 (NTSC PAL PAL-M)《使用D2(NTSC PAL PAL-M)制式19mm磁带的.pdf BS EN 61179-1993 Specification for helical-scan digital composite video cassette recording system using 19 mm magnetic tape format D2 (NTSC PAL PAL-M)《使用D2(NTSC PAL PAL-M)制式19mm磁带的.pdf
  • BS EN 61180-2016 High-voltage test techniques for low-voltage equipment Definitions test and procedure requirements test equipment《低压设备的高压试验技术 定义、试验和方法要求、试验设备》.pdf BS EN 61180-2016 High-voltage test techniques for low-voltage equipment Definitions test and procedure requirements test equipment《低压设备的高压试验技术 定义、试验和方法要求、试验设备》.pdf
  • BS EN 61182-2-2-2012 Printed board assembly products Manufacturing description data and transfer methodology Sectional requirements for implementation of printed board fabrication .pdf BS EN 61182-2-2-2012 Printed board assembly products Manufacturing description data and transfer methodology Sectional requirements for implementation of printed board fabrication .pdf
  • BS EN 61183-1995 Electroacoustics - Random-incidence and diffuse-field calibration of sound level meters《电声学 声级计的无规入射声场及扩散声场校正》.pdf BS EN 61183-1995 Electroacoustics - Random-incidence and diffuse-field calibration of sound level meters《电声学 声级计的无规入射声场及扩散声场校正》.pdf
  • BS EN 61187-1996 Electrical and electronic measuring equipment - Documentation《电气和电子测量设备 文献工作》.pdf BS EN 61187-1996 Electrical and electronic measuring equipment - Documentation《电气和电子测量设备 文献工作》.pdf
  • BS EN 61188-1-1-1997 Printed boards and assemblies - Design and use - Generic requirements - Flatness considerations for electronic assemblies《印制线路板和组件 设计和使用 常规要求 电子组件平整度》.pdf BS EN 61188-1-1-1997 Printed boards and assemblies - Design and use - Generic requirements - Flatness considerations for electronic assemblies《印制线路板和组件 设计和使用 常规要求 电子组件平整度》.pdf
  • BS EN 61188-1-2-1998 Printed boards and assemblies - Design and use - Generic requirements - Generic requirements - Controlled impedance《印制电路板及组件 设计和使用 一般要求 受控阻抗》.pdf BS EN 61188-1-2-1998 Printed boards and assemblies - Design and use - Generic requirements - Generic requirements - Controlled impedance《印制电路板及组件 设计和使用 一般要求 受控阻抗》.pdf
  • BS EN 61188-5-1-2003 Printed boards and assemblies - Design and use - Attachment (land joint) considerations - Attachment (land joint) considerations - Generic requirements《印制电路板和印.pdf BS EN 61188-5-1-2003 Printed boards and assemblies - Design and use - Attachment (land joint) considerations - Attachment (land joint) considerations - Generic requirements《印制电路板和印.pdf
  • BS EN 61188-5-2-2003 Printed boards and assemblies - Design and use - Attachment (land joint) considerations - Discrete components《印制板及其组件 设计和使用 焊接(焊接区 接缝)的考虑 分立元件》.pdf BS EN 61188-5-2-2003 Printed boards and assemblies - Design and use - Attachment (land joint) considerations - Discrete components《印制板及其组件 设计和使用 焊接(焊接区 接缝)的考虑 分立元件》.pdf
  • 相关搜索

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

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