[计算机类试卷]国家三级(数据库技术)机试模拟试卷52及答案与解析.doc

上传人:visitstep340 文档编号:495327 上传时间:2018-11-28 格式:DOC 页数:3 大小:27KB
下载 相关 举报
[计算机类试卷]国家三级(数据库技术)机试模拟试卷52及答案与解析.doc_第1页
第1页 / 共3页
[计算机类试卷]国家三级(数据库技术)机试模拟试卷52及答案与解析.doc_第2页
第2页 / 共3页
[计算机类试卷]国家三级(数据库技术)机试模拟试卷52及答案与解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家三级(数据库技术)机试模拟试卷 52及答案与解析 一、程序设计题 1 函数 readDat()的功能是从文件 in52 dat中读取 20行数据存放到字符串数组 xx中 (每行字符串的长度均小于 80)。请编制函数 JsSort(),该函数的功能是:以行为单位对字符串变量的下标为奇数位置上的字符按其 ASCII值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组 xx中,最后调用函数 wfiteDat()把结果 xx输出到文件 out52 dat中。 例如: 位置 0 1 2 3 4 5 6 7 源字符串 h S f e d c b a 则处理后字符串 h a f c d e b

2、 g。 注意:部分源程序已给出。 请勿改动主函数 main()、读函数 readDat()和写函数 writeD6L()的内容。 试题程序: #include #include #include char XX2080; void isSort() void main() readDat(); jsSort(); writeDat(); readDat() FILE *in; int i=0; char *p; in=fopen(“in52.dat“,“r“); while(i 20 if(p) ap=0; i+; fclose(in); writeDat ( ) FILE *out; int

3、 i; out=fopen(“out52.dat“,“w“); clrscr(); for(i=0;i 20;i+) printf(“%sn“,xxi); fprintf(out,“%sn“,xxi); fclose(out); 国家三级(数据库技术)机试模拟试卷 52答案与解析 一、程序设计 题 1 【正确答案】 void jsSort() int i, j, k, strl; char ch; for(i=0; i 20; i+) strl=strlen(xxi); /*求各行字符串的长度 */ for(j=1;j strl-2;j=j+2) /*将下标为奇数的字符按其 ASCII值从小到

4、大的顺 序进行排序 */ for(k=j+2; k strl; k=k+2) if(xxij xxi k) ch=xxij; xxij=xxi k; xxik=ch; 【试题解析】 本题考查的知识点如下: (1)二维 数组的访问及下标控制。 (2)数据的排序。 在本题中,将数据存放在一个二维数组 xx中。其中以行数为数组的第一个下标,以字符串的最大长度 80为其第二个下标。因为以行为字符串处理的单位,首先要使用函数 strlcn()求得每一行中字符的个数。只对字符串数组中下标为奇数的字符进行处理,可以从 xx01开始,若需要增加时都增加 2,则可实现只访问下标为奇数的数组元素。排序使用前面介绍的 “选择排序法 ”。

展开阅读全文
相关资源
猜你喜欢
  • API RP 11S4-2002 Recommended Practice for Sizing and Selection of Electric Submersible Pump Installations (THIRD EDITION)《安装电动潜水泵时的尺寸确定和选择.第3版》.pdf API RP 11S4-2002 Recommended Practice for Sizing and Selection of Electric Submersible Pump Installations (THIRD EDITION)《安装电动潜水泵时的尺寸确定和选择.第3版》.pdf
  • API RP 11S5-2008 Recommended Practice for the Application of Electrical Submersible Cable Systems (SECOND EDITION)《可潜水电气电缆系统的应用推荐实施规程.第二版》.pdf API RP 11S5-2008 Recommended Practice for the Application of Electrical Submersible Cable Systems (SECOND EDITION)《可潜水电气电缆系统的应用推荐实施规程.第二版》.pdf
  • API RP 11S6-1995 Recommended Practice for Testing of Electric Submersible Pump Cable Systems (FIRST EDITION)《电动潜水泵电缆系统的测试》.pdf API RP 11S6-1995 Recommended Practice for Testing of Electric Submersible Pump Cable Systems (FIRST EDITION)《电动潜水泵电缆系统的测试》.pdf
  • API RP 11S7-1993 Recommended Practice on Application and Testing of Electric Submersible Pump Seal Chamber Sections (FIRST EDITION)《电动潜水泵密封腔部分的使用和检测》.pdf API RP 11S7-1993 Recommended Practice on Application and Testing of Electric Submersible Pump Seal Chamber Sections (FIRST EDITION)《电动潜水泵密封腔部分的使用和检测》.pdf
  • API RP 11S8-2012 Recommended Practice on Electric Submersible System Vibrations (Second Edition)《电动潜水泵系统振动的推荐实施规程.第2版》.pdf API RP 11S8-2012 Recommended Practice on Electric Submersible System Vibrations (Second Edition)《电动潜水泵系统振动的推荐实施规程.第2版》.pdf
  • API RP 11V10-2008 Recommended Practices for Design and Operation of Intermittent and Chamber Gas-lift Wells and Systems (First Edition Includes Access to Additional Content)《间歇和腔室气.pdf API RP 11V10-2008 Recommended Practices for Design and Operation of Intermittent and Chamber Gas-lift Wells and Systems (First Edition Includes Access to Additional Content)《间歇和腔室气.pdf
  • API RP 11V5-2008 Recommended Practices for Operation Maintenance Surveillance and Troubleshooting of Gas-lift Installations (THIRD EDITION)《气体提升装置的操作、维护、监督和故障排除用推荐实施规程.第3版》.pdf API RP 11V5-2008 Recommended Practices for Operation Maintenance Surveillance and Troubleshooting of Gas-lift Installations (THIRD EDITION)《气体提升装置的操作、维护、监督和故障排除用推荐实施规程.第3版》.pdf
  • API RP 11V6-1999 Recommended Practice for Design of Continuous Flow Gas Lift Installations Using Injection Pressure Operated Valves (Second Edition)《采用注入压力控制的阀门进行的持续流动气举的安装设计.第2版》.pdf API RP 11V6-1999 Recommended Practice for Design of Continuous Flow Gas Lift Installations Using Injection Pressure Operated Valves (Second Edition)《采用注入压力控制的阀门进行的持续流动气举的安装设计.第2版》.pdf
  • API RP 11V7-1999 Recommended Practice for Repair Testing and Setting Gas Lift Valves (Second Edition)《气举阀门的修理、检测和装配.第2版》.pdf API RP 11V7-1999 Recommended Practice for Repair Testing and Setting Gas Lift Valves (Second Edition)《气举阀门的修理、检测和装配.第2版》.pdf
  • 相关搜索

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

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