当前位置:文档之家› EAS软件系统开发招聘试题

EAS软件系统开发招聘试题

1、本试卷属于公司机密,请考生答完题后务必交还;2、本套试题共分为五个部分,题型为选择题(单选和多选)和问答题,满分100分,考试时间为1小时。

第一部分 Java基础一、选择题(包含单选和多选)(12题共12分)1、动态拼接字符串时,使用哪个类可以减少临时对象的创建()A StringBufferB StringBuilderC StringAppenderD String2、一个类要具备序列化功能,必须实现什么接口()A SerializableB CloneableC ArchivableD Sequencable3、下列哪个类不是Collection的子类()A ListB SetC MapD Vector4、请问下列方法的返回结果是什么()public int f() {int i = 0;try {++i;} finally {++i;}return ++i;}(A)1(B)2(C)3(D)05、请分析下列代码的正确输出()public static void main(String[] args){StringBuffer a = new StringBuffer("A");StringBuffer b = new StringBuffer("B");operat(a,b);System.out.println(a+","+b);}public static void operat(StringBuffer x,StringBuffer y){x.append(y);y=x;}(A)A,B(B)A,A(C)B,B(D)AB,B(D)AB,AB6、以下代码哪些是正确的:()(A)interface IA {public void f1() ;public void f2() throws Exception;}class A implements IA {public void f1() throws Exception {}public void f2() {}}(B)interface IA {public void f1() throws Exception;public void f2() throws Exception;}class A implements IA {public void f1() throws Exception {}public void f2() {}}(C)interface IA {public void f1() ;public void f2() throws Exception;}class A implements IA {public void f1() throws Exception {}public void f2() throws Exception{}}(D)interface IA {public void f1() throws Exception;public void f2() throws Exception;}class A implements IA {public void f1() {}public void f2() {}}7、下面isEmptyString函数正确的是:()(A)public boolean isEmptyString(String str) {return str == null || str.length == 0;}(B)public boolean isEmptyString(String str) { return str.length == 0 || str == null;}(C)public boolean isEmptyString(String str) { return str == "" || str.length == 0;}(D)public boolean isEmptyString(String str) {return str.equals("") || str.length == 0;}8、创建一个支持本地调用的无状态SessionBean至少需要包含以下哪些部件()A 一个继承自EJBHome interface的接口B 一个实现了EJBHome interface的类C 一个继承自EJBLocalHome interface的接口D 一个实现了EJBLocalHome interface的类E 一个继承自EJBObject interface的接口F 一个实现了EJBObject interface的类G 一个继承自EJBLocalObject interface的接口H 一个实现了EJBLocalObject interface的类I 一个实现了SessionBean interface的类J 一个继承自SessionBean的类9、调用下面那些方法可以使一个处于池态(Pool State)的Entity Bean转化成就绪状态(Ready State)()A 当这个Bean被容器调激活(Activity)B 当这个Bean被容器调钝化(Passivate)C 用EJBHome的Create方法D 用EJBHome的find方法10、以下关于EJB事务描述正确的是()A Required:如果没有事务上下文,则抛出异常,如果有事务上下文,则加入到那个事务中B RequiresNew:无论是否具有事务上下文,该方法将会启动一个全新的事务,方法结束后事务提交C Supports:如果有事务上下文则加入到那个事务中D Not Supported:如果没有事务上下文,则抛出异常11、MDB(Message Driver Bean)可以作为JMS中消息的()A 发送者B 接收者C 发送者和接收者都可以D 发送者和接收者都不可以12、关于Entity Bean主键类说法正确的是()A 只有CMP才有主键B 主键类必须是java标准类库中的类C 主键类必须序列化(Serialize)D 主键类需要重载hashcode()和equals()方法二、问答题(3题共13分)1、下列方法有哪些错误或隐患?(提示:至少2处)(4分)public void updateData(){String sql = "update t_a set fok = 1 where fid = ?";TRY{Connection conn = getConnection();PreparedStatement ps = conn.prepareStatement(sql);ps.setString(0, "001");//从1开始ps.executeUpdate();//+上TRY catchps.close();conn.close();}CATGCH{}}2、一个".java"源文件中是否可以包括多个类(不包括内部类)?有什么限制?(3分)可以3、编程题(6分):程序The Producer generates an integer between 0 and 9 (inclusive), stores it in a "CubbyHole"object, and prints the generated number.class Producer extends Thread {private CubbyHole cubbyhole;private int number;public Producer(CubbyHole c, int number) {cubbyhole = c;this.number = number;}public void run() {for (int i = 0; i < 10; i++) {cubbyhole.put(i);System.out.println("Producer #" + this.number + " put: " + i);try {sleep((int)(Math.random() * 100));} catch (InterruptedException e) {}}}}The Consumer, being ravenous, consumes all integers from the CubbyHole (the exact sameobject into which the Producer put the integers in the first place) as quickly as they becomeavailable.class Consumer extends Thread {private CubbyHole cubbyhole;private int number;public Consumer(CubbyHole c, int number) {cubbyhole = c;this.number = number;}public void run() {int value = 0;for (int i = 0; i < 10; i++) {value = cubbyhole.get();System.out.println("Consumer #" + this.number + " got: " + value);}}}The Producer and Consumer in this example share data through a common CubbyHole object. And you will note that neither the Producer nor the Consumer make any effort whatsoever to ensure that the Consumer is getting each value produced once and only once. The synchronization between these two threads actually occurs at a lower level, within the get() and put() methods of the CubbyHole object.The Main Programclass ProducerConsumerTest {public static void main(String[] args) {CubbyHole c = new CubbyHole();Producer p1 = new Producer(c, 1);Consumer c1 = new Consumer(c, 1);p1.start();c1.start();}}请补充类CubbyHole 的代码。

相关主题