- 相關(guān)推薦
新華信國(guó)際信息咨詢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:
下述程序代碼中有語(yǔ)法錯(cuò)誤的行是( )。
int i,ia[10],ib[10]; /*第一行*/
for (i=0;i<=9;i++) /*第2行*/
ia[i]=0; /*第3行*/
ib=ia; /*第4行*/
下述程序代碼中有語(yǔ)法錯(cuò)誤的行是( )。
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í)行下述語(yǔ)句組后,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
簡(jiǎn)答題
15:不用乘法或加法給一個(gè)數(shù)增加7倍。
16:abstract class和interface有什么區(qū)別?
17:用最有效率的方法算出2乘以8等於幾?
18:說(shuō)出在JSP頁(yè)面里是怎么分頁(yè)的?
19:四種會(huì)話跟蹤技術(shù)。
20:調(diào)用系統(tǒng)命令實(shí)現(xiàn)刪除文件的操作。
21:如果要設(shè)計(jì)一個(gè)圖形系統(tǒng),請(qǐng)你設(shè)計(jì)基本的圖形元件(Point,Line,Rectangle,Triangle)的簡(jiǎn)單實(shí)現(xiàn)。
22:描述Cookie和Session的作用,區(qū)別和各自的應(yīng)用范圍,Session工作原理。
23:有A、B兩個(gè)文件,文件格式相同,均為每行一個(gè)十進(jìn)制整型數(shù)字,兩個(gè)文件的行數(shù)不一定相等,但均在一千萬(wàn)行左右。A文件中的數(shù)字兩兩不等,B文件中的數(shù)字兩兩不等, 請(qǐng)用一個(gè)算法找出A和B兩文件中所有相同的數(shù),并且從小到大有序輸出。請(qǐng)考慮統(tǒng)計(jì)程序如何實(shí)現(xiàn),給出設(shè)計(jì)思路和關(guān)鍵算法(可使用偽代碼),并估計(jì)程序核心代碼的時(shí)間復(fù)雜度和空間復(fù)雜度。
24:下面的代碼有什么問(wèn)題?
char *_strdup( const char *strSource )
{
static char str[MAX_STR_LEN];
strcpy(str, strSource);
return str;
}
25:Security 公司的網(wǎng)絡(luò)管理工程師Mr. leak最近發(fā)現(xiàn)有不少來(lái)自公司外部IP的請(qǐng)求,試圖非法訪問(wèn)公司內(nèi)部資源,為了不影響數(shù)據(jù)訪問(wèn)流程。他不得不寫一個(gè)高效的程序——一個(gè)工作在Ipv4上的防火墻,如果請(qǐng)求來(lái)自非授權(quán)的ip地址,則將請(qǐng)求丟棄。為了便于管理,通過(guò)文本文件IP.TXT來(lái)配置授權(quán)的IP地址,文件格式為每行(’/n’)一個(gè) IP地址(或IP段),范圍不超過(guò)一個(gè)B類。例如:
162.105.91.163
59.66.105.0 59.66.105.255
211.71.0.0 211.71.255.255
限制:IP段的起止地址間以空格隔開。文件不超過(guò)10萬(wàn)行,內(nèi)存不超過(guò)4M字節(jié)。
要求:請(qǐng)編寫一個(gè)程序,讀入IP.TXT文件。并從標(biāo)準(zhǔn)輸入接受一個(gè)IP地址。如果該地址在授權(quán)范圍內(nèi),則在標(biāo)準(zhǔn)輸出上打印Y,否則打印N.如果輸入為一個(gè)空行,程序結(jié)束。
請(qǐng)給出思路(文字描述),完成代碼,分析你采用算法的優(yōu)劣。請(qǐng)列舉測(cè)試方法和思路
【新華信國(guó)際信息咨詢JAVA工程師筆試題】相關(guān)文章:
Java工程師面試題03-29
java中級(jí)工程師面試題03-30
對(duì)國(guó)際工程咨詢工程師認(rèn)識(shí)的誤區(qū)03-10
中興Java Web開發(fā)工程師筆試題及答案02-10
Java中級(jí)開發(fā)工程師筆試題及答案201603-04
迅雷JAVA廣州站二筆筆試題目分享11-21
2018咨詢工程師考試模擬試題及答案02-26
2017咨詢工程師《組織管理》模擬試題03-08
java筆試題及答案02-09
java筆試題及答案07-28