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

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

1、全国计算机二级 C语言上机试题 65+2015年及答案解析(总分:30.00,做题时间:90 分钟)1.给定程序中,函数 fun的功能是:将 a所指 43矩阵中第 k行的元素与第 0行元素交换。 例如,有下列矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 若 k为 2,程序执行结果为: 7 8 9 4 5 6 1 2 3 10 11 12 请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANK1.C中。不得增行或删行,也不得更改程序的结构! 给定源程序: #include #define N 3 #define M

2、4 /*found*/ void fun(int (*a)N, int _1_) int i,j,temp ; /*found*/ for(i = 0 ; i tj+1)。)解析:3.请编写一个函数 fun, 其功能是: 将 ss所指字符串中所有下标为奇数位置上的字母转换为大写(若该位置上不是字母, 则不转换)。 例如, 若输入“abc4EFg“,则应输出“aBc4EFg“。 注意: 部分源程序在文件 PROG1.C文件中。 请勿改动主函数 main和其它函数中的任何内容, 仅在函数 fun的花括号中填入你编写的若干语句。 给定源程序: #include #include void fun(

3、char *ss ) void main( void ) char tt51; printf( “/nPlease enter an character string within 50 characters:/n“ ); gets( tt ); printf( “/n/nAfter changing, the string/n /“%s/“, tt ); fun(tt) ; printf( “/nbecomes/n /“%s/“, tt ); NONO(); (分数:10.00)_正确答案:(void fun( char *ss ) char *p = ss ; int i = 0 ; wh

4、ile(*p) if(i % 2) p+ ; i+ ; return ss ; )解析:解题思路: 本题是考察考生在字符串指定位置上的字母转换为大写。给出的程序是由 i来控制字符串所在的位置,字符串指针 p是指向形参 ss,再使用 while循环语句对 p进行控制来判断字符串是否结束,在循环体中使用 if条件语句来判断位置 i是否为奇数且 p所指的当前字符是否为a至z的字母,如果满足这两个条件,则把该小写字母转换成大写字符,小写字母与大写字母的差是 32,所以只小写字母减去 32,即可得到该字母的大写字母,且转换后的字母仍存放到原字符串的位置上,转换结束后,最后通过形参 ss返回已转换后的字符串。

展开阅读全文
相关资源
猜你喜欢
  • EN ISO 10113-2014 en Metallic materials - Sheet and strip - Determination of plastic strain ratio《金属材料 薄板和薄带塑性应变比试验方法(ISO 10113 2006 Corrected version 2007-08-01)》.pdf EN ISO 10113-2014 en Metallic materials - Sheet and strip - Determination of plastic strain ratio《金属材料 薄板和薄带塑性应变比试验方法(ISO 10113 2006 Corrected version 2007-08-01)》.pdf
  • EN ISO 10121-1-2014 en Test method for assessing the performance of gas-phase air cleaning media and devices for general ventilation - Part 1 Gasphase air cleaning media《评估整体通风用气相空.pdf EN ISO 10121-1-2014 en Test method for assessing the performance of gas-phase air cleaning media and devices for general ventilation - Part 1 Gasphase air cleaning media《评估整体通风用气相空.pdf
  • EN ISO 10121-2-2013 en Test methods for assessing the performance of gas-phase air cleaning media and devices for general ventilation - Part 2 Gasphase air cleaning devices (GPACD).pdf EN ISO 10121-2-2013 en Test methods for assessing the performance of gas-phase air cleaning media and devices for general ventilation - Part 2 Gasphase air cleaning devices (GPACD).pdf
  • EN ISO 10133-2012 en Small craft - Electrical systems - Extra-low-voltage d c installations《小工艺 电力系统Extra-low-voltage特区安装》.pdf EN ISO 10133-2012 en Small craft - Electrical systems - Extra-low-voltage d c installations《小工艺 电力系统Extra-low-voltage特区安装》.pdf
  • EN ISO 10133-2017 en Small craft - Electrical systems - Extra-low-voltage d c installations.pdf EN ISO 10133-2017 en Small craft - Electrical systems - Extra-low-voltage d c installations.pdf
  • EN ISO 10135-2009 en Geometrical product specifications (GPS) - Drawing indications for moulded parts in technical product documentation (TPD)《产品的几何规范(GPS) 技术产品文档(TPD)中的模压部件的图纸标示》.pdf EN ISO 10135-2009 en Geometrical product specifications (GPS) - Drawing indications for moulded parts in technical product documentation (TPD)《产品的几何规范(GPS) 技术产品文档(TPD)中的模压部件的图纸标示》.pdf
  • EN ISO 10139-1-2005 en Dentistry - Soft lining materials for removable dentures - Part 1 Materials for short-term use《牙科学 活动义齿软衬材料 第1部分 短期材料 ISO 10139-1-2005 代替EN 30139-1-1994》.pdf EN ISO 10139-1-2005 en Dentistry - Soft lining materials for removable dentures - Part 1 Materials for short-term use《牙科学 活动义齿软衬材料 第1部分 短期材料 ISO 10139-1-2005 代替EN 30139-1-1994》.pdf
  • EN ISO 10139-1-2018 en Dentistry - Soft lining materials for removable dentures - Part 1 Materials for short-term use.pdf EN ISO 10139-1-2018 en Dentistry - Soft lining materials for removable dentures - Part 1 Materials for short-term use.pdf
  • EN ISO 10139-2-2009 6875 Dentistry - Soft lining materials for removable dentures - Part 2 Materials for long-term use《牙科 活动假牙用弹性衬料 第2部分 长期材料》.pdf EN ISO 10139-2-2009 6875 Dentistry - Soft lining materials for removable dentures - Part 2 Materials for long-term use《牙科 活动假牙用弹性衬料 第2部分 长期材料》.pdf
  • 相关搜索

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

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