[计算机类试卷]国家二级(C语言)机试模拟试卷360及答案与解析.doc

上传人:confusegate185 文档编号:503120 上传时间:2018-11-29 格式:DOC 页数:5 大小:30KB
下载 相关 举报
[计算机类试卷]国家二级(C语言)机试模拟试卷360及答案与解析.doc_第1页
第1页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷360及答案与解析.doc_第2页
第2页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷360及答案与解析.doc_第3页
第3页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷360及答案与解析.doc_第4页
第4页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷360及答案与解析.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级( C语言)机试模拟试卷 360及答案与解析 一、程序填空题( 30分) 1 函数 fun的功能是:逆置数组元素中的值。例如:若 a所指数组中的数据依次为: 1、 2、 3、 4、 5、 6、 7、 8、 9,则逆置后依次为: 9、 8、 7、 6、 5、 4、 3、 2、1。形参 n给出数组中数据的个数。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANKl C中。 不得增行或删行,也不得更改程序的结构 ! #include void fun(int a, int n) int i, t; *found* for(i=

2、0; i #include typedef struct aa int data; struct aa *next; NODE; NODE *Creatlink(int n, int m) NODE *h=NULL, *p, *s; int i; /*found*/ p=(NODE )malloc(sizeof(NODE); h=p; p-next=NULL; for(i=1; idata=rand()%m; s-next=p-next; p-next=s; p=p-next; /*found*/ return p; outlink(NODE *h) NODE *p; p=h-next; pr

3、intf(“nnTHE LIST :nn HEAD “); while(p) printf(“-%d “,p-data); p=p-next; printf(“n“); main() NODE *head; head=Creatlink(8,22); outlink(head); 三、程序设计题( 40分) 3 请编写一个函数 fun,它的功能是:将 ss所指字符串中所有下标为奇数位置上的字母转换为大写 (若该位置上不是字母,则不转换 )。 例如,若输入 ”abc4EFg”,则应输出 ”aBc4EFg”。 注意:部分源程序存在文件 PROGl C中。 请勿改动主函数 main和其他函数中的任何

4、内容,仅在函数 fun的花括号中填入你编写的若干语句。 #include #include void fun (char *ss) main() char tt81 ; void NONO (); printf(“nPlease enter an string within 80 characters:n“); gets(tt); printf(“nnAfter changing, the stringn “%s“, tt); fun(tt); printf(“nbecomesn “%s“n“, tt); NONO (); void NONO () /* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *fp, *wf ; char tt81 ; int i ; fp = fopen(“in.dat“,“r“); wf = fopen(“out.dat“,“w“); for(i = 0 ; i =a 【试题解析】 ( 1)首先取得字符串中下标为奇数的字符。 ( 2)判断奇数位置的字符是否为小写字母。 ( 3)若( 2)中的判断 结果是小写字母,则对其进行转换。

展开阅读全文
相关资源
猜你喜欢
  • BS PD CEN TR 15840-2009 Evaluation of nconformity of fly nash for concrete — nGuidelines for the napplication of EN 450-2《混凝土用粉煤灰的符合性评估 EN 450-2标准的应用指南》.pdf BS PD CEN TR 15840-2009 Evaluation of nconformity of fly nash for concrete — nGuidelines for the napplication of EN 450-2《混凝土用粉煤灰的符合性评估 EN 450-2标准的应用指南》.pdf
  • BS PD CEN TR 15855-2009 Construction products n— Assessment of nrelease of dangerous nsubstances — Barriers nto trade《建材产品 危险物质的释放评估 贸易壁垒》.pdf BS PD CEN TR 15855-2009 Construction products n— Assessment of nrelease of dangerous nsubstances — Barriers nto trade《建材产品 危险物质的释放评估 贸易壁垒》.pdf
  • BS PD CEN TR 15858-2009 Construction products n— Assessment of the nrelease of regulated ndangerous substances nfrom construction nproducts based on nthe WT WFT FT nproced.pdf BS PD CEN TR 15858-2009 Construction products n— Assessment of the nrelease of regulated ndangerous substances nfrom construction nproducts based on nthe WT WFT FT nproced.pdf
  • BS PD CEN TR 15868-2009 9375 Survey of national nrequirements used in nconjunction with EN n206-1 2000《需要与EN 206-1 2000标准一起使用的各国要求调查》.pdf BS PD CEN TR 15868-2009 9375 Survey of national nrequirements used in nconjunction with EN n206-1 2000《需要与EN 206-1 2000标准一起使用的各国要求调查》.pdf
  • BS PD CEN TR 15872-2014 Health informatics Guidance on patient identification and cross-referencing of identities《健康信息学 患者识别和身份交叉引用指南》.pdf BS PD CEN TR 15872-2014 Health informatics Guidance on patient identification and cross-referencing of identities《健康信息学 患者识别和身份交叉引用指南》.pdf
  • BS PD CEN TR 15874-2009 3750 Railway applications n— Noise emission — nRoad test of standard nfor rail roughness nmeasurement EN n15610 2009《轨道交通 噪声排放 铁轨粗糙度测量用公路标准试验EN 15610-2009》.pdf BS PD CEN TR 15874-2009 3750 Railway applications n— Noise emission — nRoad test of standard nfor rail roughness nmeasurement EN n15610 2009《轨道交通 噪声排放 铁轨粗糙度测量用公路标准试验EN 15610-2009》.pdf
  • BS PD CEN TR 15894-2009 Building hardware - Door fittings for use by children elderly and disabled people in domestic and public buildings - A guide for specifiers 《建筑五金件.pdf BS PD CEN TR 15894-2009 Building hardware - Door fittings for use by children elderly and disabled people in domestic and public buildings - A guide for specifiers 《建筑五金件.pdf
  • BS PD CEN TR 15913-2009 Spectator facilities n— Layout criteria nfor viewing area for nspectators with special nneeds《观众设施 有特殊需要观众观赏区域的布置标准》.pdf BS PD CEN TR 15913-2009 Spectator facilities n— Layout criteria nfor viewing area for nspectators with special nneeds《观众设施 有特殊需要观众观赏区域的布置标准》.pdf
  • BS PD CEN TR 15917-2009 Textiles — nCosmetotextiles《纺织品 美容纺织品》.pdf BS PD CEN TR 15917-2009 Textiles — nCosmetotextiles《纺织品 美容纺织品》.pdf
  • 相关搜索

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

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