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

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

1、全国计算机二级 C语言上机试题 23+2015年及答案解析(总分:30.00,做题时间:90 分钟)1.给定程序中,函数 fun的功能是:找出 NN矩阵中每列元素中的最大值,并按顺序依次存放于形参 b所指的一维数组中。 请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANK1.C中。不得增行或删行,也不得更改程序的结构! 给定源程序:#include #define N 4 void fun(int (*a)N, int *b) int i,j; for(i=0; i /*found*/ bi= _1_; for(j=1; j /

2、found*/ if(bi _2_ aji) bi=aji; main() int xNN= 12,5,8,7,6,1,9,3,1,2,3,4,2,8,4,3 ,yN,i,j; printf(“/nThe matrix :/n“); for(i=0;i for(j=0;j printf(“/n“); /*found*/ fun(_3_); printf(“/nThe result is:“); for(i=0; iprintf(“/n“); (分数:10.00)_2.给定程序 MODI1.C中函数 fun的功能是: 交换主函数中两个变量的值。例如: 若变量 a中的值原为 8,b中的值为 3。

3、程序运行后 a中的值为 3, b中的值为 8。 请改正程序中的错误, 使它能计算出正确的结果。注意: 不要改动 main 函数, 不得增行或删行, 也不得更改程序的结构! 给定源程序: #include /*found*/ int fun(int x,int y) int t; /*found*/ t=x;x=y;y=t; main() int a,b; a=8;b=3; fun( printf(“%d, %d/n“,a,b); (分数:10.00)_3.编写函数 fun, 函数的功能是求出小于或等于 lim的所有素数并放在 aa数组中,函数返回所求出的素数的个数。函数 fun中给出的语句仅供参考。 注意:部分源程序在文件 PROG1.C中。请勿改动主函数 main和其它函数中的任何内容,仅在函数 fun的花括号中填入你编写的若干语句。 给定源程序: #include #define MAX 100 int fun(int lim, int aaMAX) /* 以下代码仅供参考 */ int i,j,k=0; /* 其中变量 k用于统计素数个数 */ for(i=2;i (i/2) aak+ = i; return k; )解析:解题思路: 本题是考察考生如何判断一个数是素数,再求出所有小于 lim数的素数并存入数组 aa中保存,最后由形参 aa返回,素数的个数由函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • IEC TS 62344-2013 Design of earth electrode stations for high-voltage direct current (HVDC) links - General guidelines《高压直流(HVDC)连接用接地电极站的设计.通用导则》.pdf IEC TS 62344-2013 Design of earth electrode stations for high-voltage direct current (HVDC) links - General guidelines《高压直流(HVDC)连接用接地电极站的设计.通用导则》.pdf
  • IEC TS 62351-2-2008 Power systems management and associated information exchange - Data and communications security - Part 2 Glossary of terms《电力系统管理和相关信息交换.数据和通信安全.第2部分 术语表》.pdf IEC TS 62351-2-2008 Power systems management and associated information exchange - Data and communications security - Part 2 Glossary of terms《电力系统管理和相关信息交换.数据和通信安全.第2部分 术语表》.pdf
  • IEC TS 62367-2004 Safety aspects for xDSL signals on circuits connected to telecommunication networks (DSL Digital Subscriber Line)《连接通信网络的电路的xDSL信号的安全情况》.pdf IEC TS 62367-2004 Safety aspects for xDSL signals on circuits connected to telecommunication networks (DSL Digital Subscriber Line)《连接通信网络的电路的xDSL信号的安全情况》.pdf
  • IEC TS 62393-2005 Portable and hand-held multimedia equipment - Mobile computers - Battery run-time measurement《便携式和手持式多媒体设备.移动计算机.蓄电池运行时间的测量》.pdf IEC TS 62393-2005 Portable and hand-held multimedia equipment - Mobile computers - Battery run-time measurement《便携式和手持式多媒体设备.移动计算机.蓄电池运行时间的测量》.pdf
  • IEC TS 62398-2004 Ferrite cores - Technology approval schedule (TAS)《铁氧体磁心.技术验收方案(TAS)》.pdf IEC TS 62398-2004 Ferrite cores - Technology approval schedule (TAS)《铁氧体磁心.技术验收方案(TAS)》.pdf
  • IEC TS 62436-2008 Guideline for implementation of copy controlled multimedia interface《复印控制多媒体接口的执行用指南》.pdf IEC TS 62436-2008 Guideline for implementation of copy controlled multimedia interface《复印控制多媒体接口的执行用指南》.pdf
  • IEC TS 62441-2011 Safeguards against accidentally caused candle flame ignition for audio video communication and information technology equipment《音频 视频 通讯和信息技术设备因蜡烛点燃引起的意外事故保护措施》.pdf IEC TS 62441-2011 Safeguards against accidentally caused candle flame ignition for audio video communication and information technology equipment《音频 视频 通讯和信息技术设备因蜡烛点燃引起的意外事故保护措施》.pdf
  • IEC TS 62443-1-1-2009 Industrial communication networks - Network and system security - Part 1 Terminology concepts and models《工业通信网络.网络和系统安全.第1部分 术语 概念和模型》.pdf IEC TS 62443-1-1-2009 Industrial communication networks - Network and system security - Part 1 Terminology concepts and models《工业通信网络.网络和系统安全.第1部分 术语 概念和模型》.pdf
  • IEC TS 62462-2017 Ultrasonics - Output test - Guidance for the maintenance of ultrasound physiotherapy systems《超音波学.输出试验.超频率音响理疗设备的维护指南》.pdf IEC TS 62462-2017 Ultrasonics - Output test - Guidance for the maintenance of ultrasound physiotherapy systems《超音波学.输出试验.超频率音响理疗设备的维护指南》.pdf
  • 相关搜索

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

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