糯米文學吧

位置:首頁 > IT認證 > NIIT認證

NIIT認證J2ME考試真題

NIIT認證2.06W

1) 下面的哪個包包含由MIDP支持的GUI組件?P3.5

NIIT認證J2ME考試真題

1. et 2.

3. 4. i

2) 思考下面的代碼:

import et.*;

import i.*;

public class Hello extends MIDlet

{

private Display Exhibit;

private Form show;

public Hello()

{

Exhibit = isplay(this);

show = new Form("Name");

}

public void startApp() throws MIDletStateChangeException

{

urrent(show);

}

public void pauseApp()

{

}

public void destroyApp(boolean unconditional)

{

}

}

下面的哪個代碼段應該被增加到上述的代碼中來創建一個字符串項並將它顯示在屏幕上?P2.8-2.9

1. StringItem strIt = new StringItem(" ", "Msg"); nd(strIt);

2. StringItem strIt = new StringItem(" ", "Msg"); nd(strIt);

3. show = new StringItem(" ", "Msg"); nd(strIt);

4. StringItem strIt = new StringItem(" ", "Msg"); nd(show);

3) 你正在為一個銀行程序開發一個MIDlet。當客户向銀行發送一個請求時,一個進程指示將一直顯示,直到請求被處理完為止。進程指示應該被嵌入到form組件中。下面 的哪個方法可以在設備屏幕上顯示進程指示?P4.16

1. public void showGauge() { Form form = new Form(“Gauge”); Gauge gauge = new Gauge (“Progress”, false, 100, 0); nd (gauge); Display display = isplay(this); urrent(form); }

2. public void showGauge() { Gauge gauge = new Gauge (“Progress”, false, 100, 0); Display display = isplay(this); urrent(gauge); }

3. public void showGauge() { Form form = new Form(“Gauge”); Gauge gauge = new Gauge (“Progress”, false, 100, 0); nd (gauge); urrent(form); }

4. public void showGauge() { Form form = new Form(“Gauge”); Gauge gauge = new Gauge (“Progress”, false, 100, 0); nd (gauge); Display display = urrent(form); urrent(gauge); }

4) 在J2ME中,下面的哪個包可以使用網絡連接?P3.4

1. et

2. i

3.

4.

5) 思考下面的陳述:

陳述A:標準的J2ME工具包可以解析XML文件

標準B:基於XML解釋器的事件保存被移動設備解析的整個XML文件。

關於上面陳述,下面哪項是正確的?P5.20

1. 陳述A是正確的,陳述B是錯誤的。 2. 陳述A是錯誤的,陳述B是正確的。

3. 兩個陳述都是正確的。 4. 兩個陳述都是錯誤的。

6) 你正在編寫連接到Web服務器上運行的一個servlet的MIDlet代碼。MIDlet的代碼段如下所示:

public void connhandler()

{

HttpConnection con = null;

display("Obtaining Connection from Server..." );

try

{

con = ect(url, this );

display("Connecting to the server..." );

int response = esponseCode();

if( response == _OK )

{

StringBuffer text = new StringBuffer();

// Here's where you read the data.

// This case expects an integer

// followed by zero or more

// strings.

try

{

DataInputStream din = new DataInputStream(InputStream() );

int n = Int();

while( n-- > 0 )

{

nd(UTF() );

nd( '"n' );

}

}

catch( IOException e )

{

}

done("Your current balance:"n" + ring() );

}

else

{

done("Unexpected return code: " + rc );

}

}

catch( IOException e )

{

done( "Exception " + e + " trying to connect." );

}

}

編譯MIDlet代碼後,你試圖不啟動Web服務器來連接servlet。根據上面的代碼段,程序將會輸出什麼?P6.17

1. Unexpected return code: 500

2. Unexpected return code: 302

3. Unexpected return code: 303

4. Exception ception trying to connect

7) 一個文本文件包含幾行文本,一個在MIDlet和文本文件之間的連接已經被建立。下面的哪個代碼段將打開一個輸入連接並每次從這個文本文件中獲取一行文本?P5.12

1. InputStream ins = null; ins = InputStream(); StringBuffer buffer = new StringBuffer(); int i; while ((i=())!= -1) { if (i!='"n') { nd(i); } }

2. InputStream ins = null; ins = InputStream(); StringBuffer buffer = new StringBuffer(); int i; while ((i=())!= -1) { if (i!='"n') { nd((char)i); } }

3. InputStream ins = null; ins = OutputStream(); StringBuffer buffer = new StringBuffer(); int i; while ((i=())!= -1) { if (i!='"n') { nd((char)i); } }

4. InputStream ins = null; ins = InputStream(); StringBuffer buffer = new StringBuffer(); char i; while ((i=())!= -1) { if (i!='"n') { nd((char)i); } }

8) 確定包的類。P3.4

1. Connector 和 ConnectionNotFoundException 2. InputStream 和OutputStream

3. DataInput 和 DataOutput 4. DataInputStream 和 DataOutputStream

9) RecordEnumeration接口定義了下面的`哪個方法?P7.4

1. enumerateRecords() 2. getRecord() 3. nextRecord() 4. addRecord()

10) 代碼段如下所示:(19)

代碼段1:

byte[] ba = new byte[50];

int nob = ecord (id, ba, 0);

代碼段2:

byte[] ba = null;

ba = ecord (id);

代碼段3:

byte[] ba = new byte[50];

ba = ecord (id);

代碼段4:

byte[] ba = null;

int nob = ecord (id, ba);

用下面哪個代碼段從記錄存儲中獲取一條特定記錄?P7.8

1. 僅代碼段1和代碼段3 2. 僅代碼段2和代碼段4

3. 代碼段2、代碼段3和代碼段4 4. 代碼段1、代碼段2和代碼段3

11) SaveMyMoney銀行為他們的客户介紹移動銀行業務。有一個應用程序使用名為的記錄存儲,使客户方便的記錄所有提交到銀行的單據。你能夠使用下面哪段代碼獲取中的列舉對象?P7.10

1. public void getEnum() { RecordStore rs; rs = RecordStore(“checks”, true); rs = erateRecords (null, null, false); }

2. public void getEnum() { RecordEnumeration re; RecordStore rs; rs = RecordStore(“checks”, true); re = erateRecords (null, null, false); }

3. public void getEnum() { RecordStore rs; rs = RecordStore(“checks”, true); RecordEnumeration re = erateRecords (null, null, false); }

4. public void getEnum() { RecordEnumeration re; RecordStore rs; rs = RecordStore(“checks”, true); rs = erateRecords (null, null, false); }

標籤:NIIT J2ME 真題 考試