Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1942243
  • 博文数量: 219
  • 博客积分: 8963
  • 博客等级: 中将
  • 技术积分: 2125
  • 用 户 组: 普通用户
  • 注册时间: 2005-10-19 12:48
个人简介

文章分类

全部博文(219)

文章存档

2021年(1)

2020年(3)

2015年(4)

2014年(5)

2012年(7)

2011年(37)

2010年(40)

2009年(22)

2008年(17)

2007年(48)

2006年(31)

2005年(4)

分类: Java

2006-06-15 10:05:35

 

第一部分:选择题

QUESTION NO: 1

1、public class Test {

public static void changeStr(String str){

str="welcome";

}

public static void main(String[] args) {

String str="1234";

changeStr(str);

System.out.println(str);

}

}

Please write the output result :

My Answer: 1234

 

QUESTION NO:2

1. public class Test {

2. static boolean foo(char c) {

3. System.out.print(c);

4. return true;

5. }

6. public static void main( String[] argv ) {

7. int i =0;

8. for ( foo('A'); foo('B')&&(i<2); foo('C')){

9. i++ ;

10. foo('D');

12. }

13. }

14. }

What is the result?

A. ABDCBDCB

B. ABCDABCD

C. Compilation fails.

D. An exception is thrown at runtime.

My Answer: A

 

QUESTION NO: 3

1. class A {

2. protected int method1(int a, int b) { return 0; }

3. }

Which two are valid in a class that extends class A? (Choose two)

A. public int method1(int a, int b) { return 0; }

B. private int method1(int a, int b) { return 0; }

C. private int method1(int a, long b) { return 0; }

D. public short method1(int a, int b) { return 0; }

E. static protected int method1(int a, int b) { return 0; }

My Answer: A

 

QUESTION NO: 4

1. public class Outer{

2. public void someOuterMethod() {

3. // Line 3

4. }

5. public class Inner{}

6. public static void main( String[]argv ) {

7. Outer o = new Outer();

8. // Line 8

9. }

10. }

Which instantiates an instance of Inner?

A. new Inner(); // At line 3

B. new Inner(); // At line 8

C. new o.Inner(); // At line 8

D. new Outer.Inner(); // At line 8//new Outer().new Inner()

My Answer: A

 

QUESTION NO: 5

Which method is used by a servlet to place its session ID in a URL that is written to the servlet’s response output stream?

A. The encodeURL method of the HttpServletRequest interface.

B. The encodeURL method of the HttpServletResponse interface.

C. The rewriteURL method of the HttpServletRequest interface.

D. The rewriteURL method of the HttpServletResponse interface.

My Answer: B

 

QUESTION NO: 6

Which two are equivalent? (Choose two)

A. <%= YoshiBean.size%>

B. <%= YoshiBean.getSize()%>

C. <%= YoshiBean.getProperty("size")%>

D.

E.

F.

G.

My Answer: B,G

 

QUESTION NO: 7

Which of the following statements regarding the lifecycle of a session bean are correct?

1.  java.lang.IllegalStateException is thrown if SessionContext.getEJBObject() is invoked when a stateful session bean instance is passivated.

2.  SessionContext.getRollbackOnly() does not throw an exception when a session bean with bean-managed transaction demarcation is activated.

3.  An exception is not thrown when SessionContext.getUserTransaction() is called in the afterBegin method of a bean with container-managed transactions.

4.  JNDI access to java:comp/env is permitted in all the SessionSynchronization methods of a stateful session bean with container-managed transaction demarcation.

5.  Accessing resource managers in the SessionSynchronization.afterBegin method of a stateful session bean with bean-managed transaction does not throw an exception.

 

 

 

第二部分:概念题

1.描述Struts体系结构?对应各个部分的开发工作主要包括哪些?

 

2.XML包括哪些解释技术,区别是什么?

 

3.JSP有哪些内置对象和动作?它们的作用分别是什么?

 

4、SQL问答题

SELECT * FROM TABLE

SELECT * FROM TABLE

