当前位置:学者斋 >

IT认证 >NIIT认证 >

NIIT认证J2ME考试真题

NIIT认证J2ME考试真题

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 真题 考试
  • 文章版权属于文章作者所有,转载请注明 https://xuezhezhai.com/itrz/niitrz/9vz5jr.html