上海国响信息技术有限公司_第1页
上海国响信息技术有限公司_第2页
上海国响信息技术有限公司_第3页
上海国响信息技术有限公司_第4页
上海国响信息技术有限公司_第5页
已阅读5页,还剩3页未读, 继续免费阅读

下载本文档

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

文档简介

选择题1:What

is

the

result

when

you

compile

and

run

the

following

code?

public

class

Test

{

public

void

method()

{

for(int

i

=

0;

i

<

3;

i++)

{

System.out.print(i);

}

System.out.print(i);

}

}

Choices:

A.0122B.0123C.CompilationerrorD.Noneofthese2:关于垃圾收集的哪些叙述是对的。A.程序开发者必须自己创建一个线程进行内存释放的工作。B.垃圾收集将检查并释放不再使用的内存。C.垃圾收集允许程序开发者明确指定并立即释放该内存。D.垃圾收集能够在期望的时间释放被java对象使用的内存。3:在软件生命周期中,下列哪个说法是不准确的?A.软件生命周期分为计划、开发和运行三个阶段B.在计划阶段要进行问题焉醛和需求分析C.在开发后期要进行编写代码和软件测试D.在运行阶段主要是进行软件维护4:What

will

be

the

result

of

executing

the

following

code?

//

Filename;

SuperclassX.java

package

packageX;

public

class

SuperclassX

{

protected

void

superclassMethodX()

{

}

int

superclassVarX;

}

//

Filename

SubclassY.java

1.package

packageX.packageY;

2.

3.public

class

SubclassY

extends

SuperclassX

4.{

5.SuperclassX

objX

=

new

SubclassY();

6.SubclassY

objY

=

new

SubclassY();

7.void

subclassMethodY()

8.{

9.objY.superclassMethodX();

10.int

i;

11.i

=

objY.superclassVarX;

12.}

13.}

Choices:

A.Compilationerroratline5B.Compilationerroratline9C.Runtimeexceptionatline11D.Noneofthese5:给出下面的代码片断。。。下面的哪些陈述为错误的?

1)

public

void

create()

{

2)

Vector

myVect;

3)

myVect

=

new

Vector();

4)

}

A.第二行的声明不会为变量myVect分配内存空间。B.第二行语句创建一个Vector类对象。C.第三行语句创建一个Vector类对象。D.第三行语句为一个Vector类对象分配内存空间6:WhichcodefragmentswouldcorrectlyidentifythenumberofargumentspassedviacommandlinetoaJavaapplication,excludethenameoftheclassthatisbeinginvoke.A.intcount=args.length;B.intcount=args.length-1;C.intcount=0;while(args[count]!=null)count++;D.intcount=0;while(!(args[count].equals(“”)))count++;7:Whichisthemain()methodreturnofaapplication?A.StringB.byteC.charD.void8:Usetheoperator“>>”and“>>>”.Whichstatementistrue?A.10100000000000000000000000000000>>4give00001010000000000000000000000000B.10100000000000000000000000000000>>4give11111010000000000000000000000000C.10100000000000000000000000000000>>>4give00000000000000000000000000000000D.10100000000000000000000000000000>>>4give111110100000000000000000000000009:Aclassdesignrequiresthatamembervariableshouldbeaccessibleonlybysamepackage,whichmodiferwordshouldbeused?A.protectedB.publicC.nomodiferD.private10:public

class

OuterClass

{

private

double

d1

=

1.0;

//insert

code

here

}

You

need

to

insert

an

inner

class

declaration

at

line

3.

Which

two

inner

class

declarations

are

valid?

A.classInnerOne{publicstaticdoublemethoda(){returnd1;}}B.publicclassInnerOne{staticdoublemethoda(){returnd1;}}C.privateclassInnerOne{doublemethoda(){returnd1;}}D.staticclassInnerOne{protecteddoublemethoda(){returnd1;}}11:public

class

X{

public

Object

m(){

Object

o

=

new

Float(3.14F);//line

3

Object

[]

oa

=

new

Object[1];//line

4

oa[0]

=

o;//line

5

o=null;//line

6

return

oa[0];//line

7

}

}

When

is

the

Float

object,

created

in

line

3,eligible

for

garbage

collection?

A.justafterline5.B.justafterline6C.justafterline7(thatis,asthemethodreturns)D.neverinthismethod12:WhichstatementsaboutJavacodesecurityarenottrue?A.Thebytecodeverifierloadsallclassesneededfortheexecutionofaprogram.B.Executingcodeisperformedbytheruntimeinterpreter.C.Atruntimethebytecodesareloaded,checkedandruninaninterpreter.D.Theclassloaderaddssecuritybyseparatingthenamespacesfortheclassesofthelocalfilesystemfromthoseimportedfromnetworksources.13:使用JDBC可以做到的是A.把二进制代码传送到任何关系数据库中B.把Java源代码传送到任何关系数据库中C.把表单信息传送到任何关系数据库中D.很容易地把SQL语句传送到任何关系数据库中14:Give

the

following

code:

public

class

Example{

public

static

void

main(String

args[]

){

int

l=0;

do{

System.out.println(“Doing

it

for

l

is:”+l);

}while(--l>0)

System.out.println(“Finish”);

}

}

Which

well

be

output:

A.Doingitforlis3B.Doingitforlis1C.Doingitforlis2D.Doingitforlis015:What

will

happen

when

you

attempt

to

compile

and

run

the

following

code?

int

Output

=

10;

boolean

b1

=

false;

if((b1

==

true)

&&

((Output

+=

10)

==

20))

{

System.out.println("We

are

equal

"

+

Output);

}

else

{

System.out.println("Not

equal!

"

+

Output);

}

Choices:

A.Compilationerror,attemptingtoperformbinarycomparisononlogicaldatatypeB.Compilationandoutputof"Weareequal10".C.Compilationandoutputof"Notequal!20".D.Compilationandoutputof"Notequal!10".16:设有变量说明语句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.有语法错误简答题17:String是最基本的数据类型吗?18:数组a[N],存放了1至N-1个数,其中某个数重复一次。写一个函数,找出被重复的数字.时间复杂度必须为o(N)函数原型:intdo_dup(inta[],intN)19:用100元钱买100支笔,其中钢笔3元/支,圆珠笔2元/支,铅笔0.5元/支,问钢笔、圆珠笔和铅笔可以各买多少支?20:如何现实servlet的单线程模式?21:有一个

温馨提示

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

评论

0/150

提交评论