java工程师考试.doc_第1页
java工程师考试.doc_第2页
java工程师考试.doc_第3页
java工程师考试.doc_第4页
java工程师考试.doc_第5页
免费预览已结束,剩余9页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

资料收集于网络,如有侵权请联系网站删除第一题:(过程可以写在后面)学校的毕业话剧演出由四个小美女来出演小红帽、美羊羊、女巫和公主的角色。没人在排练时的角色与演出时的角色不同。排练时出演小红帽的人会撒谎,通过如下消息,请判断四人在演出和排练时分别出演什么角色。梅:“排练时,兰的角色是演出时竹的角色。”兰:“菊排练时扮演的是美羊羊。”竹:“演出时我演公主。”菊:“兰演出时扮演的是美羊羊。”第二题: 解数独题(数独是九宫格(即3格宽x3格高) ) 正方形状,每一格又细分为一个九宫格,在没一个小九宫格中,分别填上19个数字,让每一个大九宫格没一列,没一行的数字都不重复。817469483385275696651 1831、Which line contains a constructor in this class definition?public class Counter/(1) int current ,step;public Counter(int startVaue,int stepValue)/(2)set(startValue);setStepValue(steValue);public int get()return current;/(3)public void set(int value)current=value;/(4)public void setStepValue(int stepValue)step=stepValue;/(5)1)Code marked with (1) is a constructor2)Code marked with (2) is a constructor3)Code marked with (3) is a constructor4)Code marked with (4) is a constructor5)Code marked with (5) is a constructor2、An instance member.1)is also called a static member2)is always a variable3)is never a method4)belongs to a single instance,not to the class as a whole5)always represents an operation3、Given the following class,which statements can be inserted at position I without causing the code to fail compilation?public class Q6db8int a ;int b=0;static int c;public void m()int d;int e=0;/Position 11)a+2)b+3)c+4)d+5)e+7、 What is wrong with the following code?Class MyException extends ExceptionPublic class qb4abPublic void foo()Try Bar();finally Baz();catch(MyException e)Public void bar() throws MyExceptionThrow new Exception();Public void baz() throws RuntimeExceptionThrow new RuntimeException();4、 ) Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.5、 ) A the try block cannot be followed by both a catch and a finally block.6、 ) An empty catch block is not allowed.7、 ) A catch block cannot follow a finally block.8、 ) A finally block must always follow one or more catch blocks.5、What will happen when you attempt to compile and run the following program by passing the Test class to the Java interpreter?Class TestPublic static void mainSystem.out.print(“hello”);Select the one right answer.6. the program does not compile because main() is not defined correctly. 7. The program compiles but when you try to run the interpreter complies that it cannot find the main() method it needs to run.C) the program compiles but you cannot run it because the class is not declared as public .D) the program compiles and runs without an error but does not display anything in the standard output .E) the program compiles and displays “hello ” in the standard output when you in run it.6、Give those code snippets:Boolean b1=new Boolean(true); Boolean b2=new Boolean(true); Which expressions are legal Java expressions that return true?Select all valid answer.3. b1=b24. b1.equals(b2)C) b1&b2D) b1|b2E) b1&b2F) b1|b27、Given this code snippet:trytryThis();return;catch(IOException x1)System.out.println(exception 1);return ;catch(Exception x2)System.out.println(exception 2);return ;finallySystem.out.println(finally);What will appear in the standard output if try This() throws a NumberFormatException?Select the one right answer.a)Nothing b)exception 1,followed by finallyc)exception 2,followed by finallyd)exception 1e)exception 2选择: C8、Giver these class definitions;class Superclassclass Subclass1 extends Superclassclass Subclass2 extends Superclassand these objects;Superclass a =new Superclass();Subclass1 b=new Subclass1();Subclass2 c=new Subclass2();which of the following explains the result of the statement;b=(Subclass1)c;Selected the one right answer;a)Illegal at compile timeb)Legal at compile time but possibly illegal at runtimec)Definitely legal at runtime9、简述以下代码是在做什么事情?Public static javax.ejb.EJBHome getEJBHome(String JNDIName) throws NameNotFoundException,NamingExceptionjava.util.Hashtable env=new java.util.Hashtable(1);env.put(javax.naming.context.INITIAI_CONTEXT_FACTORY,”com.kivasoft.eb.jndi.GDSInitContextFactory”);Javax.naming.Context initContext=new javax.naming.InitalContext(env);If(initContext=null) Throw new RuntimeException(“getEJBHome couldt retrieve initial context ”);return(javax.ejb.EJBHome)initContext.lookup(JNDIName);10: 请从空白处填写代码,满足以下功能:A) 从请求中得到用户名和口令(请求通过web浏览器中的HTML页面提交, 页面中用户名对象名为userName, 口令对象名为 password)B) 如果用户名为”admin” , 口令为 password ,则讲登陆成功,将页面转到 loginSuccess.jsp页面,并在session 存放用户名(username)和密码 (password)C( 如果用户名和空灵为其他值,转到error.jspPublic class TestServlet extends HttpServlet Public void service(HttpServletRequest request,HttpServletResponse resopnse) throws ServletException,IOException /Include following lins in all servlet. Try /请在此添写代码 If(userName.equals(“admin”) & password.equals(“password”) request.getsession.setAttribute(username,”admin”); request.getsession.setAttribute(password,”password”); Request.sendRedirect(“loginSuccess.jsp”); else Request.sendRedirect(“error.jsp”); catch(Exception e) 典道的笔试分A-B卷,题型有:1.选择题30道(每道2分 共60分)2.代码阅读题4道(每道5分 共20分)3.程序逻辑题2道(每道10分 共20分)不管是A-B卷,考察的范围都是基础知识,这个是和几个做B卷的同学那了解到的,主要的考点如下:考点名称考试频率难易度备注数组高易值传递与址传递高中Main函数低中线程低难Swing与awt低中Ascii码高难请务必记住常用ascii码,代码题都有考运算符优先级低中(1)位置的优越性去网上百度一下Oop思想在上海, 随着轨道交通的发展,地铁商铺应运而生,并且在重要商圈已经形成一定的气候,投资经营地铁商铺逐渐为一大热门。在人民广场地下的迪美购物中心,有一家DIY自制饰品店-“碧芝自制饰品店”高众上所述,我们认为:我们的创意小屋计划或许虽然会有很多的挑战和困难,但我们会吸取和借鉴“漂亮女生”和“碧芝”的成功经验,在产品的质量和创意上多下工夫,使自己的产品能领导潮流,领导时尚。在它们还没有打入学校这个市场时,我们要巩固我们的学生市场,制作一些吸引学生,又有使学生能接受的价格,勇敢的面对它们的挑战,使自己立于不败之地。中在我们学校大约有4000多名学生,其中女生约占90%以上。按每十人一件饰品计算,大概需要360多件。这对于开设饰品市场是很有利的。女生成为消费人群的主体。方法重载与重写高(三)DIY手工艺品的“自助化”易7、你喜欢哪一类型的DIY手工艺制品?当然,在竞争日益激烈的现代社会中,创业是件相当困难的事。我们认为,在实行我们的创业计划之前,我们首先要了解竞争对手,吸取别人的经验教训,制订相应竞争的策略。我相信只要我们的小店有自己独到的风格,价格优惠,服务热情周到,就一定能取得大多女孩的信任和喜爱。包低(一)对“漂亮女生”饰品店的分析易方法与类的命名规则低易逻辑思维高难图1-2 大学生购买手工艺品可接受价位分布2003年,上海市人均GDP按户籍人口计算就达到46700元,是1995年的2.5倍;居民家庭人均月可支配收入为14867元,是1995年的2.1倍。收入不断增加的同时,居民的消费支出也在增加。2003年上海居民人均消费支出为11040元,其中服务性消费支出为3369元,是1995年的3.6倍。其他的记得不是很清楚了,不过不会超过基础知识这个范围,但光靠书(accp6.0)上那些还不够,建议找些参考书学习一下,越基础越好。以下是A卷代码阅读题8、 建一个数组,顺序输出10位数,然后把这10位数再倒序输出public class Test public static void main(String args) int arr=new int1,2,3,4,5,6,7,8,9,10;System.out.println(-顺序输出-); for (int i = 0; i =0 ; j-) System.out.print(arrj+,);9、 考的是方法重载,它是将两个方法的参数顺序颠倒了一下,看题的时候要注意。3.public class Test5 public static void main(Stringargs)int arr=new int1,2,3,4,5,6,7,8;a(arr);b(arr);a(arr);static void a(int arr)for(int temp:arr)System.out.println(temp);static void b(int arr)for(int i=0;iarr.length;i+)arri*=i;输出结果是:56以下是A卷手写代码题:8. 请用1、2、3、4组成N个数值不重复且个十百位都不重复的3位数, 一共有几个? 分别是什么?共有:24个 分别是:123,124,132,134,142,143,213,214,231,234,241,243,312,314,321,324,341,342,412,413,421,423,431,432,参考答案:Int count=0;For(int i=1;i=4;i+)For(int j=1;j=4;j+)For(int k=1;k=4;k+)If(i!=j&i!=k&j!=k)Count+;System.out.println(i*100+j*10+k);一共有24个,公式:4*3*2=24,具体数学公式请见排列算法。9. 查询

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论