资源预览内容
第1页 / 共13页
第2页 / 共13页
第3页 / 共13页
第4页 / 共13页
第5页 / 共13页
第6页 / 共13页
第7页 / 共13页
第8页 / 共13页
第9页 / 共13页
第10页 / 共13页
亲,该文档总共13页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Java笔试题(第 1 页 共 13 页)Java笔试题Java笔试题 .1历史记录 .2答题要求 .2程序编写考察 .201 FizzBuzz.202 grep c.203 last number in a string.304 binary search.3基础知识考察 .301 Odd Judge.302 Long Division.303 Operator Order.404 Conversion.405 Parameter Pass.406 Switch.507 Exception.508 Thread.609 Synchronization.710 Stack.711 String Concatenation.812 Fill Program.913 Judge.9项目经验考察 .1001 Unit Test.1002 JSP.1003 Servlet.1004 Database.1105 XML.1106 Web.1107 Design Pattern.1208 UML.1209 JavaScript.1210 Linux.1211 version control.13Java笔试题(第 2 页 共 13 页)历史记录2006.11.24 First edition2006.12.18 Revision edition2007.03.06/07 增加“程序编写考察”部分2008.04.01 增加“项目经验考察”/“04 Database”/“Oracle 经验”部分2008.07.05 进行了一些修订答题要求(1) 请先将文件名改成“Java 笔试题(您的姓名).doc” 。(2) 请在题目后面的 方框 内作答,使用蓝色字体. (3) 请根据您所掌握的知识以及项目经验作答,对于不了解的东西可以不答。(4) 项目经验考察部分,请尽量体现您确实已经具备这方面的能力。(5) 程序编写考察部分,请将工程(project)目录打包,并提供必要的文档。(6) 在答题过程中,可以充分利用互联网资源。程序编写考察请选择合适的工具(IDE)进行编写。每道题一个单独的工程。01 FizzBuzz 写一个程序打印 1到 100这些数字。但是遇到数字为 3的倍数的时候,打印“Fizz”替代数字,5 的倍数用“Buzz”代替,既是 3的倍数又是 5的倍数打印“FizzBuzz” 。02 grep c 给定一个字符串(不包括回车换行之类的特殊字符) ,给定一个文本文件(可能含有汉字) ,如果某一行中包含该字符串就算一次,打印出该文件中总共出现多少次。Java笔试题(第 3 页 共 13 页)03 last number in a string写一个方法 method1(String s),返回字符串参数中最后一个数字。例:“His telephone number is 123456789” return 123456789;There are 1 bees,2 butterflies,3 dragonflies return 3;04 binary search用 2分法查询并返回数组中元素的索引 method2(int n)。-10,0,10,17,17,23,65,123 当 n = 17 return 4;当 n=24 return 5;基础知识考察01 Odd Judgepublic class Test public static boolean isOdd1(int i) return i % 2 = 1;public static boolean isOdd2(int i) return i & 1 != 0;public static boolean isOdd3(int i) return (i & 1) != 0;/ 其余的代码省略请问上面的类中这三个方法,编写者的意图是什么?哪个方法可行?为什么?02 Long Divisionpublic class LongDivision public static void main(String args) final long MICROS_PER_DAY = 24 * 60 * 60 * 1000 * 1000;final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000;System.out.println(MICROS_PER_DAY / MILLIS_PER_DAY);Java笔试题(第 4 页 共 13 页)上面的代码,编写者的意图是什么?能否达到?为什么?03 Operator Orderpublic class Test01 public static void main(String args) int x = 6, y = 8;boolean b = x y & +x = -y;System.out.println(x= + x + , y= + y + , b= + b);上面的程序输出什么?04 Conversion怎样把 int转换成 String? 怎样把 String转换成 int? 写出你所知道的。05 Parameter Passpublic class Test06 String str = new String(good);char ch = a,b,c;public static void main(String args) Test06 ex = new Test06();ex.change(ex.str, ex.ch);System.out.print(ex.str + and );System.out.print(ex.ch);public void change(String str, char ch) str = test ok;Java笔试题(第 5 页 共 13 页)ch0 = g;上面这个程序的输出是什么?06 Switchpublic class Test07 public static void main(String arg) int anar = new int1,2,3;System.out.println(anar1);int i = 9;switch(i) default:System.out.println(default);case 0:System.out.println(zero);break;case 1:System.out.println(one);case 2:System.out.println(two);boolean b = true;boolean b2 = true;if (b = b2) System.out.println(So true);上面的代码输出什么?07 Exceptionpublic class Test05 void g() Java笔试题(第 6 页 共 13 页)http:/www.google.com/System.out.print
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号