WHERE NAME LIKE '%%' AND ADDR LIKE '%%'

AND (1_ADDR LIKE '%%' OR 2_ADDR LIKE '%%'

OR 3_ADDR LIKE '%%' OR 4_ADDR LIKE '%%' )

的检索结果为何不同?

My Answer: 字段有NULL的情况不同

 

5、SQL问答题

表结构:

1、表名:g_cardapply 字段(字段名/类型/长度):

g_applyno

varchar   8;//申请单号(关键字)

g_applydate

Bigint      8;//申请日期

g_state

Varchar     2;//申请状态

 

2、表名:g_cardapplydetail 字段(字段名/类型/长度):

g_applyno

Varchar     8;//申请单号(关键字)

g_name

Varchar     30;//申请人姓名

g_idcard

Varchar     18;//申请人身份证号

g_state

Varchar     2;//申请状态

其中,两个表的关联字段为申请单号。

题目:

1、查询身份证号码为440401430103082的申请日期

   Select g_applydate from g_cardapply a, g_cardapplydetail b

        where g_idcard='440401430103082' and a.g_applyno=b.applyno

 

2、查询同一个身份证号码有两条以上记录的身份证号码及记录个数

   Select g_idcard,count(*) from g_cardapply a, g_cardapplydetail b

         where g_idcard='440401430103082' and a.g_applyno=b.applyno

             group by g_idcard

             having count(*) > 1

 

3、将身份证号码为440401430103082的记录在两个表中的申请状态均改为07

      update  g_cardapplydetail set g_state='07' where g_idcard='440401430103082'

      update g_cardapply set g_state-'07'

             where g_applyno=( select g_applyno from g_cardapplydetail

                                             where g_idcard='440401430103082')

 

4、删除g_cardapplydetail表中所有姓李的记录

      delete from g_cardapplydetail where g_name like '%'

 

 

 

 

 

另一套(答案和翻译未必正确):

1,which two are true?

A. An anonymous inner class can be declared inside of a method

B. An anonymous inner class constructor can take arguments in some situations

C. An anonymous inner class that is a direct subclass of Object can implements

multiple interface

D. Even if a class Super does not implement any interfaces, it is still possible

to define an anonymous inner class that is an immediate subclass of Super that

implements a single interface

E. Even if a class Super does not implement any interfaces, it is still possible

to define an anonymous inner class that is an immediate subclass of Super that

implements multipe interface

Answer:A,D

哪个是真的?

A:一个匿名内隐类能在一个方法中声明

B:一个匿名内隐类的构函数在某些时候可以有参数

CObject对象直接子类的一个匿名内隐类可以实现多个接口

D:即使一个超类没有实现任何接口,它仍可定义一个实现了单一接口超类的直接子类的匿名内隐类

2,which statement is true?

A. An anonymous inner class may be declared as final

B. An anonymous inner class can be declared as private

C. An anonymous inner class can implement mutiple interfaces

D. An anonymous inner class can access final variables in any enclosing scope

E. Construction of an instance of a static inner class requires an instance of

the encloing outer class

Answer:D

3,which is true?

A.If only one thread is blocked in the wait method of an object, and another

thread executes the notify method on that same object,then the first thread

immediately resumes executes.

B. If a thread is blocked in the wait method of an object, and another thread

executes the notify method on the same object,it is still possible that the

first thread might never resume execution

C.If a thread is blocked in the wait method of an object,and another thread

executes the notify method on the same object,then the first thread definitely

resumes execution as a direct and sole consequence of the notify call

D.If two threads are blocked in the wait method of one object,and another thread

executes the notify method on the same object,then the thread that executed

the wait call first definitely resumes execution as a direct and sole consequence

of the notify call

Answer:B

4,which two are true?

A. static inner class requires a static initializer

B. A static inner class requires an instance of the enclosing class

C. A static inner class has no reference to an instance of the enclosing class

D. A static inner class has accesss to the non-static member of the other class

E. static members of a static inner class can be referenced using the class

name of the static inner class

Answer:C,E

阅读(2035) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~