【计算机类职业资格】全国计算机二级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+ ; )解析:

展开阅读全文
相关资源
猜你喜欢
  • ETSI EG 202 192-2004 Speech Processing Transmission and Quality Aspects (STQ) Comparison of PBX transmission requirements in ANSI TIA-464-C and ETSI ES 201 168 V1 2 1 (V1 1 2)《语音处理_1.pdf ETSI EG 202 192-2004 Speech Processing Transmission and Quality Aspects (STQ) Comparison of PBX transmission requirements in ANSI TIA-464-C and ETSI ES 201 168 V1 2 1 (V1 1 2)《语音处理_1.pdf
  • ETSI EG 202 236-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Design guide Use of non-numeric names (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) 设计指南 非数字名称的.pdf ETSI EG 202 236-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Design guide Use of non-numeric names (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) 设计指南 非数字名称的.pdf
  • ETSI EG 202 236-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Design guide Use of non-numeric names (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) 设计指南 非数字名称的_1.pdf ETSI EG 202 236-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Design guide Use of non-numeric names (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) 设计指南 非数字名称的_1.pdf
  • ETSI EG 202 237-2010 Methods for Testing and Specification (MTS) Internet Protocol Testing (IPT) Generic approach to interoperability testing (V1 2 1)《测试方法和规范(MTS) 互联网协议测试(IPT) 互用性.pdf ETSI EG 202 237-2010 Methods for Testing and Specification (MTS) Internet Protocol Testing (IPT) Generic approach to interoperability testing (V1 2 1)《测试方法和规范(MTS) 互联网协议测试(IPT) 互用性.pdf
  • ETSI EG 202 237-2010 Methods for Testing and Specification (MTS) Internet Protocol Testing (IPT) Generic approach to interoperability testing (V1 2 1)《测试方法和规范(MTS) 互联网协议测试(IPT) 互用性_1.pdf ETSI EG 202 237-2010 Methods for Testing and Specification (MTS) Internet Protocol Testing (IPT) Generic approach to interoperability testing (V1 2 1)《测试方法和规范(MTS) 互联网协议测试(IPT) 互用性_1.pdf
  • ETSI EG 202 238-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Evaluation criteria for cryptographic algorithms (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) .pdf ETSI EG 202 238-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Evaluation criteria for cryptographic algorithms (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) .pdf
  • ETSI EG 202 238-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Evaluation criteria for cryptographic algorithms (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) _1.pdf ETSI EG 202 238-2003 Telecommunications and Internet Protocol Harmonization Over Networks (TIPHON) Evaluation criteria for cryptographic algorithms (V1 1 1)《网络上电信和互联网协议的协调(TIPHON) _1.pdf
  • ETSI EG 202 249-2003 Universal Communications Identifier (UCI) Guidelines on the usability of UCI based systems (V1 1 1)《通用通信标识符(UCI) 基于UCI系统的可用性指南(版本1 1 1)》.pdf ETSI EG 202 249-2003 Universal Communications Identifier (UCI) Guidelines on the usability of UCI based systems (V1 1 1)《通用通信标识符(UCI) 基于UCI系统的可用性指南(版本1 1 1)》.pdf
  • ETSI EG 202 301-2004 Universal Communications Identifier (UCI) Using UCI to enhance communications for disabled young and elderly people (V1 1 1)《通用通信标识符(UCI) 使用UCI为残疾人 儿童及老人提高通信能力.pdf ETSI EG 202 301-2004 Universal Communications Identifier (UCI) Using UCI to enhance communications for disabled young and elderly people (V1 1 1)《通用通信标识符(UCI) 使用UCI为残疾人 儿童及老人提高通信能力.pdf
  • 相关搜索

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

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