杭州翰天网络科技.doc

上传人:wj 文档编号:2817273 上传时间:2023-05-04 格式:DOC 页数:9 大小:324.50KB
下载 相关 举报
杭州翰天网络科技.doc_第1页
第1页 / 共9页
杭州翰天网络科技.doc_第2页
第2页 / 共9页
杭州翰天网络科技.doc_第3页
第3页 / 共9页
杭州翰天网络科技.doc_第4页
第4页 / 共9页
杭州翰天网络科技.doc_第5页
第5页 / 共9页
杭州翰天网络科技.doc_第6页
第6页 / 共9页
杭州翰天网络科技.doc_第7页
第7页 / 共9页
杭州翰天网络科技.doc_第8页
第8页 / 共9页
杭州翰天网络科技.doc_第9页
第9页 / 共9页
亲,该文档总共9页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

杭州翰天网络科技.doc

《杭州翰天网络科技.doc》由会员分享,可在线阅读,更多相关《杭州翰天网络科技.doc(9页珍藏版)》请在冰点文库上搜索。

杭州翰天网络科技.doc

选择题

1:

关于垃圾收集的哪些叙述是对的。

A.程序开发者必须自己创建一个线程进行内存释放的工作。

B.垃圾收集将检查并释放不再使用的内存。

C.垃圾收集允许程序开发者明确指定并立即释放该内存。

D.垃圾收集能够在期望的时间释放被java对象使用的内存。

2:

1.String s=”Example String”;Which operation is not legal?

  

Strings=”ExampleString”;Whichoperationisnotlegal?

A.inti=s.length();

B.s[3]=”x”;

C.Stringshort_s=s.trim();

D.Stringt=”root”+s;

3:

Whatiswrittentothestandardoutputgiventhefollowingstatement:

System.out.println(4|7);

Selecttherightanswer:

A.4

B.5

C.6

D.7

4:

Whichdeclaresfornativemethodinajavaclasscorrected?

A.publicnativevoidmethod(){}

B.publicnativevoidmethod();

C.publicnativemethod();

D.publicvoidnativemethod();

5:

1.What happens when you try to compile and run the following program?

  

2.class Mystery{  

3.String s;  

4.public static void main(String[] args){  

5.Mystery m=new Mystery();  

6.m.go();  

7.}  

8.void Mystery(){  

9.s=”constructor”;  

10.}  

11.void go(){  

12.System.out.println(s);  

13.}  

14.}  

Whathappenswhenyoutrytocompileandrunthefollowingprogram?

classMystery{

Strings;

publicstaticvoidmain(String[]args){

Mysterym=newMystery();

m.go();

}

voidMystery(){

s=”constructor”;

}

voidgo(){

System.out.println(s);

}

}

A.thiscodecomplilesbutthrowsanexceptionatruntime

B.thiscoderunsbutnothingappearsinthestandardoutput

C.thiscoderunsand“constructor”inthestandardoutput

D.thiscoderunsandwrites”null”inthestandardoutput

6:

publicclassParent{

  intchange(){…}

}

classChildextendsParent{

}

WhichmethodscanbeaddedintoclassChild?

A.publicintchange(){}

B.abstractintchang(){}

C.privateintchange(){}

D.none

7:

1.What will happen when you attempt to compile and run the following code?

   

2.  

3.public class Static  

4.  

5.{  

6.  

7.static  

8.  

9.{  

10.  

11.int x = 5;  

12.  

13.}   

14.  

15.static int x,y;  

16.  

17.public static void main(String args[])  

18.  

19.{  

20.  

21.       x--;  

22.  

23.       myMethod();  

24.  

25.       System.out.println(x + y + ++x);  

26.  

27.}   

28.  

29.public static void myMethod()  

30.  

31.{  

32.  

33.y = x++ + ++x;  

34.  

35.}  

36.  

37.}   

38.  

39.Choices:

  

Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?

publicclassStatic

{

static

{

intx=5;

}

staticintx,y;

publicstaticvoidmain(Stringargs[])

{

x--;

myMethod();

System.out.println(x+y+++x);

}

publicstaticvoidmyMethod()

{

y=x+++++x;

}

}

Choices:

A.prints:

2

B.prints:

3

C.prints:

7

D.prints:

8

8:

Aclassdesignrequiresthataparticularmembervariablemustbeaccessiblefordirectaccessbyanysubclassesofthisclass.butotherwisenotbyclasseswhicharenotmembersofthesamepackage.Whatshouldbedonetoachievethis?

A.Thevariableshouldbemarkedpublic

B.Thevariableshouldbemarkedprivate

C.Thevariableshouldbemarkedprotected

D.Thevariableshouldhavenospecialaccessmodifier

9:

1.Give the following code:

  

2.public class Example{  

3.public static void main(String args[] ){  

4.int l=0;  

5.do{  

6.System.out.println(“Doing it for l is:

”+l);  

7.}while(--l>0)  

8.System.out.println(“Finish”);  

9.}  

10.}  

11.Which well be output:

   

Givethefollowingcode:

publicclassExample{

publicstaticvoidmain(Stringargs[]){

intl=0;

do{

System.out.println(“Doingitforlis:

”+l);

}while(--l>0)

System.out.println(“Finish”);

}

}

Whichwellbeoutput:

A.Doingitforlis3

B.Doingitforlis1

C.Doingitforlis2

D.Doingitforlis0

10:

假定a和b为int型变量,则执行下述语句组后,b的值为

a=1;

b=10;

do

{

b-=a;

a++;

}while(b--<0);

A.9

B.-2

C.-1

D.8

11:

WhichfragmentsarenotcorrectinJavasourcefile?

