當前位置:學問君>學習教育>考研>

思遷數碼科技Java軟件工程師筆試真題

學問君 人氣:1.91W

選擇題

思遷數碼科技Java軟件工程師筆試真題

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

2: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++)

{

t(i);

}

t(i);

}

}

Choices:

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++)

{

t(i);

}

t(i);

}

}

Choices:

A.0122

B.0123

ilation error

of these

3:

Give the following code:

public class Example{

public static void main(String args[] ){

int l=0;

do{

tln(“Doing it for l is:”+l);

}while(--l>0)

tln(“Finish”);

}

}

Which well be output:

Give the following code:

public class Example{

public static void main(String args[] ){

int l=0;

do{

tln(“Doing it for l is:”+l);

}while(--l>0)

tln(“Finish”);

}

}

Which well be output:

g it for l is 3

g it for l is 1

g it for l is 2

g it for l is 0

4:d(11.5)等於多少?

A.11

B.12

C.11.5

5:

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))

{

tln("We are equal " + Output);

}

else

{

tln("Not equal! " + Output);

}

Choices:

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))

{

tln("We are equal " + Output);

}

else

{

tln("Not equal! " + Output);

}

Choices:

ilation error, attempting to perform binary comparison on logical data type

ilation and output of "We are equal 10".

ilation and output of "Not equal! 20".

ilation and output of "Not equal! 10".

6:

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

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

public class AssertTest{

public void methodA(int i){

assert i >= 0 : methodB();

tln(i);

}

public void methodB(){

tln("The value must not be negative");

}

public static void main(String args[]){

AssertTest test = new AssertTest();

odA(-10);

}

}

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

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

public class AssertTest{

public void methodA(int i){

assert i >= 0 : methodB();

tln(i);

}

public void methodB(){

tln("The value must not be negative");

}

public static void main(String args[]){

AssertTest test = new AssertTest();

odA(-10);

}

}

will print -10

will result in AssertionError showing the message-“the value must not be negative”.