1) 下面的哪個包包含由MIDP支援的GUI元件?P3.5
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); }