A.packagetestpackage;publicclassTest{//dosomething...}

B.importjava.io.*;packagetestpackage;publicclassTest{//dosomething...}

C.importjava.io.*;classPerson{//dosomething...}publicclassTest{//dosomething...}

D.importjava.io.*;importjava.awt.*;publicclassTest{//dosomething...}

12:

1.Give this class outline:

  

2.class Example{  

3.private int x;  

4.//rest of class body…  

5.}  

6.Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?

  

Givethisclassoutline:

classExample{

privateintx;

//restofclassbody…

}

AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectlyaccessibleinmain()methodofExample.java?

A.Changeprivateintxtopublicintx

B.changeprivateintxtostaticintx

C.Changeprivateintxtoprotectedintx

D.changeprivateintxtofinalintx

13:

Inthefollowingpiecesofcode,whichonewillcompilewithoutanyerror?

A.StringBuffersb1="abcd";

B.Booleanb=newBoolean("abcd");

C.C:

byteb=255;

D.floatfl=1.2;

14:

Whichofthefollowingansweriscorrecttoexpressthevalue8inoctalnumber?

A.010

B.0x10

C.08

D.0x8

15:

Whichofthefollowingstatementsaretrue?

A.TheautomaticgarbagecollectionoftheJVMpreventsprogramsfromeverrunningoutofmemory

B.Aprogramcansuggestthatgarbagecollectionbeperformedandforceit

C.Garbagecollectionisplatformindependent

D.Anobjectbecomeseligibleforgarbagecollectionwhenallreferencesdenotingitaresettonull.

16:

1.Give the following java class:

  

2.public class Example{  

3.static int x[]=new int[15];  

4.public static void main(String args[]){  

5.System.out.println(x[5]);  

6.}  

7.}  

8.Which statement is corrected?

  

Givethefollowingjavaclass:

publicclassExample{

staticintx[]=newint[15];

publicstaticvoidmain(Stringargs[]){

System.out.println(x[5]);

}

}

Whichstatementiscorrected?

A.Whencompile,someerrorwilloccur.

B.Whenrun,someerrorwilloccur.

C.Outputiszero.

D.Outputisnull.

17:

1.What will happen when you attempt to compile and run the following code?

  

2.  

3.(Assume that the code is compiled and run with assertions enabled.)  

4.  

5.public class AssertTest{  

6.  

7.public void methodA(int i){  

8.  

9.assert i >= 0 :

 methodB();  

10.  

11.System.out.println(i);  

12.  

13.}  

14.  

15.public void methodB(){    

16.  

17.System.out.println("The value must not be negative");  

18.  

19.}  

20.  

21.public static void main(String args[]){  

22.  

23.AssertTest test = new AssertTest();  

24.  

25.test.methodA(-10);   

26.  

27.}  

28.  

29.}  

Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?

(Assumethatthecodeiscompiledandrunwithassertionsenabled.)

publicclassAssertTest{

publicvoidmethodA(inti){

asserti>=0:

methodB();

System.out.println(i);

}

publicvoidmethodB(){

System.out.println("Thevaluemustnotbenegative");

}

publicstaticvoidmain(Stringargs[]){

AssertTesttest=newAssertTest();

test.methodA(-10);

}

}

A.itwillprint-10

B.itwillresultinAssertionErrorshowingthemessage-“thevaluemustnotbenegative”.

C.thecodewillnotcompile.

D.Noneofthese.

18:

Whichisthemain()methodreturnofaapplication?

A.String

B.byte

C.char

D.void

19:

设有变量说明语句inta=1,b=0;

则执行以下程序段的输出结果为()。

switch(a)

{

case1:

switch(b)

{

case0:

printf("**0**");break;

case1:

printf("**1**");break;

}

case2:

printf("**2**");break;

}

printf("\n");

A.**0**

B.**0****2**

C.**0****1****2**

D.有语法错误

20:

1.What is the result when you compile and run the following code?

   

2.  

3.public class Test  

4.  

5.{   

6.  

7.public void method()  

8.  

9.{  

10.  

11.for(int i = 0; i < 3; i++)  

12.  

13.       {  

14.  

15.       System.out.print(i);  

16.  

17.       }  

18.  

19.       System.out.print(i);  

20.  

21.}  

22.  

23.}   

24.  

25.Choices:

  

Whatistheresultwhenyoucompileandrunthefollowingcode?

publicclassTest

{

publicvoidmethod()

{

for(inti=0;i<3;i++)

{

System.out.print(i);

}

System.out.print(i);

}

}

Choices:

A.0122

B.0123

C.Compilationerror

D.Noneofthese

简答题

21:

已知abc+cba=1333,其中a,b,c均为一位数,编程求出满足条件的a,b,c所有组合。

22:

Howtouse"final"toclass,methodanddata?

23:

介绍在Jsp中如何使用JavaBeans。

24:

说明Jsp中errorPage的作用,应用范围。

25:

请问你在什么情况下会在你的JAVA代码中使用可序列化?

为什么放到HttpSession中的对象必须要是可序列化的?

26:

试举例说明一个典型的垃圾回收算法?

27:

Java中的异常处理机制的简单原理和应用。

28:

EJB是基于哪些技术实现的?

并说出SessionBean和EntityBean的区别,StatefulBean和StatelessBean的区别。

29:

将一个链表逆序.

30:

编写一个C语言函数(JAVA方法),要求输入一个url,输出该url是首页、目录页或者其他url

如下形式叫做首页:

militia.info/

http:

//hgh-products.my-

如下形式叫做目录页:

.tw/user/tgk5ar1r/profile/

请注意:

a)url有可能带http头也有可能不带

b)动态url(即含有"?

"的url)的一律不算目录页,如:

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 职业教育 > 职业技术培训

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2