【计算机类职业资格】程序员-16及答案解析.doc
《【计算机类职业资格】程序员-16及答案解析.doc》由会员分享,可在线阅读,更多相关《【计算机类职业资格】程序员-16及答案解析.doc(6页珍藏版)》请在麦多课文档分享上搜索。
1、程序员-16 及答案解析(总分:45.00,做题时间:90 分钟)一、试题一(总题数:1,分数:15.00)1.说明 用输入/输出写一个程序,让用户输入一些姓名和电话号码。每一个姓名和号码将加在文件里。用户通过点“Done”按钮来告诉系统整个列表已输入完毕。 如果用户输入完整的列表,程序将创建一个输出文件并显示或打印出来。格式如:555,1212,Tom 123-456-7890,Peggy L.234-5678,Marc 234-5678,Ron 876-4321,Beth byte name=new byte lineLength; int i; try fos= new FileOutp
2、utStream (“phone. numbers“); catch (FileNotFoundException e) while (true) _ 1_ (“Enter a name (enter “done“ to quit)“); _ 2_ (name); if (“done“. equalsIgnoteCase (new String (name,0,0,4) break; System.err.println (“Enter the phone number“); readLine (phone); for (int i=0;phone i!=0;i+) _ 3_ ; fos.wr
3、ite (“,“); for (int i=0 _ 4_ ;i+) fos. write (name i); fos. write (“n“); fos. close(); private static void readLine (byte line ) throws IOException int i=0,b=0; while (i _ 5_ ) linei= ( byte ) 0; (分数:15.00)二、试题二(总题数:1,分数:15.00)2.说明 完成以下中序线索化二叉树的算法。 函数 Typedef int datatype; Typedef struct node Int lt
4、ag, rtag; Datatype data; *lchild,* rchild; bithptr; bithptr pre; void inthread ( p ); if inthread ( p-lchild ); if ( p-lchild=unll ) _ 1_ ; if ( P-RCHILD=NULL) p-rtag=1; if _ 2_ if _ 3_ pre-rchild=p; if ( p-1tag=1 ) _ 4_ ; INTHREAD ( P-RCHILD ); _ 5_ ; (分数:15.00)三、试题三(总题数:1,分数:15.00)3.说明 本程序求 3100 之
5、间的所有素数(质数)并统计个数;同时将这些素数从小到大依次写入顺序文件 E: dataout.txt;素数的个数显示在窗体 Form1 上。 Visual Basic 代码 Private Sub Command1_ Click ( ) Dim count as integer, flag as Boolean Dim t1 as Integer, t2 as Integer _ 1_ Count=0 For t1=3 to 100 Flag=Tree For t2=2 to Int( Sqr ( t1 ) ) If _ 2_ Then flag=False Next t2 _ 3_ coun
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
5000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 职业资格 程序员 16 答案 解析 DOC
