【计算机类职业资格】全国计算机二级C语言上机试题62+2015年及答案解析.doc

上传人:feelhesitate105 文档编号:1329388 上传时间:2019-10-17 格式:DOC 页数:2 大小:32.50KB
下载 相关 举报
【计算机类职业资格】全国计算机二级C语言上机试题62+2015年及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】全国计算机二级C语言上机试题62+2015年及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、全国计算机二级 C语言上机试题 62+2015年及答案解析(总分:30.00,做题时间:90 分钟)1.给定程序中,函数 fun的功能是:把形参 s所指字符串中下标为奇数的字符右移到下一个奇数位置,最右边被移出字符串的字符绕回放到第一个奇数位置,下标为偶数的字符不动(注:字符串的长度大于等于2)。例如,形参 s所指的字符串为:abcdefgh,执行结果为:ahcbedgf。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANK1.C中。不得增行或删行,也不得更改程序的结构! 给定源程序: #include void fun(cha

2、r *s) int i, n, k; char c; n=0; for(i=0; si!=/0; i+) n+; /*found*/ if(n%2=0) k=n-_1_ ; else k=n-2; /*found*/ c=_2_ ; for(i=k-2; i=1; i=i-2) si+2=si; /*found*/ s1=_3_ ; main() char s80=“abcdefgh“; printf(“/nThe original string is : %s/n“,s); fun(s); printf(“/nThe result is : %s/n“,s); (分数:10.00)_2.给定

3、程序 MODI1.C中 fun 函数的功能是:求 s = aa aa - . - aaa - aa - a (此处 aa aa 表示 n 个 a, a 和 n 的值在 1 至 9 之间) 例如 a = 3, n = 6, 则以上表达式为: s = 333333 - 33333 - 3333 - 333 - 33 - 3 其值是:296298 a 和 n 是 fun 函数的形参,表达式的值作为函数值传回 main 函数。 请改正程序中的错误,使它能计算出正确的结果。 注意: 不要改动 main 函数,不得增行或删行,也不得更改程序的结构! 给定源程序: #include long fun (in

4、t a, int n) int j ; /*found*/ long s = 0, t = 1 ; for ( j = 0 ; j =1; i=i-2) si+2=si; /*found*/ s1=_3_ ; main() char s80=“abcdefgh“; printf(“/nThe original string is : %s/n“,s); fun(s); printf(“/nThe result is : %s/n“,s); (分数:10.00)_正确答案:(第一处:首先判断字符串的长度是奇数还是偶数,如果是奇数,则 k=n-1,所以应填:1。 第二处:取字符串最后一个奇数位的字

5、符,并由变量 c保存,所以应填:sk。 第三处:第 1位奇数位用最一个奇数位字符替换,所以应填:c。)解析:2.给定程序 MODI1.C中 fun 函数的功能是:求 s = aa aa - . - aaa - aa - a (此处 aa aa 表示 n 个 a, a 和 n 的值在 1 至 9 之间) 例如 a = 3, n = 6, 则以上表达式为: s = 333333 - 33333 - 3333 - 333 - 33 - 3 其值是:296298 a 和 n 是 fun 函数的形参,表达式的值作为函数值传回 main 函数。 请改正程序中的错误,使它能计算出正确的结果。 注意: 不要改动 main 函数,不得增行或删行,也不得更改程序的结构! 给定源程序: #include long fun (int a, int n) int j ; /*found*/ long s = 0, t = 1 ; for ( j = 0 ; j = a p+ ; )解析:

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 15072-2013 Chemicals used for treatment of swimming pool water - Sodium dichloroisocyanurate anhydrous German version EN 15072 2013《游泳池水处理用化学品 无水二氯异氰脲酸钠 德文版本EN 15072-2013》.pdf DIN EN 15072-2013 Chemicals used for treatment of swimming pool water - Sodium dichloroisocyanurate anhydrous German version EN 15072 2013《游泳池水处理用化学品 无水二氯异氰脲酸钠 德文版本EN 15072-2013》.pdf
  • DIN EN 15073-2013 Chemicals used for treatment of swimming pool water - Sodium dichloroisocyanurate dihydrate German version EN 15073 2013《用于处理游泳池水的化学品 二氯异氰尿酸钠 二水合物 德文版本EN 15073-20.pdf DIN EN 15073-2013 Chemicals used for treatment of swimming pool water - Sodium dichloroisocyanurate dihydrate German version EN 15073 2013《用于处理游泳池水的化学品 二氯异氰尿酸钠 二水合物 德文版本EN 15073-20.pdf
  • DIN EN 15074-2015 Chemicals used for treatment of swimming pool water - Ozone German version EN 15074 2014《游泳池水处理用化学制品 臭氧 德文版本EN 15074-2014》.pdf DIN EN 15074-2015 Chemicals used for treatment of swimming pool water - Ozone German version EN 15074 2014《游泳池水处理用化学制品 臭氧 德文版本EN 15074-2014》.pdf
  • DIN EN 15075-2013 Chemicals used for treatment of swimming pool water - Sodium hydrogen carbonate German version EN 15075 2013《游泳池水处理用化学试剂 碳酸氢钠 德文版本EN 15075-2013》.pdf DIN EN 15075-2013 Chemicals used for treatment of swimming pool water - Sodium hydrogen carbonate German version EN 15075 2013《游泳池水处理用化学试剂 碳酸氢钠 德文版本EN 15075-2013》.pdf
  • DIN EN 15076-2013 Chemicals used for treatment of swimming pool water - Sodium hydroxide German version EN 15076 2013《游泳池水处理用化学品 氢氧化钠 德文版本EN 15076-2013》.pdf DIN EN 15076-2013 Chemicals used for treatment of swimming pool water - Sodium hydroxide German version EN 15076 2013《游泳池水处理用化学品 氢氧化钠 德文版本EN 15076-2013》.pdf
  • DIN EN 15077-2013 Chemicals used for treatment of swimming pool water - Sodium hypochlorite German version EN 15077 2013《游泳池水处理用化学品 次氯酸钠 德文版本EN 15077-2013》.pdf DIN EN 15077-2013 Chemicals used for treatment of swimming pool water - Sodium hypochlorite German version EN 15077 2013《游泳池水处理用化学品 次氯酸钠 德文版本EN 15077-2013》.pdf
  • DIN EN 15078-2013 Chemicals used for treatment of swimming pool water - Sulfuric acid German version EN 15078 2013《用于处理游泳池水的化学品 硫酸 德文版本EN 15078-2013》.pdf DIN EN 15078-2013 Chemicals used for treatment of swimming pool water - Sulfuric acid German version EN 15078 2013《用于处理游泳池水的化学品 硫酸 德文版本EN 15078-2013》.pdf
  • DIN EN 15079-2015 Copper and copper alloys - Analysis by spark optical emission spectrometry (S-OES) German version EN 15079 2015《铜和铜合金 火花发射光谱测定法(S-OES)分析 德文版本EN 15079-2015》.pdf DIN EN 15079-2015 Copper and copper alloys - Analysis by spark optical emission spectrometry (S-OES) German version EN 15079 2015《铜和铜合金 火花发射光谱测定法(S-OES)分析 德文版本EN 15079-2015》.pdf
  • DIN EN 1508-1998 Water supply - Requirements for systems and components for the storage of water German version EN 1508 1998《供水 储水系统和组件要求》.pdf DIN EN 1508-1998 Water supply - Requirements for systems and components for the storage of water German version EN 1508 1998《供水 储水系统和组件要求》.pdf
  • 相关搜索

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

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