【计算机类职业资格】计算机二级(C)上机考试30及答案解析.doc

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

1、计算机二级(C)上机考试 30及答案解析(总分:-3.00,做题时间:120 分钟)1.填空题 请补充 main函数,该函数的功能是:把一个字符串中的所有小写字母字符全部转换成大写字母字符,其他字符不变,结果保存原来的字符串中。 例如:当 strN=“123 abcdef ABCDEF!”,结果输出:“123 ABCDEF ABCDEF!”。 注意:部分源程序给出如下。 请勿改动主函数 main和其他函数中的任何内容,仅在函数 fun的横线上填入所编写的若干表达式或语句。 试题程序: #include #include #include #define N 80 void main() int

2、 j; char strN=“ 123abcdef ABCDEF!“; char *pf=str; clrscr(); printf(“*original string */n“); puts(str); 【1】; while(*(pf+j) if(*(pf+j)=a for(j=2; j=a for(j=2; j=high/2; j+) /*found*/ ifhigh%j=0 yes=0; break; /*found*/ if(yes=0) sum+=high; n+; high-; return sum; main() clrscr(); printf(“%d/n“,fun(100);

3、 (分数:-1.00)_正确答案:((1)错误:ifhigh%j=0 正确:if(high%j=0) (2)错误:if(yes=0) 正确:if(yes) )解析:错误 1:if 语句的两侧要加括号。 错误 2:yes 为 1时,说明被判断的数为素数,要加入总和。 3.编程题 请编写函数 fun,其功能是:将两个两位数的正整数 a、b 合并形成一个整数放在 c中。合并的方式是:将 a数的十位和个位数依次放在 c数个位和十位上,b 数的十位和个位数依次放在 c数的百位和千位上。 例如,当 a=16,b=35,调用该函数后,c=5361。 注意:部分源程序给出如下。 请勿改动主函数 main和其他

4、函数中的任何内容,仅在函数 fun的花括号中填入所编写的若干语句。 试题程序: #include void fun(int a ,int b,long *c) main() int a,b; long c; clrscr(); printf(“Input a,b;“); scanf(“%d%d“, fun(a,b, printf(“The result is:%ld/n“,c); (分数:-1.00)_正确答案:(void fun(int a ,int b,long *c) *c=(b%10)*1000+(b/10)*100+(a%10)*10+a/10; )解析:语句*c=(b%10)*1000+(b/10)*100+(a%10)*10+a/10;是将 a数的十位和个位数依次放在 c数个位和十位上,b 数的十位和个位数依次放在 c数的百位和千位上。注意“/“和“%“的用法。

展开阅读全文
相关资源
猜你喜欢
  • EN 14399-8-2007 en High-strength structural bolting assemblies for preloading - Part 8 System HV - Hexagon fit bolt and nut assemblies《预负载高强度结构螺栓组件 第8部分 HV系统 六角配合螺栓和螺母组件》.pdf EN 14399-8-2007 en High-strength structural bolting assemblies for preloading - Part 8 System HV - Hexagon fit bolt and nut assemblies《预负载高强度结构螺栓组件 第8部分 HV系统 六角配合螺栓和螺母组件》.pdf
  • EN 14399-9-2009 en High-strength structural bolting assemblies for preloading - Part 9 System HR or HV - Direct tension indicators for bolt and nut assemblies《预加负荷用高强度结构螺栓组件 第9部分 H.pdf EN 14399-9-2009 en High-strength structural bolting assemblies for preloading - Part 9 System HR or HV - Direct tension indicators for bolt and nut assemblies《预加负荷用高强度结构螺栓组件 第9部分 H.pdf
  • EN 14399-9-2018 en High-strength structural bolting assemblies for preloading - Part 9 System HR or HV - Direct tension indicators for bolt and nut assemblies.pdf EN 14399-9-2018 en High-strength structural bolting assemblies for preloading - Part 9 System HR or HV - Direct tension indicators for bolt and nut assemblies.pdf
  • EN 14401-2004 en Rigid plastics containers - Methods to test the effectiveness of closures《硬塑料容器 闭塞物有效性的试验方法》.pdf EN 14401-2004 en Rigid plastics containers - Methods to test the effectiveness of closures《硬塑料容器 闭塞物有效性的试验方法》.pdf
  • EN 14404-2004 en Personal protective equipment - Knee protectors for work in the kneeling position (Incorporates Amendment A1 2010)《个人防护设备 跪射姿势工作使用的护膝 包含修改件A1-2010》.pdf EN 14404-2004 en Personal protective equipment - Knee protectors for work in the kneeling position (Incorporates Amendment A1 2010)《个人防护设备 跪射姿势工作使用的护膝 包含修改件A1-2010》.pdf
  • EN 14405-2017 en Characterization of waste - Leaching behaviour test - Upflow percolation test (under specified conditions)《垃圾分类-沥滤性能试验-(指定条件下)上流渗漏试验》.pdf EN 14405-2017 en Characterization of waste - Leaching behaviour test - Upflow percolation test (under specified conditions)《垃圾分类-沥滤性能试验-(指定条件下)上流渗漏试验》.pdf
  • EN 14406-2004 en Products and systems for the protection and repair of concrete structures - Test methods - Determination of the expansion ratio and expansion evolution《混凝土结构保护和修缮用.pdf EN 14406-2004 en Products and systems for the protection and repair of concrete structures - Test methods - Determination of the expansion ratio and expansion evolution《混凝土结构保护和修缮用.pdf
  • EN 14407-2004 en Water quality Guidance standard for the identification enumeration and interpretation of benthic diatom samples from running waters《水质 流动水中海底硅藻样品的识别 计数和表示用指南标准》.pdf EN 14407-2004 en Water quality Guidance standard for the identification enumeration and interpretation of benthic diatom samples from running waters《水质 流动水中海底硅藻样品的识别 计数和表示用指南标准》.pdf
  • EN 14410-2003 en Self adhesive tapes - Measurement of breaking strength and elongation at break《自粘胶带 断裂强度和断裂伸长率的测量》.pdf EN 14410-2003 en Self adhesive tapes - Measurement of breaking strength and elongation at break《自粘胶带 断裂强度和断裂伸长率的测量》.pdf
  • 相关搜索
    资源标签

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

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