【计算机类职业资格】2011春江苏省二级C上机考试第2套(暂缺部分答案)及答案解析.doc

上传人:medalangle361 文档编号:1317957 上传时间:2019-10-17 格式:DOC 页数:2 大小:28KB
下载 相关 举报
【计算机类职业资格】2011春江苏省二级C上机考试第2套(暂缺部分答案)及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】2011春江苏省二级C上机考试第2套(暂缺部分答案)及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、2011 春江苏省二级 C 上机考试第 2 套(暂缺部分答案)及答案解析(总分:40.00,做题时间:70 分钟)一、改错题(16 分)(总题数:1,分数:16.00)1.【程序功能】 统计一个字符串中包含的字母串个数并找出其中最长的字母串。 所谓字母串是指一个连续的字母序列(不区分大小写),字母串之间用非字母字符分隔。函数 count 的功能是统计 p 指向的字符串中包含的字母串个数,找出的最长字母串存放在 pmax 指向的数组中,函数返回字母串的个数。 【测试数据与运行结果】 测试数据:you are teaeher234too. 屏幕输出:a=you are teacher234too.

2、 number is 4 max string is:teacher 【含有错误的源程序】 #include #include #include int count(char p,char pmax) int j=0,k,m=0; char temp100; while(*p) while(!isalpha(*p) k=0; if(*p!=/0) m+; while(isalpha(*p) tempk+=*p+; tempk=“/0“; if(k_二、编程题(24 分)(总题数:1,分数:24.00)2.【程序功能】 将一个二维数组中的若干行数据按要求插入到另一个二维数组中。 【编程要求】 1

3、.定义符号常量 N 代表 4 2.编写函数 int insert_row(int aN,int n,int bN,int m)。已知形参 a 指向的二维数组(简称 a 数组)前 n 行数据已按每行数据之和升序排列,形参 b 指向的二维数组中有 m 行数据。insert_row 函数实现将 b 数组中 m 行数据插入到 a 数组中,完成插入操作后 a 数组中所有行的数据仍按每行数据之和升序排列。函数返回 a 数组中有效数据的行数。 3.编写 main 函数。函数功能是声明两个二维数组 x 和 y 并用测试数据初始化,用 x 和 y 数组作为实参调用 insert_row 函数将 y 数组中的两行

4、数据插入到 x 数组中。输出 x 数组中全部数据到屏幕及文件 myf2.out 中。最后将考生本人的准考证号字符串输出到文 myf2. out 中。 【测试数据与运行结果】 测试数据: x 数组原数据: 2 2 3 4 9 10 11 12 y 数组数据: 1 3 5 7 5 10 15 20 屏幕输出: 2 2 3 4 1 3 5 7 9 10 11 12 5 10 15 20 (分数:24.00)_2011 春江苏省二级 C 上机考试第 2 套(暂缺部分答案)答案解析(总分:40.00,做题时间:70 分钟)一、改错题(16 分)(总题数:1,分数:16.00)1.【程序功能】 统计一个字

5、符串中包含的字母串个数并找出其中最长的字母串。 所谓字母串是指一个连续的字母序列(不区分大小写),字母串之间用非字母字符分隔。函数 count 的功能是统计 p 指向的字符串中包含的字母串个数,找出的最长字母串存放在 pmax 指向的数组中,函数返回字母串的个数。 【测试数据与运行结果】 测试数据:you are teaeher234too. 屏幕输出:a=you are teacher234too. number is 4 max string is:teacher 【含有错误的源程序】 #include #include #include int count(char p,char pma

