- 相關推薦
新華信國際信息咨詢JAVA工程師筆試題
選擇題
1:Which statement about the garbage collection mechanism are true?
A.Garbage collection require additional programe code in cases where multiple threads are running.
B.The programmer can indicate that a reference through a local variable is no longer of interest.
C.The programmer has a mechanism that explicity and immediately frees the memory used by Java objects.
D.The garbage collection mechanism can free the memory used by Java Object at explection time.
2:
Given:
1. public class test (
2. public static void main (String args[]) {
3. int i = 0xFFFFFFF1;
4. int j = ~i;
5.
6. }
7. )
What is the decimal value of j at line 5?
Given:
1. public class test (
2. public static void main (String args[]) {
3. int i = 0xFFFFFFF1;
4. int j = ~i;
5.
6. }
7. )
What is the decimal value of j at line 5?
A.0
B.1
C.14
D.-15
3:
What happens when you try to compile and run the following program?
class Mystery{
String s;
public static void main(String[] args){
Mystery m=new Mystery();
m.go();
}
void Mystery(){
s=”constructor”;
}
void go(){
System.out.println(s);
}
}
What happens when you try to compile and run the following program?
class Mystery{
String s;
public static void main(String[] args){
Mystery m=new Mystery();
m.go();
}
void Mystery(){
s=”constructor”;
}
void go(){
System.out.println(s);
}
}
A.this code compliles but throws an exception at runtime
B.this code runs but nothing appears in the standard output
C.this code runs and “constructor” in the standard output
D.this code runs and writes ”null” in the standard output
4:
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
5:
下述程序代碼中有語法錯誤的行是( )。
int i,ia[10],ib[10]; /*第一行*/
for (i=0;i<=9;i++) /*第2行*/
ia[i]=0; /*第3行*/
ib=ia; /*第4行*/
下述程序代碼中有語法錯誤的行是( )。
int i,ia[10],ib[10]; /*第一行*/
for (i=0;i<=9;i++) /*第2行*/
ia[i]=0; /*第3行*/
ib=ia; /*第4行*/
A.第1行
B.第2行
C.第3行
D.第4行
6:
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?
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.class InnerOne{ public static double methoda() {return d1;} }
B.public class InnerOne{ static double methoda() {return d1;} }
C.private class InnerOne{ double methoda() {return d1;} }
D.static class InnerOne{ protected double methoda() {return d1;} }
7:假定a和b為int型變量,則執(zhí)行下述語句組后,b的值為
a=1;
b=10;
do
{
b-=a;
a++;
} while (b--<0);
A.9
B.-2
C.-1
D.8
8:
String s=”Example String”;Which operation is not legal?
String s=”Example String”;Which operation is not legal?
A.int i=s.length();
B.s[3]=”x”;
C.String short_s=s.trim();
D.String t=”root”+s;
9:
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?
A.Change private int x to public int x
B.change private int x to static int x
C.Change private int x to protected int x
D.change private int x to final int x
10:
What will happen when you attempt to compile and run the following code?
class Base
{
int i = 99;
public void amethod()
{
System.out.println("Base.amethod()");
}
Base()
{
amethod();
}
}
public class Derived extends Base
{
int i = -1;
public static void main(String argv[])
{
Base b = new Derived();
System.out.println(b.i);
b.amethod();
}
public void amethod()
{
System.out.println("Derived.amethod()");
}
}
Choices:
What will happen when you attempt to compile and run the following code?
class Base
{
int i = 99;
public void amethod()
{
System.out.println("Base.amethod()");
}
Base()
{
amethod();
}
}
public class Derived extends Base
{
int i = -1;
public static void main(String argv[])
{
Base b = new Derived();
System.out.println(b.i);
b.amethod();
}
public void amethod()
{
System.out.println("Derived.amethod()");
}
}
Choices:
A.Derived.amethod() -1 Derived.amethod()
B.Derived.amethod() 99
C.Compile time error
D.Derived.amethod()
11:
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:
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.Compilation error at line 5
B.Compilation error at line 9
C.Runtime exception at line 11
D.None of these
12:Which statement about listener is true?
A.Most component allow multiple listeners to be added.
B.If multiple listener be add to a single component, the event only affected one listener.
C.Component don?t allow multiple listeners to be add.
D.none
13:Which of the following answer is correct to express the value 8 in octal number?
A.010
B.0x10
C.08
D.0x8
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:
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.Doing it for l is 3
B.Doing it for l is 1
C.Doing it for l is 2
D.Doing it for l is 0
簡答題
15:不用乘法或加法給一個數(shù)增加7倍。
16:abstract class和interface有什么區(qū)別?
17:用最有效率的方法算出2乘以8等於幾?
18:說出在JSP頁面里是怎么分頁的?
19:四種會話跟蹤技術。
20:調(diào)用系統(tǒng)命令實現(xiàn)刪除文件的操作。
21:如果要設計一個圖形系統(tǒng),請你設計基本的圖形元件(Point,Line,Rectangle,Triangle)的簡單實現(xiàn)。
22:描述Cookie和Session的作用,區(qū)別和各自的應用范圍,Session工作原理。
23:有A、B兩個文件,文件格式相同,均為每行一個十進制整型數(shù)字,兩個文件的行數(shù)不一定相等,但均在一千萬行左右。A文件中的數(shù)字兩兩不等,B文件中的數(shù)字兩兩不等, 請用一個算法找出A和B兩文件中所有相同的數(shù),并且從小到大有序輸出。請考慮統(tǒng)計程序如何實現(xiàn),給出設計思路和關鍵算法(可使用偽代碼),并估計程序核心代碼的時間復雜度和空間復雜度。
24:下面的代碼有什么問題?
char *_strdup( const char *strSource )
{
static char str[MAX_STR_LEN];
strcpy(str, strSource);
return str;
}
25:Security 公司的網(wǎng)絡管理工程師Mr. leak最近發(fā)現(xiàn)有不少來自公司外部IP的請求,試圖非法訪問公司內(nèi)部資源,為了不影響數(shù)據(jù)訪問流程。他不得不寫一個高效的程序——一個工作在Ipv4上的防火墻,如果請求來自非授權的ip地址,則將請求丟棄。為了便于管理,通過文本文件IP.TXT來配置授權的IP地址,文件格式為每行(’/n’)一個 IP地址(或IP段),范圍不超過一個B類。例如:
162.105.91.163
59.66.105.0 59.66.105.255
211.71.0.0 211.71.255.255
限制:IP段的起止地址間以空格隔開。文件不超過10萬行,內(nèi)存不超過4M字節(jié)。
要求:請編寫一個程序,讀入IP.TXT文件。并從標準輸入接受一個IP地址。如果該地址在授權范圍內(nèi),則在標準輸出上打印Y,否則打印N.如果輸入為一個空行,程序結(jié)束。
請給出思路(文字描述),完成代碼,分析你采用算法的優(yōu)劣。請列舉測試方法和思路
【新華信國際信息咨詢JAVA工程師筆試題】相關文章:
Java工程師面試題03-29
java中級工程師面試題03-30
對國際工程咨詢工程師認識的誤區(qū)03-10
中興Java Web開發(fā)工程師筆試題及答案02-10
Java中級開發(fā)工程師筆試題及答案201603-04
迅雷JAVA廣州站二筆筆試題目分享11-21
2018咨詢工程師考試模擬試題及答案02-26
2017咨詢工程師《組織管理》模擬試題03-08
java筆試題及答案02-09
java筆試題及答案07-28