【计算机类职业资格】全国计算机二级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返回,素数的个数由函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN ISO 8987-2005 Plastics - Phenolic resins - Determination of reactivity on a B-transformation test plate (ISO 8987 2005) English version of DIN EN ISO 8987 2005《塑料 酚醛树脂 在B转变试.pdf DIN EN ISO 8987-2005 Plastics - Phenolic resins - Determination of reactivity on a B-transformation test plate (ISO 8987 2005) English version of DIN EN ISO 8987 2005《塑料 酚醛树脂 在B转变试.pdf
  • DIN EN ISO 8988-2006 Plastics - Phenolic resins - Determination of hexamethylenetetramine content - Kjeldahl method perchloric acid method and hydrochloric acid method (ISO 8988 20.pdf DIN EN ISO 8988-2006 Plastics - Phenolic resins - Determination of hexamethylenetetramine content - Kjeldahl method perchloric acid method and hydrochloric acid method (ISO 8988 20.pdf
  • DIN EN ISO 8989-1998 Plastics - Phenolic resins - Determination of water miscibility (ISO 8989 1995) German version EN ISO 8989 1998《塑料 酚醛树脂 水溶物的测定》.pdf DIN EN ISO 8989-1998 Plastics - Phenolic resins - Determination of water miscibility (ISO 8989 1995) German version EN ISO 8989 1998《塑料 酚醛树脂 水溶物的测定》.pdf
  • DIN EN ISO 899-2-2015 Plastics - Determination of creep behaviour - Part 2 Flexural creep by three-point loading (ISO 899-2 2003 + Amd 1 2015) German version EN ISO 899-2 2003 + A1.pdf DIN EN ISO 899-2-2015 Plastics - Determination of creep behaviour - Part 2 Flexural creep by three-point loading (ISO 899-2 2003 + Amd 1 2015) German version EN ISO 899-2 2003 + A1.pdf
  • DIN EN ISO 8990-1996 Thermal insulation - Determination of steady-state thermal transmission properties - Calibrated and guarded hot box (ISO 8990 1994) German version EN ISO 8990 .pdf DIN EN ISO 8990-1996 Thermal insulation - Determination of steady-state thermal transmission properties - Calibrated and guarded hot box (ISO 8990 1994) German version EN ISO 8990 .pdf
  • DIN EN ISO 8993-2010 Anodizing of aluminium and its alloys - Rating system for the evaluation of pitting corrosion - Chart method (ISO 8993 2010) German version EN ISO 8993 2010《铝和.pdf DIN EN ISO 8993-2010 Anodizing of aluminium and its alloys - Rating system for the evaluation of pitting corrosion - Chart method (ISO 8993 2010) German version EN ISO 8993 2010《铝和.pdf
  • DIN EN ISO 8994-2011 Anodizing of aluminium and its alloys - Rating system for the evaluation of pitting corrosion - Grid method (ISO 8994 2011) German version EN ISO 8994 2011《铝和铝.pdf DIN EN ISO 8994-2011 Anodizing of aluminium and its alloys - Rating system for the evaluation of pitting corrosion - Grid method (ISO 8994 2011) German version EN ISO 8994 2011《铝和铝.pdf
  • DIN EN ISO 8996-2005 Ergonomics of the thermal environment - Determination of metabolic rate (ISO 8996 2004) German version EN ISO 8996 2004《热环境的人类工效学 代谢率的测定》.pdf DIN EN ISO 8996-2005 Ergonomics of the thermal environment - Determination of metabolic rate (ISO 8996 2004) German version EN ISO 8996 2004《热环境的人类工效学 代谢率的测定》.pdf
  • DIN EN ISO 90-1-1999 Light gauge metal containers - Definitions and determination of dimensions and capacities - Part 1 Open-top cans (ISO 90-1 1997) German version EN ISO 90-1 199.pdf DIN EN ISO 90-1-1999 Light gauge metal containers - Definitions and determination of dimensions and capacities - Part 1 Open-top cans (ISO 90-1 1997) German version EN ISO 90-1 199.pdf
  • 相关搜索

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

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