6、x) int j=0,k,m=0; char temp100; while(*p) while(!isalpha(*p) k=0; if(*p!=/0) m+; while(isalpha(*p) tempk+=*p+; tempk=“/0“; if(k_正确答案:(改错 1:将第 13 行 “temp0=“/0“ 修改为 temp0=/0 改错 2:将第 14 行 if(kj) 改错 3:将第 16 行 pmax=temp,修改为 strcpy(pmax,temp); 改错 4:将第 24 行 i=count(a,max)修改为i=count(a,max); )解析:二、编程题(24 分)(

7、总题数:1,分数:24.00)2.【程序功能】 将一个二维数组中的若干行数据按要求插入到另一个二维数组中。 【编程要求】 1.定义符号常量 N 代表 4 2.编写函数 int insert_row(int aN,int n,int bN,int m)。已知形参 a 指向的二维数组(简称 a 数组)前 n 行数据已按每行数据之和升序排列,形参 b 指向的二维数组中有 m 行数据。insert_row 函数实现将 b 数组中 m 行数据插入到 a 数组中,完成插入操作后 a 数组中所有行的数据仍按每行数据之和升序排列。函数返回 a 数组中有效数据的行数。 3.编写 main 函数。函数功能是声明两个二维数组 x 和 y 并用测试数据初始化,用 x 和 y 数组作为实参调用 insert_row 函数将 y 数组中的两行数据插入到 x 数组中。输出 x 数组中全部数据到屏幕及文件 myf2.out 中。最后将考生本人的准考证号字符串输出到文 myf2. out 中。 【测试数据与运行结果】 测试数据: x 数组原数据: 2 2 3 4 9 10 11 12 y 数组数据: 1 3 5 7 5 10 15 20 屏幕输出: 2 2 3 4 1 3 5 7 9 10 11 12 5 10 15 20 (分数:24.00)_正确答案:()解析:

展开阅读全文
相关资源
猜你喜欢
  • BS ISO IEC 15961-2004 Information technology - Radio frequency identification (RFID) for item management - Data protocol - Application interface《信息技术 项目管理的射频识别(RFID) 数据协议 应用接口》.pdf BS ISO IEC 15961-2004 Information technology - Radio frequency identification (RFID) for item management - Data protocol - Application interface《信息技术 项目管理的射频识别(RFID) 数据协议 应用接口》.pdf
  • BS ISO IEC 15961-4-2016 Information technology Radio frequency identification (RFID) for item management Data protocol Application interface commands for battery assist and sensor .pdf BS ISO IEC 15961-4-2016 Information technology Radio frequency identification (RFID) for item management Data protocol Application interface commands for battery assist and sensor .pdf
  • BS ISO IEC 15962-2013 Information technology Radio frequency identification (RFID) for item management Data protocol data encoding rules and logical memory functions《信息技术 项目管理用无线射频.pdf BS ISO IEC 15962-2013 Information technology Radio frequency identification (RFID) for item management Data protocol data encoding rules and logical memory functions《信息技术 项目管理用无线射频.pdf
  • BS ISO IEC 16022-2006 Information technology - Automatic identification and data capture techniques - Data Matrix bar code symbology specification《信息技术 自动识别和数据俘获技术 数据矩阵条形码象形规范》.pdf BS ISO IEC 16022-2006 Information technology - Automatic identification and data capture techniques - Data Matrix bar code symbology specification《信息技术 自动识别和数据俘获技术 数据矩阵条形码象形规范》.pdf
  • BS ISO IEC 16388-2007 Information technology - Automatic identification and data capture techniques - Code 39 bar code symbology specification《信息技术 自动识别和数据捕捉技术 代码39条形码符号规范》.pdf BS ISO IEC 16388-2007 Information technology - Automatic identification and data capture techniques - Code 39 bar code symbology specification《信息技术 自动识别和数据捕捉技术 代码39条形码符号规范》.pdf
  • BS ISO IEC 16390-2007 Information technology - Automatic identification and data capture techniques - Interleaved 2 of 5 bar code symbology specification《信息技术 自动识别和数据捕捉技术 交插二五条形码符号.pdf BS ISO IEC 16390-2007 Information technology - Automatic identification and data capture techniques - Interleaved 2 of 5 bar code symbology specification《信息技术 自动识别和数据捕捉技术 交插二五条形码符号.pdf
  • BS ISO IEC 16480-2015 Information technology Automatic identification and data capture techniques Reading and display of ORM by mobile devices《信息技术 自动识别和数据采集技术 移动设备对象关系映射的读取和显示》.pdf BS ISO IEC 16480-2015 Information technology Automatic identification and data capture techniques Reading and display of ORM by mobile devices《信息技术 自动识别和数据采集技术 移动设备对象关系映射的读取和显示》.pdf
  • BS ISO IEC 17825-2016 Information technology Security techniques Testing methods for the mitigation of non-invasive attack classes against cryptographic modules《信息技术 安全技术 降低密码模块非侵入.pdf BS ISO IEC 17825-2016 Information technology Security techniques Testing methods for the mitigation of non-invasive attack classes against cryptographic modules《信息技术 安全技术 降低密码模块非侵入.pdf
  • BS ISO IEC 17960-2015 Information technology Programming languages their environments and system software interfaces Code signing for source code《信息技术 程序设计语言及其环境和系统软件接口 源代码的代码签名》.pdf BS ISO IEC 17960-2015 Information technology Programming languages their environments and system software interfaces Code signing for source code《信息技术 程序设计语言及其环境和系统软件接口 源代码的代码签名》.pdf
  • 相关搜索

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

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