当前位置

首页 > 简历 > 求职简历 > 笔试题目 > JAVA系统分析笔试题

JAVA系统分析笔试题

推荐人: 来源: 笔墨帮 阅读: 2.75W 次

选择题

JAVA系统分析笔试题

1: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?

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?

after line 5.

after line 6

after line 7(that is,as the method returns)

r in this method

2:use the operator “>>” and “>>>”. which statement is true?

a.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 0000 1010 0000 0000 0000 0000 0000 0000

b.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 1111 1010 0000 0000 0000 0000 0000 0000

c.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 0000 0000 0000 0000 0000 0000 0000 0000

d.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 1111 1010 0000 0000 0000 0000 0000 0000

3:the following code is entire contents of a file called ,causes precisely one error during compilation:

class subclass extends baseclass{

}

class baseclass(){

string str;

public baseclass(){

tln(“ok”);}

public baseclass(string s){

str=s;}}

public class example{

public void method(){

subclass s=new subclass(“hello”);

baseclass b=new baseclass(“world”);

}

}

which line would be cause the error?

the following code is entire contents of a file called ,causes precisely one error during compilation:

class subclass extends baseclass{

}

class baseclass(){

string str;

public baseclass(){

tln(“ok”);}

public baseclass(string s){

str=s;}}

public class example{

public void method(){

subclass s=new subclass(“hello”);

baseclass b=new baseclass(“world”);

}

}

which line would be cause the error?

a.9

b.10

c.11

d.12

4:what will be the result of executing the following code?

boolean a = true;

boolean b = false;

boolean c = true;

if (a == true)

if (b == true)

if (c == true) tln("some things are true in this world");

else tln("nothing is true in this world!");

else if (a && (b = c)) tln("it's too confusing to tell what is true and what is false");

else tln("hey this won't compile");

choices:

what will be the result of executing the following code?

boolean a = true;

boolean b = false;

boolean c = true;

if (a == true)

if (b == true)

if (c == true) tln("some things are true in this world");

else tln("nothing is true in this world!");

else if (a && (b = c)) tln("it's too confusing to tell what is true and what is false");

else tln("hey this won't compile");

choices:

code won't compile

b."some things are true in this world" will be printed

c."hey this won't compile" will be printed

of these

5:give the following java source fragement:

//point x

public class interesting{

//do something

}

which statement is correctly java syntax at point x?

give the following java source fragement:

//point x

public class interesting{

//do something

}

which statement is correctly java syntax at point x?

ic class myclass{//do other thing…}

ic int pi=3.14

s myclass{//do something…}



6:public class parent {

int change() {…}

}

class child extends parent {

}

which methods can be added into class child?

ic int change(){}

ract int chang(){}

ate int change(){}



7:给出下面的代码片断。。。下面的哪些陈述为错误的?

1) public void create() {

2) vector myvect;

3) myvect = new vector();

4) }

给出下面的代码片断。。。下面的哪些陈述为错误的?

1) public void create() {

2) vector myvect;

3) myvect = new vector();

4) }

a.第二行的声明不会为变量myvect分配内存空间。

b.第二行语句创建一个vector类对象。

c.第三行语句创建一个vector类对象。

d.第三行语句为一个vector类对象分配内存空间

8:what is written to the standard output given the following statement:tln(4|7);

select the right answer:

a.4

b.5

c.6

d.7

9:which fragments are not correct in java source file?

age testpackage; public class test{//do something...}

rt .*; package testpackage; public class test{// do something...}

rt .*; class person{// do something...} public class test{// do something...}

rt .*; import .*; public class test{// do something...}

10:give the following java class:

public class example{

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

public static void main(string args[]){

tln(x[5]);

}

}

which statement is corrected?

give the following java class:

public class example{

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

public static void main(string args[]){

tln(x[5]);

}

}

which statement is corrected?

compile, some error will occur.

run, some error will occur.

ut is zero.

ut is null.

11:使用 jdbc 可以做到的是

a.把二进制代码传送到任何关系数据库中

b.把 java 源代码传送到任何关系数据库中

c.把表单信息传送到任何关系数据库中

d.很容易地把 sql 语句传送到任何关系数据库中

12:which method you define as the starting point of new thread in a class from which new the thread can be excution?

ic void start()

ic void run()

ic void runnable()

ic static void main(string args[])

13:which statements about java code security are not true?

bytecode verifier loads all classes needed for the execution of a program.

uting code is performed by the runtime interpreter.

runtime the bytecodes are loaded, checked and run in an interpreter.

class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.

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

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

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

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

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

15:give the following java class:

public class example{

public static void main(string args[]){

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

tln(x[5]);

}

}

which statement is corrected?

give the following java class:

public class example{

public static void main(string args[]){

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

tln(x[5]);

}

}

which statement is corrected?

compile, some error will occur.

run, some error will occur.

ut is zero.

ut is null.

16:select valid identifier of java:

select valid identifier of java:

a.%passwd

b.3d_game

c.$charge



简答题

17:abstract class和interface有什么区别?

18:hibernate中,什么情况下,对象的状态可以由持久的变为托管的?

19:两个数相乘,小数点后位数没有限制,请写一个高精度算法。

20:求符合指定规则的数。

给定函数d(n) = n n的各位之和,n为正整数,如 d(78) = 78 7 8=93。 这样这个函数

可以看成一个生成器,如93可以看成由78生成。

定义数a:数a找不到一个数b可以由d(b)=a,即a不能由其他数生成。现在要写程序,找出

1至10000里的所有符合数a定义的数。

输出:

1

3