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

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

1、全国计算机等级考试二级 C 语言操作题 23+2016 年及答案解析(总分: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(

2、j=1; j /*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 中的值原为

3、 8,b中的值为 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 数组中,函数返回所求出的素数的个数

4、函数 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 返回,素数的个数由函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • EN ISO 11378-2-2001 en Textile Floor Coverings - Laboratory Soiling Tests - Part 2 Drum Test《纺织地板覆盖物 实验室弄脏试验 第2部分 转鼓试验 ISO 11378-2-2001》.pdf EN ISO 11378-2-2001 en Textile Floor Coverings - Laboratory Soiling Tests - Part 2 Drum Test《纺织地板覆盖物 实验室弄脏试验 第2部分 转鼓试验 ISO 11378-2-2001》.pdf
  • EN ISO 11380-1996 en Optics and Optical Instruments - Ophthalmic Optics - Formers《光学和光学仪器 眼科光学器件 框架ISO 11380-1994》.pdf EN ISO 11380-1996 en Optics and Optical Instruments - Ophthalmic Optics - Formers《光学和光学仪器 眼科光学器件 框架ISO 11380-1994》.pdf
  • EN ISO 11381-1996 Optics and optical instruments - Ophthalmic optics - Screw threads (ISO 11381 1994)《光学和光学仪器 眼科光学 螺纹》.pdf EN ISO 11381-1996 Optics and optical instruments - Ophthalmic optics - Screw threads (ISO 11381 1994)《光学和光学仪器 眼科光学 螺纹》.pdf
  • EN ISO 11381-2016 en Ophthalmic optics - Spectacle frames - Screw threads《眼科光学眼镜架螺纹(ISO 11381 2016)》.pdf EN ISO 11381-2016 en Ophthalmic optics - Spectacle frames - Screw threads《眼科光学眼镜架螺纹(ISO 11381 2016)》.pdf
  • EN ISO 11399-2000 en Ergonomics of the Thermal Environment - Principles and Application of Relevant International Standards《热环境人类工效学 相关国际标准的原则与应用》.pdf EN ISO 11399-2000 en Ergonomics of the Thermal Environment - Principles and Application of Relevant International Standards《热环境人类工效学 相关国际标准的原则与应用》.pdf
  • EN ISO 11401-1998 en Plastics - Phenolic Resins - Separation by Liquid Chromatography《塑料 酚醛树脂 用液体色谱法分离ISO 11401-1993》.pdf EN ISO 11401-1998 en Plastics - Phenolic Resins - Separation by Liquid Chromatography《塑料 酚醛树脂 用液体色谱法分离ISO 11401-1993》.pdf
  • EN ISO 11402-2005 en Plastics - Condensation Resins - Determination of Free Formaldehyde《塑料 酚醛树脂 氨基树脂和缩合树脂 游离甲醛含量的测定 ISO 11402-1993 代替EN ISO 9397-1997和EN ISO 9020-1998》.pdf EN ISO 11402-2005 en Plastics - Condensation Resins - Determination of Free Formaldehyde《塑料 酚醛树脂 氨基树脂和缩合树脂 游离甲醛含量的测定 ISO 11402-1993 代替EN ISO 9397-1997和EN ISO 9020-1998》.pdf
  • EN ISO 11403-1-2014 en Plastics - Acquisition and presentation of comparable multipoint data - Part 1 Mechanical properties《塑料 可比多点数据的采集和表示 第1部分 机械性能(ISO 11403-1 2014)》.pdf EN ISO 11403-1-2014 en Plastics - Acquisition and presentation of comparable multipoint data - Part 1 Mechanical properties《塑料 可比多点数据的采集和表示 第1部分 机械性能(ISO 11403-1 2014)》.pdf
  • EN ISO 11403-2-2012 en Plastics - Acquisition and presentation of comparable multipoint data - Part 2 Thermal and processing properties《塑料 可比多点数据的采集和表示 第2部分 热和加工性能》.pdf EN ISO 11403-2-2012 en Plastics - Acquisition and presentation of comparable multipoint data - Part 2 Thermal and processing properties《塑料 可比多点数据的采集和表示 第2部分 热和加工性能》.pdf
  • 相关搜索

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

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