[计算机类试卷]国家二级(C语言)机试模拟试卷215及答案与解析.doc

上传人:jobexamine331 文档编号:502961 上传时间:2018-11-29 格式:DOC 页数:4 大小:29KB
下载 相关 举报
[计算机类试卷]国家二级(C语言)机试模拟试卷215及答案与解析.doc_第1页
第1页 / 共4页
[计算机类试卷]国家二级(C语言)机试模拟试卷215及答案与解析.doc_第2页
第2页 / 共4页
[计算机类试卷]国家二级(C语言)机试模拟试卷215及答案与解析.doc_第3页
第3页 / 共4页
[计算机类试卷]国家二级(C语言)机试模拟试卷215及答案与解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级( C语言)机试模拟试卷 215及答案与解析 一、程序填空题( 30分) 1 给定程序中,函数 fun的功能是根据形参 i的值返回某个函数的值。当调用正确时,程序输出: x1=5 000000, x2=3 000000, x1*x1+x1*x2=40 000000 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANKl C中。 不得增行或删行,也不得更改程序的结构 ! #include double f1(double x) return x*x; double f2(double x, double y) Eeturn

2、x*y; /*found*/ 【 1】 fun(int i, double x, double y) if (i=1) /*found*/ Eeturn 【 2】 (x); else /*found*/ reLurn【 3】 (x, y); main() double x1=5, x2=3, r; r=fun(1, x1, x2); r+=fun(2, x1, x2); printf(“ nx1= f, x2= f, x1*x1+x1*x2= f n n“, x1, x2, r); 二、程序修改题( 30分) 2 给定程序 MODll C中函数 fun的功能是:先将在字符串 s中的字符按正序存

3、放到 t串中,然后把 s中的字符按逆序连接到 t串的后面。 例如:当 s中的字符串为: ”ABCDE”时,则 t中的字符串应为: ”ABCDEEDCBA”。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动 main函数,不得增行或删行,也不得更改程序的结构 ! #include #include void fun (char *s, char *t) int i, s; sl = strlen(s); /*found*/ for(i=0; i0.000001); return x1; 【试题解析】 进入 fun函数,根据前面的分析: 根据题中给出的求解步骤,首先 x1初值为 0.0;若 x0-x1的绝对值大于 0.000001就循环进行迭代,即 “x0=x1; x1=cos(x0);”直到满足题目中的要求,返回 x1,即实根。

展开阅读全文
相关资源
猜你喜欢
  • API PUBL 1669-1994 Results of a Retail Gasoline Outlet and Commercial Parking Lot Storm Water Runoff Study《汽油零售商铺和商业停车场雨水径流研究结果》.pdf API PUBL 1669-1994 Results of a Retail Gasoline Outlet and Commercial Parking Lot Storm Water Runoff Study《汽油零售商铺和商业停车场雨水径流研究结果》.pdf
  • API PUBL 1673-2009 Compilation of Air Emission Estimating Methods for Petroleum Distribution and Dispensing Facilities (Second Edition)《石油配送和分配设施用空气排放评估法的汇编.第2版》.pdf API PUBL 1673-2009 Compilation of Air Emission Estimating Methods for Petroleum Distribution and Dispensing Facilities (Second Edition)《石油配送和分配设施用空气排放评估法的汇编.第2版》.pdf
  • API PUBL 1835-1997 Study of Used Motor Oil Recycling in Eleven Selected Countries《在11个选定的国家使用的电动机润滑油的回收的研究》.pdf API PUBL 1835-1997 Study of Used Motor Oil Recycling in Eleven Selected Countries《在11个选定的国家使用的电动机润滑油的回收的研究》.pdf
  • API PUBL 2026-1998 Safe Access Egress Involving Floating Roofs of Storage Tanks in Petroleum Service (Second Edition)《安全进出石油储罐的浮顶.第2版》.pdf API PUBL 2026-1998 Safe Access Egress Involving Floating Roofs of Storage Tanks in Petroleum Service (Second Edition)《安全进出石油储罐的浮顶.第2版》.pdf
  • API PUBL 2375-1997 1996 Summary of U.S Occupational Injuries Illnesses and Fatalities in the Petroleum Industry as Reported to the American Petroleum Institute Covering U.S Petrole.pdf API PUBL 2375-1997 1996 Summary of U.S Occupational Injuries Illnesses and Fatalities in the Petroleum Industry as Reported to the American Petroleum Institute Covering U.S Petrole.pdf
  • API PUBL 2376-1998 1997 Summary of U.S Occupational Injuries Illnesses and Fatalities in the Petroleum Industry As Reported to the American Petroleum Institute Covering U.S Petrole.pdf API PUBL 2376-1998 1997 Summary of U.S Occupational Injuries Illnesses and Fatalities in the Petroleum Industry As Reported to the American Petroleum Institute Covering U.S Petrole.pdf
  • API PUBL 2377-1999 1998 Summary of U.S Occupational Injuries Illnesses and Fatalities in the Petroleum Industry As Reported to the American Petroleum Institute Covering U.S Petrole.pdf API PUBL 2377-1999 1998 Summary of U.S Occupational Injuries Illnesses and Fatalities in the Petroleum Industry As Reported to the American Petroleum Institute Covering U.S Petrole.pdf
  • API PUBL 2378-2000 1999 Survey on Petroleum Industry Occupational Injuries Illnesses and Fatalities Summary Report Aggregate Data Only《1999年石油工业因职业而受伤、疾病和死亡的总结》.pdf API PUBL 2378-2000 1999 Survey on Petroleum Industry Occupational Injuries Illnesses and Fatalities Summary Report Aggregate Data Only《1999年石油工业因职业而受伤、疾病和死亡的总结》.pdf
  • API PUBL 2380-2002 2001 Survey on Petroleum Industry Occipational Injuries Illnesses and Fatalities summary Report Aggregate Data Only .pdf API PUBL 2380-2002 2001 Survey on Petroleum Industry Occipational Injuries Illnesses and Fatalities summary Report Aggregate Data Only .pdf
  • 相关搜索

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

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