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

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

1、国家二级( C语言)机试模拟试卷 268及答案与解析 一、程序填空题( 30分) 1 给定程序中,函数 fun的功能是:将形参 s所指字符串中的所有字母字符顺序前移,其他字符顺序后移,处理后新字符串的首地址作为函数值返回。 例如, s所指字符串为: asdl23fgh543df,处理后新字符串为: asdfghdfl23543。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANKl C中。 不得增行或删行,也不得 更改程序的结构 ! #include #include #include char *fun(char *s) in

2、t i, j, k, n; char *p, *t; n=strlen(s)+1; t=(char*)malloc(n*sizeof(char); p=(char*)malloc(n*sizeof(char); j=0; k=0; for(i=0; i=a)&(si=A)&(si #define N 20 int fun(float*s, int n, float *aver) float ave, t=0 0; int count=0, k, i; for(k=0; k=k,因此第二空处应为 “k”。 第三空:在 C语言中,字符串以 “0”结束,故第三处应为 “0”或 “0”。 二、程序 修改题( 30分) 2 【正确答案】 (1)t+=sk; (2)*aver=ave; 【试题解析】 (1)根据题目要求求出平均分,首先要求总分,要把所有学生成绩相加再求平均分,因此第一个标识下面的 “t=sk; “应改为 “t+=sk; “。 (2)根据题目可知,比较的结果中高于平均分的分数 ave放入指针 aver所指的地址单元中,而变量 Ave没有定义,因此第二标识下应将 “*aver=Ave; “改为“*aver=ave; “。

展开阅读全文
相关资源
猜你喜欢
  • BS ISO IEC 29109-9-2011 Information technology Conformance testing methodology for biometric data interchange formats defined in ISO IEC 19794 Vascular image data《信息技术 ISO.pdf BS ISO IEC 29109-9-2011 Information technology Conformance testing methodology for biometric data interchange formats defined in ISO IEC 19794 Vascular image data《信息技术 ISO.pdf
  • BS ISO IEC 29115-2013 Information technology Security techniques Entity authentication assurance framework《信息技术 安全技术 实体验证保证框架》.pdf BS ISO IEC 29115-2013 Information technology Security techniques Entity authentication assurance framework《信息技术 安全技术 实体验证保证框架》.pdf
  • BS ISO IEC 29120-1-2015 Information technology Machine readable test data for biometric testing and reporting Test reports《信息技术 生物计量试验和报告用机器可读试验数据 试验报告》.pdf BS ISO IEC 29120-1-2015 Information technology Machine readable test data for biometric testing and reporting Test reports《信息技术 生物计量试验和报告用机器可读试验数据 试验报告》.pdf
  • BS ISO IEC 29128-2012 Information technology Security techniques Verification of cryptographic protocols《信息技术 安全技术 密码协议验证》.pdf BS ISO IEC 29128-2012 Information technology Security techniques Verification of cryptographic protocols《信息技术 安全技术 密码协议验证》.pdf
  • BS ISO IEC 29133-2012 Information technology Automatic identification and data capture techniques Quality test specification for rewritable hybrid media data carriers《信息技术.pdf BS ISO IEC 29133-2012 Information technology Automatic identification and data capture techniques Quality test specification for rewritable hybrid media data carriers《信息技术.pdf
  • BS ISO IEC 29134-2017 Information technology Security techniques Guidelines for privacy impact assessment《信息技术 安全技术 隐私影响评定指南》.pdf BS ISO IEC 29134-2017 Information technology Security techniques Guidelines for privacy impact assessment《信息技术 安全技术 隐私影响评定指南》.pdf
  • BS ISO IEC 29136-2012 Information technology User interfaces Accessibility of personal computer hardware《信息技术 用户接口 个人计算机硬件的可访问性》.pdf BS ISO IEC 29136-2012 Information technology User interfaces Accessibility of personal computer hardware《信息技术 用户接口 个人计算机硬件的可访问性》.pdf
  • BS ISO IEC 29142-1-2013 Information technology Print cartridge characterization General terms symbols notations and cartridge characterization framework《信息技术 打印盒特性描述 总论 术.pdf BS ISO IEC 29142-1-2013 Information technology Print cartridge characterization General terms symbols notations and cartridge characterization framework《信息技术 打印盒特性描述 总论 术.pdf
  • BS ISO IEC 29142-2-2013 Information technology Print cartridge characterization Cartridge characterization data reporting《信息技术 打印盒特性描述 盒式特性化数据报告》.pdf BS ISO IEC 29142-2-2013 Information technology Print cartridge characterization Cartridge characterization data reporting《信息技术 打印盒特性描述 盒式特性化数据报告》.pdf
  • 相关搜索

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

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