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?
A.just after line 5.
B.just after line 6
C.just after line 7(that is,as the method returns)
D.never 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 Example.java,causes precisely one error during compilation:
class SubClass extends BaseClass{
}
class BaseClass(){
String str;
public BaseClass(){
System.out.println(“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 Example.java,causes precisely one error during compilation:
class SubClass extends BaseClass{
}
class BaseClass(){
String str;
public BaseClass(){
System.out.println(“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) System.out.println("Some things are true in this world");
else System.out.println("Nothing is true in this world!");
else if (a && (b = c)) System.out.println("It's too confusing to tell what is true and what is false");
else System.out.println("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) System.out.println("Some things are true in this world");
else System.out.println("Nothing is true in this world!");
else if (a && (b = c)) System.out.println("It's too confusing to tell what is true and what is false");
else System.out.println("Hey this won't compile");
Choices:
A.The code won't compile
B."Some things are true in this world" will be printed
C."Hey this won't compile" will be printed
D.None 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?
A.public class MyClass{//do other thing…}
B.static int PI=3.14
C.class MyClass{//do something…}
D.none
6:public class Parent {
int change() {…}
}
class Child extends Parent {
}
Which methods can be added into class Child?
A.public int change(){}
B.abstract int chang(){}
C.private int change(){}
D.none
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.第二行的聲明不會(huì )為變量myVect分配內存空間。
B.第二行語(yǔ)句創(chuàng )建一個(gè)Vector類(lèi)對象。
C.第三行語(yǔ)句創(chuàng )建一個(gè)Vector類(lèi)對象。
D.第三行語(yǔ)句為一個(gè)Vector類(lèi)對象分配內存空間
8:What is written to the standard output given the following statement:System.out.println(4|7);
Select the right answer:
A.4
B.5
C.6
D.7
9:Which fragments are not correct in Java source file?
A.package testpackage; public class Test{//do something...}
B.import java.io.*; package testpackage; public class Test{// do something...}
C.import java.io.*; class Person{// do something...} public class Test{// do something...}
D.import java.io.*; import java.awt.*; 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[]){
System.out.println(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[]){
System.out.println(x[5]);
}
}
Which statement is corrected?
A.When compile, some error will occur.
B.When run, some error will occur.
C.Output is zero.
D.Output is null.
11:使用 JDBC 可以做到的是
A.把二進(jìn)制代碼傳送到任何關(guān)系數據庫中
B.把 Java 源代碼傳送到任何關(guān)系數據庫中
C.把表單信息傳送到任何關(guān)系數據庫中
D.很容易地把 SQL 語(yǔ)句傳送到任何關(guān)系數據庫中
12:Which method you define as the starting point of new thread in a class from which new the thread can be excution?
A.public void start()
B.public void run()
C.public void runnable()
D.public static void main(String args[])
13:Which statements about Java code security are not true?
A.The bytecode verifier loads all classes needed for the execution of a program.
B.Executing code is performed by the runtime interpreter.
C.At runtime the bytecodes are loaded, checked and run in an interpreter.
D.The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.
14:關(guān)于垃圾收集的哪些敘述是對的。
A.程序開(kāi)發(fā)者必須自己創(chuàng )建一個(gè)線(xiàn)程進(jìn)行內存釋放的.工作。
B.垃圾收集將檢查并釋放不再使用的內存。
C.垃圾收集允許程序開(kāi)發(fā)者明確指定并立即釋放該內存。
D.垃圾收集能夠在期望的時(shí)間釋放被java對象使用的內存。
15:Give the following java class:
public class Example{
public static void main(String args[]){
static int x[] = new int[15];
System.out.println(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];
System.out.println(x[5]);
}
}
Which statement is corrected?
A.When compile, some error will occur.
B.When run, some error will occur.
C.Output is zero.
D.Output is null.
16:Select valid identifier of Java:
Select valid identifier of Java:
A.%passwd
B.3d_game
C.$charge
D.this
簡(jiǎn)答題
17:abstract class和interface有什么區別?
18:hibernate中,什么情況下,對象的狀態(tài)可以由持久的變?yōu)橥泄艿?
19:兩個(gè)數相乘,小數點(diǎn)后位數沒(méi)有限制,請寫(xiě)一個(gè)高精度算法。
20:求符合指定規則的數。
給定函數d(n) = n n的各位之和,n為正整數,如 d(78) = 78 7 8=93。 這樣這個(gè)函數
可以看成一個(gè)生成器,如93可以看成由78生成。
定義數A:數A找不到一個(gè)數B可以由d(B)=A,即A不能由其他數生成,F在要寫(xiě)程序,找出
1至10000里的所有符合數A定義的數。
輸出:
1
3
…
【JAVA系統分析筆試題】相關(guān)文章:
精選Java筆試題12-20
Java經(jīng)典筆試題12-15
java試題及答案08-12
360筆試題目07-11
華為2017筆試題08-16
java基礎筆試題201710-15
Java基礎筆試題大全10-15
華為的Java筆試題07-31
Java招聘筆試題目03-03
高級Java筆試題集合02-10