Top Banner
sn o stem_text opt1_txt 1 Consider the Statements: Statement A: The 3GSM technology provides the facility to deliver textual and visual information, and send and receive still and animated images. Statement B: The GPRS technology provides high bandwidth and quality for transmitting voice and text across a wireless network. Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statemen 2 Pat Greene is working as application developer at with Deez Inc. The company organization has created a new mobile application by using J2ME. The management wants to add some features in the J2ME application so that the user can use this application without maintaining a constant connection with the wireless network. Therefore, the business manager of the company organization has asked Pat to upgrade the application with reduced network failure and transport cost. Which feature of J2ME enables Pat to develop such application? 1,Cross platform compatibility.
100
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: j2me

sno stem_text opt1_txt

1

Consider the Statements:

Statement A: The 3GSM technology provides the facility to deliver textual and visual information, and send and receive still and animated images.

Statement B: The GPRS technology provides high bandwidth and quality for transmitting voice and text across a wireless network.

Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statement B is False.

2

Pat Greene is working as application developer at with Deez Inc. The company organization has created a new mobile application by using J2ME. The management wants to add some features in the J2ME application so that the user can use this application without maintaining a constant connection with the wireless network. Therefore, the business manager of the company organization has asked Pat to upgrade the application with reduced network failure and transport cost. Which feature of J2ME enables Pat to develop such application? 1,Cross platform compatibility.

Page 2: j2me

3

Jim Wilkins is a mobile application developer at with Safest Software. The management of the company organization asks Jim to develop a mobile application, which enables mobile users to download video and music clips and access high-speed Internet. Which technology should Jim use to develop mobile application with the required features? 1,WAP

4

Bob Edwin is working as an application developer at with Red Sky Experts. Bob wants to develop an application by using the Enterprise Java Beans (EJB), Servlets and Java Server Pages (JSP), and Extensible Markup Language (XML). Bob also wants to use this application across the distributed network. Which Java technology should Bob use to develop this application? 1,J2SE

5

Steve Irving is working as mobile application developer at with Blue Moon Computers. Steve has developed a mobile application, which enables the user to download wireless applications on mobile devices. It also provides the facility to deliver textual and visual information, such as sports scores, news headlines, and weather information. But now, Steve wants to upgrade that mobile application with high data transmission speed and multimedia data services. Which technology should Steve use to develop such mobile application? 1,EDGE

Page 3: j2me

6

Christine Turner works as a software programmer with SmartLabs. Christine has been assigned the task to develop a MIDlet suite that denies access to all the restricted APIs. After building, developing and packaging the suite, Christine decides to add digital signature and signer certificate of a JAR file to a JAD file. Which of the following security domains should Christine assign to the certificate? 1,Maximum domain

7

Diane Frye, the mobile application developer, is working with SmartLabs. Diana needs to develop an application that provides data encryption, source authentication, and data integrity while transmitting data over a network. Which of the following application level security techniques should Diane use in the application? 1,Protection domains

8

Ken Burton works as a mobile application developer with SuperGraphics. Ken is developing MIDlet applications that allow customers to connect to bank server and query their bank accounts by sending username and passwords. However, the username and password should be in the encrypted format. Which security measure should Ken use in the application to secure the data transmitted over the network traffic? 1,Implement secure UDP connection over SASL

Page 4: j2me

9

Consider the Statements:

Statement A: The blanket interaction mode allows permission to all the methods or APIs requested by the MIDlet suite until the user modifies the permission.

Statement B: The session interaction mode allows permission for only the current request for a method or an API.

Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statement B is False.

10

Mike Womack is working as a programmer with Technology Systems. Mike develops a MIDlet suite that helps connect to a remote server and transmit data over a network by using MIDP 1.0 specification. However, due to less security, Mike decides to execute the MIDlet suite on a MIDP 2.0 implemented device. For which of the following API does Mike needs to provide with explicit confirmation? 1,javax.microedition.lcdui.game

Page 5: j2me

11

Lee Mitchell, the mobile application developer with Blue Moon Computers, needs to develop a mobile application for insurance agents working at SSPT Corporation. The application will help the insurance agents to access the database of the organization and make necessary changes in the database. For this, Lee establishes a HTTP-based network connection. He develops the application and runs the developed application to check whether the application is working properly. Lee writes the following code snippet to close the existing HTTP connection:

try {

mHttpConnection.close (); // Close any open stream

}

catch (Exception ) {

// Handle the exception

}

However, Lee finds that he is not able to close the connection and handle the exception raised while closing the connection. What should Lee do to solve the problem?

1,Lee needs to replace the code with the following code.

try {

mHttpConnection.close (); // Close any open stream

}

catch (IOException ioe) {

// Handle the exception

}

Page 6: j2me

12

Donna Bard is working as a network administrator with Technology Systems. Donna has been assigned the task of establishing a network connection between mobile devices and Web servers in the organization. Donna needs to develop an HTTP connection to allow users to access the Web services through their mobile devices. Donna writes the following code to establish a connection:

Connector dc = Connector.open(www.wirelessdevnet.com);

However, when Donna runs the code, she is not able to establish the connection. What should Donna do to resolve the problem?

1,Donna needs to replace the code with the following code:

Connection sc = (Connector) Connector.open(“socket://localhost:9000”);

Page 7: j2me

13

Nancy Jones is working as a mobile application developer with Smart Software Developers. Nancy needs to develop a server-side application by using J2ME. Nancy needs to use mobile devices to access databases stored on the server of the organization. Nancy needs to configure the Web server to support servlets before creating enterprise applications by using J2ME. Nancy writes the following code:

private void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException {

PrintWriter out = response.getWriter();

out.println("some abc");

System.out.println ("some xyz");

}

The application does not run and the data is not retrieved from the server. What should be the possible problem with the code? 1,The return type of the function is private.

14

Larry Williams is working as a network administrator with SmartLabs. All the sales persons working in the company wants to communicate with each other. Larry needs to establish a connection among the sales persons through mobile devices so that they can retrieve information from each other. Larry uses GCF for setting up a serial port connection among different mobile devices. . What code snippet should Larry write to perform the task? 1,Connection cc = Connector.open(“datagram://:9000”);

Page 8: j2me

15

Ken Burton is working as a network administrator with SuperGraphics. Ken has been assigned the task of establishing a stream-based socket connection to enable the employees of the company to communicate and exchange data with each other. Ken used GCF for setting up connection among different mobile devices. The connector class GCF uses the open() method that specifies the type of network connection. Ken uses the following code snippet to establish the connection:

Connection dc = Connector.open(“datagram://:9000”);

However, when Ken runs the code, connection is not established. What should Ken do to solve the problem?

1,Ken needs to replace the code with the following code.

Connection cc = Connection.open(“socket://localhost:9000”);

Page 9: j2me

16

Tom Wilkins is working as mobile application developer with Technology Systems. The management asks Tom to develop a mobile application for the employees of AB Corp., a software firm. The Technical executives of AB Corp. working at the client sites need to access the centralized database of the organization to display and modify the products details. Tom needs to develop a mobile application to enable the executives of AB Corp. to access the centralized database through their cell phones. In addition, Jim needs to ensure that the executives are able to access the Web site, softwareproducts.com, of AB Corp. from their cell phones to provide stock details to their clients. What does Tom do to perform the required tasks?

1,Use Generic Connection Framework to connect to the centralized database and use the following code in the open() method to access Web pages:

Connection hc = Connection.open(www.softwareproducts.com);

Page 10: j2me

17

Chris Donaldson is working as mobile application developer with SuperGraphics. The management asks Chris to develop a game application for a mobile device and also enable the application to connect to Internet and access Web pages. Chris needs to draw graphical objects for developing the user interface of a two dimensional video game. Jim creates the template for drawing the images on the display screen of a mobile device. Jim needs to use the methods provided by MIDP APIs to draw the images on the template. What should Jim do to perform the required tasks?

1,Use the javax.microedition.lcdui and the javax.microedition.io package.

Page 11: j2me

18

Larry Williams is working as a software developer with InfoSuper Corp., which develops applications for mobile devices. The management asks Larry to create a application for mobile phones that enables the sales executives of an Insurance company, AB Corp. to access the centralized database. The policy details of the company organization, such as life-insurance policy details are placed at the centralized database at the main office of the organization company, in Atlanta. For this, Larry needs to create a network connection to enable the mobile application to connect to the database by using sockets. For security reasons, Larry needs to ensure that the connection to the database is made only for a specified time and InterruptedIOException is displayed when the connection time exceeds the specified limit. What does Larry do to perform the required tasks?

1,Use the open() method to create an HTTP connection and the Throwable class.

19

Jerry Smith is working as a software developer with BlueMoon computers, which provides wireless services to its customers. The management asks Jerry to develop a mobile application for mobile phones that provides Web services to the users, such as News. For this, Jerry writes the following code to open an HTTP based network connection:

mHttpConnection.setRequestMethod(HttpConnection.POST);

mHttpConnection.setRequestProperty("Content-Type", "text/plain");

mHttpConnection.setRequestProperty("Accept", "*/*");

mHttpConnection.setRequestProperty("Connection", "close");

1,Jerry includes the following code to make connection

mHttpConnection = (HttpConnection)Connector.open(url,

Connector.READ_WRITE,True);

Page 12: j2me

OutputStream os = mHttpConnection.openOutputStream();

String requestString = makeRequestString();

System.out.println("\n\nOut

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");

os.write((requestString+"\r\n").getBytes());

os.flush();

if (os != null)

os.close();

mIn = mHttpConnection.openInputStream();

int len = (int)mHttpConnection.getLength();

However, the application does not provide Web services. What does Jerry do to solve the problem?

Page 13: j2me

20

Steve Irving is working as a programmer in the application development department of Red Sky IT Systems. Steve develops mobile applications by using J2ME platform. Steve has been asked to develop a mobile application, which can provide Web services to the users. For this, Steve writes a code to close the network connection:

try {

mHttpConnection.close // Close any open stream

}

catch (IOException ) {

// Handle the exception

}

However, Steve is not able to close a network connection. What should Steve do to solve the problem?

1,Write the following code:

try {

mHttpConnection.close // Close any open stream

}

catch (IOException ioe) {

// Handle the exception

}

21

Diane Frye is a mobile application developer with SmartLabs. Diane is developing MIDlet applications that can connect to the remote server and help in transmitting the data with the remote server, over the network. Diane needs to implement security in the application so that the users can transmit data over the network without any security threats. Therefore, She decides to implement security features in the application that provides data encryption, source authentication, and data integrity. Which of the following application level security techniques should Diane use in the application? 1,Permissions and security policy

Page 14: j2me

22

Jim Lewis is working as an assistant software developer with Technology Systems. Jim develops a J2ME application for the mobile devices. Jim needs to secure the mobile application to ensure that the users can connect to remote servers without any security threats, such as password hacking and packet sniffing. For this, Jim decides to sign the MIDlet suite by adding digital signature and signer certificate of a JAR file to a JAD file. Jim decides to perform the following steps to sign the MIDlet suite:

Create a certificate

Create the signature and apply it to JAD

Insert the certificate in the JAD

Verify the signer certificate

Verify the MIDlet suite JAR

Authenticate a MIDlet suite

However, Pat, a MIDP developer notices that the steps identified by Jim to sign the MIDlet suite are not correct and will not lead to the required result. What should Jim do to solve the problem?

1,Jim needs to perform the following steps:

Create a certificate

Insert the certificate in the JAD

Create the signature and apply it to JAD

Authenticate a MIDlet suite

Verify the signer certificate

Verify the MIDlet suite JAR

Page 15: j2me

23

Donna Davidson is working as a software developer with Super Software Inc. Donna is developing a MIDP application. To secure the MIDlet suites from unauthorized access and malicious attacks, Donna decides to sign the MIDLet suite by adding digital signature and signer certificate of a JAR file to a JAD file. Donna needs to insert the certificate in the JAD after creating it to sign the MIDLet suite. Donna writes the following code to perform the task:

MIDlet Certificate <n> m>: base64 encoding of a certificate

However, Donna notices that code has some error in it because of which she is not able to insert certificate in the JAD. What should Donna do to solve the problem?

1,Donna needs to replace the code with the following line of code:

MIDlet-Certificate <n> <m>: <base64 encoding of a certificate>;

24

Larry Williams is working as a software developer with Super Software Inc. Larry is developing a J2ME application for mobile devices. Larry needs to secure the network traffic of the mobile application by encrypting the data before sending the data to the server. Larry writes the following code snippet to perform the task:

void getViaHttpsConnection(String url)

throws IOException {

HttpsConnection hc = null;

InputStream ios = null;

try {

hc = (HttpsConnection)Connector.open(url);

ios = hc.openDataOutputStream(); 1,Use the openDataInputStream () method instead of the openByteArray () method.

Page 16: j2me

if hc.getResponseCode() == HttpConnection.HTTP_OK) {

int length = (int)hc.getLength();

if (length < 0) {

byte[] data = new byte[length];

int len = is.readFully(data);

...

} else {

int ch1;

while ((ch1 = is.read()) != -1) {

...

}

}

} else {

...

}

} finally {

if (ios = null)

ios.close();

if (hc = null)

hc.close();

}

}

However, Larry notices that the code snippet is not running properly and has various errors in it. What should Larry do to solve the problem?

Page 17: j2me

25

Jim Lewis is working as a software developer at InfoSuper Corp. Jim has been assigned the task to develop a car racing game. To create game sounds, Jim needs Mobile Media API. Which of the following interface of MMAPI should Jim implement to control the media playback capabilities of the player? 1,Implement the Control Interface

26

Christine Turner is working as a mobile application developer at SuperGraphics. The management asks Christine to develop a mobile Jukebox application, which enables the users to play various types of sound file formats, such as MP3. To develop the application, Christine uses MMAPI to create the multimedia content on a mobile device. Christine needs to implement an interface in the application that enables mobile users to control the features of multimedia content, such as volume and tempo, on mobile devices. Which of the following interface should Christine implement to perform the required task? 1,The PlayerListener interface

27

Larry Williams is working as a mobile application developer at Supersoft2000. The management asks Larry to develop a Jukebox application for mobile device. Larry uses the Data Source class to create and retrieve the sources of multimedia such as, file, and network server. Which of the following methods of the Data Source class enables Larry to transfer data from a network server? 1, The connect() method

Page 18: j2me

28

Pat Greene is working as a software developer at BlueMoon Computers. The management asks Pat to develop a mobile application using MMAPI package. The application should generate the ring tones without creating the Player objects on the mobile device. For this, Pat uses the playTone method () and now, Pat needs to specify the tone to be played by the playTone method (). Which parameter will Pat use to perform the task? 1,Use the note parameter

29

Consider the Statements:

Statement A: The getSupportedContentTypes method is used to return the list of multimedia content types, identifying the type of media data, such as MP3 audio files,supported by a specified protocol.

Statement B: The getSystemTimeBase () method is used to return an object of the TimeBase interface.

Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statement B is False.

30

Anne Johnson is working as a software developer at Safest Software Inc. Anne is developing a messaging application for mobile devices. Anne needs to notify the messaging application about the receipt of the messages. Which interface should Anne implement to perform the task? 1,Message

Page 19: j2me

31

Steve Irvin is working as a J2ME programmer at Red Eye Experts. The organization receives a project for developing a mobile application. Steve is assigned the task to develop a messaging application for mobile devices. To develop the application, Steve needs to define the methods that provide the basic functionality for sending and receiving messages. Which interface should Steve implement to perform the task? 1,TextMessage

32

Pat Wilkins is working as a MIDP developer at Technology systems Inc. Pat is developing a messaging application for mobile devices. However, Pat notices that while sending messages over the network, messaging application is throwing IllegalArgumentException. What could be the possible reason?

1,The connection with the specified mobile device cannot be established.

33

Corrine Wallace is working as a MIDP developer in Super Software Inc. Corrine is developing a messaging application for mobile devices. While developing the application, which class Corrine should use to represent the message and its content in the messaging application? 1,Message

Page 20: j2me

34

Anne Johnson is working as a MIDP developer at Technology Systems Inc. Anne is developing a messaging application for mobile devices. However, Anne notices that while sending messages over the network, the messaging application is throwing InterruptedIOException. What could be the reason of the problem?

1,The receive() method is closed while receiving a message.

35

Jerry Smith is working as a mobile application developer with Safest Software Co. Jerry is assigned the task to study about the new features of a mobile device and the technology associated with it. Therefore, Jerry started his research on MMAPI, which is the latest technology and supports capturing and storing of multimedia content in the mobile devices. Jerry studied that the videos can be seen with special control interfaces, such as VideoControl and VolumeControl using MMAPI technology. Jerry also determines that using this technology, mobile users can also take a picture on the viewfinder and save those picture in a special format. Which of the following format is used for saving these pictures of viewfinder? 1,bmp (bitmap)

Page 21: j2me

36

Christine Turner is working as a mobile application developer with Blue Moon Computers. Christine is working on a project with her team to develop an application to create a player object, which plays the multimedia files specified by a DataSource object. What code snippet should Christine write to perform the required task?

1,Christine needs to replace the code snippet with the following code snippet:

static Player createPlayer(DataSource DS)

37

Jim Lewis is working as a mobile application developer with Certified Carriers. Jim is developing an application for generating tones on a mobile device. For this purpose, Jim uses the playTone() method of the Manager class. Jim uses the following code snippet to generate tones:

playTone(30, 100, 50)

But the above method throws an exception “MediaException”. What is the possible cause of this exception?

1,The mobile device is not able to play the specified tone due to some hardware error.

Page 22: j2me

38

John Barrett is working as a mobile application developer with Quality Software. John is working on a project given by a client of Quality Software. In this project, John needs to create a Player object to play the multimedia files. John uses the Manager class, class to create the Player objects. The network location of the multimedia file is specified using the URI locator string, LOCATION. John writes the following code snippet for the client to perform the desired function:

static Player CreatePlayer(LOCATION)

John notices that the code is not running properly. What should John do to get the desired output?

1,Tom needs to replace the code snippet with the following code snippet:

static Player createPlayer(LOCATION)

Page 23: j2me

39

Tom Wilkins is working as a mobile application developer with Red Sky IT Systems. Tom needs to generate tones on a mobile device. He decides to play the series of tones by calling the playTone() method in a loop. Tom writes the following code snippet to perform the task:

for(int counter=0; counter> 100; counter.++){

int NOTE= (int) (System.currentTimeMillis() % 127);

Manager.playTone(NOTE, 100);

//Move the clock forward

Thread.currentThread().sleep(10);

}

However, Tom notices that code is not running properly. . What should Tom do to solve the problem?

1,Tom needs to replace the code snippet with the following code snippet:

for(int counter=0; counter< 100; counter.++){

int NOTE= (int) (System.currentTimeMillis() % 127);

Manager.playTone(NOTE, 100, 100);

//Move the clock forward

Thread.currentThread().sleep(10);

}

40

Corrine Wallace is working as a mobile application developer with Quality Software Developers. Corrine is assigned a task to create a connection between the client and server using Connector.open () method for the message application. After creating the connection, Corrine wants to send the created message using send() method of the MessageConnection interface. However, when Corrine tries to send the message an exception occur as SecurityException by the send() method. What may be the probable cause of problem?

1,The specified protocol is not allowed to be used for messaging.

Page 24: j2me

41

Donna Brad is working as a mobile application developer with Safest Software Co. She has been assigned the task of developing application for establishing the message connection between two mobile devices. To perform this task, Donna is using the MessageConnection interface, which is used for sending and receiving messages and creating Message objects. Donna is using all the methods of MessageConnection interface in her program to establish a proper connection among messages. However while processing, the application gets blocked at the receiver end until it receives a message. Which method should Donna use to listen the incoming messages through the separate listener object? 1,IncomingMessage()

42

Christine Turner is working as a mobile application developer with Blue Moon Computers. Christine is working on a project to develop a message system for mobile devices. She needs to create and send a message by creating an object of the TextMessage interface of WMA. Christine types the following code snippet for this purpose:

private void sendTextMessage(MessageConnection cn, String

message, String URL)

{

try{

TextMessage tms =

(TextMessage)cn.newMessage

(MessageConnection.TEXT_MESSAGE);1,The If Statement with URL(null) doest not work in sendTextMessage() method.

Page 25: j2me

if (URL!= null)

tms.setAddress(URL);

tms.setPayloadText(message);

cn.send(tmsg);

}

catch(Exception e) {

System.out.println("sendTextMessage " + e);

}

}

However, Christine finds that the program failed to send the message to the destined URL. What may be the cause of the problem?

43

Ronald Billing is working as a mobile application developer with Blue Moon Computers. Ronald is assigned the task of creating a connection with the server to receive incoming messages from the specified port of the mobile device. To perform this task, Ronald needs to specify the address of the destination mobile device, which receives a message, in the Connector.open () method. Which address format should Ronald use with Connector.open() method to perform the above task? 1,sms://PHONENO:PORT

Page 26: j2me

44

John Barrett is working as mobile application developer with Exploration Air. John is assigned a task to create a connection between the client and server using Connector.open () method for the SMS application. After creating the connection, John wants to send the created message using the send() method of the MessageConnection interface. However, when John tries to send the message an exception occur as IOException by the send() method. What may be the probable cause of problem? 1,The network or connection is not available

45

Donna Johnson is working as a mobile application developer at Global System. The organization uses J2ME platform for developing mobile applications. The Company wants to develop a mobile jukebox application, which enables the users to play various types of sound file formats. Donna has been assigned the task of playing a sound file with MP3 extension. Donna uses the following code snippet to perform the task:

Player mp3player;

VolumeControl vcontrol;

try {

mp3player = Manager.createPlayer("http://server/music.wav");

mp3player.realize();

// get volume control for player and set volume to half max value

vcontrol = (VolumeControl) mp3player.getControl("VolumeControl");

if(vcontrol != null) {

vcontrol.setVolume(50);

}

// start the player

1,Donna needs to implement the following code snippet:

Player mp3player;

VolumeControl vcontrol;

try {

mp3player = Manager.createPlayer("http://server/music.mp3 ");

mp3player.realize();

// get volume control for player and set volume to half max value

vcontrol = (VolumeControl) mp3player.getControl("VolumeControl");

if(vcontrol != null) {

vcontrol.setVolume(50);

}

// start the player

mp3player.start();

}

catch(IOException IOex) {

}

Page 27: j2me

mp3player.start();

}

catch(IOException IOex) {

}

catch(MediaException ex) {

}

However, Donna notices that code snippet is not running properly and has many errors in it. What should Donna do to solve the problem?

catch(MediaException ex) {

}

46

John Edwin is working as a mobile application developer at Global System. The organization uses J2ME platform for developing mobile applications. Technology Systems is a client of Global Systems Inc., which manufactures mobile phones.

Technology System has asked Global Systems Inc. to develop a mobile jukebox application, which enables the users to play various types of sound file formats. John has been assigned the task of playing a sound file with the WAV extension. John uses the following code snippet to perform the task:

int id;

// play back from a record store

try {

InputStream istream = getClass().getResourceAsStream("audio.wav");

Player WAVplayer = Manager.createPlayer(is, "audio/ midi ");

WAVplayer.start();

}

catch (IOException ioe) {

}

catch (MediaException me) {

}

However, John notices that code snippet is not running properly and has many errors in it. What should John do to solve the problem?

1,John needs to implement the following code snippet:

int id;

// play back from a record store

try {

InputStream istream = getClass().getResourceAsStream("audio.midi");

Player WAVplayer = Manager.createPlayer(is, "audio/X-wav");

WAVplayer.start();

}

catch (IOException ioe) {

}

catch (MediaException me) {

}

Page 28: j2me

47

Jim Lewis is working as an assistant software developer at Technology Systems. The organization asks Jim to develop a mobile jukebox application, which enables the users to play various types of sound file formats. Jim has been assigned the task of playing a sound file with MIDI extension. Jim uses the following code snippet to perform the task:

int id;

// play back from a record store

try {

InputStream istream= getClass().getResourceAsStream("audio.wav");

Player midiplayer = Manager.createPlayer(is, "audio/midi");

midiplayer.start();

}

catch (IOException ioe) {

}

catch (MediaException me) {

}

However, Jim notices that code snippet is not running properly and has many errors in it. What should Jim do to solve the problem?

1,Jim needs to implement the following code snippet:

int id;

// play back from a record store

try {

InputStream istream = getClass().getResourceAsStream("audio.wav");

Player WAVplayer = Manager.createPlayer(is, "audio/X-wav");

WAVplayer.start();

}

catch (IOException ioe) {

}

catch (MediaException me) {

}

Page 29: j2me

48

Steve Irving is working as a mobile application developer at Blue Moon Computers. The organization uses J2ME platform for developing mobile applications. The business manager of the company asks Steve to develop a media player, which plays different sounds. Steve uses the following code snippet to perform the task:

InputStream is =

new ByteArrayInputStream(

myRecordStore.getRecord(id));

Player player = Manager.createPlayer(

is, "audio/mpeg");

player.stop();

However, Steve notices that code snippet is not running properly and has many errors in it. What should Steve do to solve the problem?

1,Steve needs to implement the following code snippet:

InputStream is =

new ByteArrayInputStream(

myRecordStore.getRecord(id));

Player player = Manager.createPlayer(

is, "audio/mpeg");

player. start();

Page 30: j2me

49

Lee Johnson is working as a mobile application developer at Red Sky Experts. The organization uses J2ME platform for developing mobile applications. Lee is assigned the task of creating a tone player and provides controls to handle the tones of the player. Lee uses the following code snippet to perform the task:

tonePlayer = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR);

tonePlayer.setLoopCount(1); // Loop only once

tonePlayer.stop();

ToneControl tc = (ToneControl)tonePlayer.getControl("javax.microedition.media.control.ToneControl");

However, Lee notices that code snippet is not running properly and has many errors in it. What should Lee do to solve the problem?

1,Lee needs to implement the following code snippet:

tonePlayer = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR);

tonePlayer.setLoopCount(1); // Loop only once

tonePlayer. close();

ToneControl tc = (ToneControl)tonePlayer.getControl("javax.microedition.media.control.ToneControl");

50

Bob Edwin is an application developer at Deez Inc. Bob is developing a gaming application using graphical objects on canvas layer. Now, Bob wants to place the new canvas layer behind all the existing canvas layers in a gaming application. Which method should Bob use to perform the above task? 1,Insert()

Page 31: j2me

51

Donna Johnson is an Application Developer at Global Inc. Donna is developing a gaming application using graphical objects on Canvas layer. While developing application, Donna wants to retrieve the number of layers in the LayerManager class. Which method should Donna use to perform the above task? 1,getLayerAt(int index)

52

John Beret is working as a software developer at Red Eye Experts. John has been assigned the task of developing a Bike Racing game application. John wants to enable users to control the movement of the bike using the right and left arrow keys on the mobile device. Which class should John use to design the gaming application? 1,LayerManager

53

Steve is working as a Wireless Developer at Sky Blue service provider. Steve is assigned a task to develop a gaming application using J2ME. To develop this gaming application, Steve needs to draw a TiledLayer object in TiledLayer class. Which method should Steve use to perform the above task? 1,int createAnimatedTile()

54

Chris is working as a MIDP UI designer at Technology Systems. Chris has been assigned the task to create a mobile gaming application, which displays a background image on the screen of a mobile device. Which class should Chris use to develop the gaming application? 1,GameCanvas class

Page 32: j2me

55

Consider the Statements:

Statement A: The void setImage() method modifies the graphical objects containing the frames of the Sprite object.

Statement B: The void setFrame() method selects the current frame in the frame sequence.

Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statement B is False.

56

Ron Floyd is an application developer at Global Inc. Ron is developing an animated gaming application in J2ME. Therefore, Ron uses a Sprite class that represents graphical objects displayed on the screen of a mobile device. While developing the gaming application, Ron needs to draw a Sprite object to create animation in the gaming application. Which method should Donna call to perform the above task? 1,void setTransform(int transform)

57

Mary Peterson is working as a software developer at SuperSofware 2002 Inc. Mary has been assigned the task of developing a gaming application that displays various rotating graphical objects for the mobile devices. The graphical objects are larger than the screen of the mobile device. Therefore, she decides to set a view window that displays all the sections of the graphical object on the screen of the mobile device. Which class should Mary use to perform the task? 1,Layer

Page 33: j2me

58

Global System Inc. is a software development organization in Washington. The organization asks Donna, a UI designer and programmer to develop a gaming application. Donna needs to rotate graphical objects about a point to create animation effects in the game. Which method of the Sprite class should Donna use to perform the task? 1,Sprite.setTransform()

59

Tom Wilkins is working as a mobile application developer in Technology Systems Inc. Tom has been assigned the task of developing a MIDP gaming application. Tom needs to create flicker-free animation effects in the game. Which class should Tom use to develop the gaming application? 1,Layer

Page 34: j2me

60

Chris Donaldson is working as a mobile application developer at Technology Systems, which develops software for mobile devices. The management asks Chris to develop a two-dimensional game application for mobile phones. Chris wants to create the animation effect in the gaming application on the basis of the user input. Therefore, he wants the application to access the state of left and right arrow keys of the mobile device. In addition, Chris needs to control the movement of graphic objects, such as trees and buildings. Which classes will Chris use to perform the tasks and what method will Chris use to enable the gaming application to access the state of a left and right arrow keys?

1,Use the LayerManager class to create animation effect based on user input and use the Sprite class to represent graphical objects. Use the getKeyStates method to enable an application to access the state of a key.

61

Jim Lewis is working as a software developer at SuperGraphics, which develops software for mobile applications. The management asks Jim to develop a gaming application for mobile phones. For this, Jim decides to use the off-screen buffer to separately draw graphical objects, such as vehicles, buildings and then combine and display these graphical objects on the screen of a mobile device at a time. Jim writes the following code to perform the required task:

public void run() {

Graphics g = getGraphics();

while (play) {

try {

// First draw all the layers

layers.paint(g, 0, 0);

1,Jim uses GameCanvas class. Implement the flushgraphics () method instead of getkeymethods() for the off-screen buffer to work.

Page 35: j2me

// If the game is on, flush the graphics

if (play) {

getKeyStates();

}

try {

mythread.sleep(sleepTime);

} catch (java.lang.InterruptedException e) {}

} catch (Exception e) {

e.printStackTrace();

}

}

}

However, the off-screen buffer does not work. What could be the possible reason and which class of MIDP Game API does Jim use to perform the required task?

62

Larry Williams is working as a software developer at BlueMoon Computers. Larry needs to make a gaming application for mobile devices. Larry uses GameCanvas class to create a game User Interface. The gaming application also requires displaying graphic objects, such as street, trees. For this, Larry uses the Layer class. Larry needs to set the visibility of background layer. Jim also needs to paint a layer on the screen if a layer is visible. What methods will Larry use to perform the tasks?

1,Implement the boolean isVisible method to set the visibility of layer and Void setPosition method to paint a layer

Page 36: j2me

63

Pat Greene is working as a software developer at Technology Systems. Pat is developing a gaming application of a Bike Racing game. Pat uses the LayerManager class to manage the layers, such as background layer. Pat inserts a new layer to include a new vehicle graphic object on the screen at a specific index. However, Pat realizes that a tree object needs to be included in the background layer instead of vehicle object. What methods does Pat use to perform the required tasks?

1,Use the void insert method to insert a new layer and Use the void remove method to remove the object

64

Jim Lewis is working as a wireless developer at Technology Systems. The management asks Jim to create a gaming application for its existing customers. Jim needs to create a background of the screen of the gaming application. For this, Jim decides to use a graphic object in the form of grid of cells to create a scrolling background. Jim loads the graphic object into a tiled layer class using the following code:

bkgrndImage = Image.createImage("bkgnd.png");

int rows = getHeight() / 16;

int cols = getWidth() / 16;

TiledLayer bkgnd =

new TiledLayer(cols, rows, bkgrndImage, 16, 16);

However, Jim is not able to create the background screen. What should Jim do to perform the required task?

1,Use the following code:

Image bkgrndImage = Image.createImage("bkgnd.png");

int rows = getHeight() / 16;

int cols = getWidth() / 16;

TiledLayer bkgnd =

new TiledLayer(cols, rows, bkgrndImage, 16, 16);

Page 37: j2me

65

Donna Johnson is working as a mobile application developer at Global System. The organization uses J2ME platform for developing gaming applications. The management asks Donna to develop a Bike racing game application with animation effects. Donna creates graphic objects, such as trees, vehicles to be displayed on the screen of the gaming application. Donna uses the Sprites class to represent the graphic objects on the screen of the mobile device and divides the images in frames of equal height and width to create the animation effect. Now, she needs to retrieve the number of frames in the graphic objects to manage the sequence of frames. In addition, Donna needs to define a section of area where the collision of graphic objects can be detected to improve the animation effects. What should Donna do to perform the required tasks?

1,Write the following code to retrieve the number of frames:

public int getRawFrameCount()

and use the Void defineCollisionRectangle(int x, int y, int width, int height) method.

66

Pat Wilkins is working as a software developer at Technology Systems Inc. The organization receives a project of developing a J2ME application for mobile devices. Pat is assigned the task of creating a gaming application for a mobile device. Pat needs to provide flicker-free display on the screen of the mobile device. Therefore, Pat decides to implement the off-screen buffer. Pat writes the following code snippet to implement the off-screen buffer:

public void run() {

Graphics g = getGraphics();

while (play) {

try {

1,Pat needs to replace the code snippet with the following code snippet:

public void run() {

Graphics g = getGraphics();

while (play) {

try {

layers.paint(g, 0, 0);

if (play) {

flushGraphics();

Page 38: j2me

layers.paint(g, 0, 0);

try {

mythread.sleep(sleepTime);

} catch (java.lang.InterruptedException e) {}

} catch (Exception e) {

e.printStackTrace();

}

}

}

However, Pat notices that the code is not running properly and has many errors in it. What should Pat do to solve the problem?

}

try {

mythread.sleep(sleepTime);

} catch (java.lang.InterruptedException e) {}

} catch (Exception e) {

e.printStackTrace();

}

}

}

67

Jim Lewis is working as a software developer at Technology Systems. The management asks Jim to create a car racing game application. For this, Jim uses GameCanvas class to create animation effects based on the user input. Jim needs to ensure that the animations created on the screen are flicker-free. For this Jim creates an offscreen buffer using the following code:

public void run() {

Graphics g = flushgraphics();

while (play) {

try {

// First draw all the layers

layers.paint(g, 0, 0);

// If the game is on, flush the graphics1,Use the getGraphics method() instead of flushgraphics() method and use the Void setPosition(int x, int y) method

Page 39: j2me

if (play) {

flushGraphics();

}

try {

mythread.sleep(sleepTime);

} catch (java.lang.InterruptedException e) {}

} catch (Exception e) {

e.printStackTrace();

}

}

}

In addition, Jim needs to place a new layer of graphic objects behind the existing layers in a gaming application to create animation effect. For this, Jim needs to determine a position of layer. Which methods will Jim use to perform the required tasks?

Page 40: j2me

68

Christine Turner works as a software programmer with SmartLabs. Christine has been assigned the task to create a MIDlet gaming application for a mobile device. Christine needs to display a graphical object as the background of the screen of the mobile device. She needs to create large scrolling backgrounds in games. To perform the required task, Christine creates the following code snippet:

Image bkgrndImage = Image.createImage("/bkgnd.png");

int rows = getHeight() / 16;

int cols = getWidth() / 16;

LayerManager bkgnd =

new LayerManager (cols, rows, bkgrndImage, 16, 16);

display

Christine executes the code. However, some error is displayed. what should Christine do to resolve the problem?

1,Christine needs to replace the existing code with the following code:

Image bkgrndImage = Image.createImage("/bkgnd.png");

int rows = getHeight() / 16;

int cols = getWidth() / 16;

Layer bkgnd = new Layer(cols, rows, bkgrndImage, 16, 16);

69

John Beret works as a software programmer at Technology Systems. John has been assigned the task to create a MIDlet gaming application for a mobile device. John needs to display an animation that displays several frames in his game. He decides to use Sprite class for creating animation. John creates the following constructor for the Sprite class:

public Sprite(Image[] img, int xPos, int yPos, int xVel, int yVel, int z, int wBnds, int hBnds, int ba)

{

image = img;

setPosition(xPos,yPos);

width = img[f].getWidth();

1,John needs to replace the existing code with the following code:

public Sprite(Image img, int f, int fi, int fd, int xPos, int yPos, int xVel, int yVel, int z, int wBnds, int hBnds, int ba)

{

image = img;

setPosition(xPos,yPos);

width = img[f].getWidth();

height = img[f].getHeight();

setVelocity(xVel,yVel);

frame f;

Page 41: j2me

height = img[f].getHeight();

setVelocity(xVel,yVel);

frame f;

frameInc=fi;

frameDelay = frameTrigger = fd;

zOrder = z;

xBounds = 0;

yBounds = 0;

wBounds = wBnds;

hBounds= hBnds;

boundsAction=ba;

}

John executes the code. However, some error is displayed. What should John do to resolve the problem?

frameInc=fi;

frameDelay = frameTrigger = fd;

zOrder = z;

xBounds = 0;

yBounds = 0;

wBounds = wBnds;

hBounds= hBnds;

boundsAction=ba;

}

70

Diane Frye is a mobile application developer at SmartLabs and is developing MIDlet applications. Diane has implemented off-screen buffer in the MIdlet to provide a flicker free display on the screen of the mobile device. Therefore, to display the animation effect on the screen of the mobile device, Diane needs to access the off-screen buffer. Diane writes the following code snippet to perform the task:

public void run() {

Graphics g = flushGraphics();

while (play) {

try {

layers.paint(g, 0, 0);

if (play) {

getGraphics();

}

1,Diane needs to replace the code snippet with the following code snippet:

public void run() {

Graphics g = getGraphics();

while (play) {

try {

paint(g, 0, 0);

if (play) {

flushGraphics();

}

try {

mythread.sleep();

} catch (java.lang.InterruptedException e) {}

Page 42: j2me

try {

mythread.sleep();

} catch (java.lang.InterruptedException e) {}

} catch (Exception e) {

e.printStackTrace();

}

}

However, Diane notices that code is not running properly and has many errors in it. What should Diane do to perform the task?

} catch (Exception e) {

e.printStackTrace();

}

}

71

Jim Lewis is working as an assistant software developer at Technology Systems. The organization receives a project of developing a J2ME application for the mobile devices. Jim is assigned the task of developing the gaming applications for the mobile device. In the gaming application, Jim needs to display the graphic objects in the background of the screen of a mobile device. Jim writes the following code snippet to perform the task:

Image bkgrndImage = Image.createImage("/bkgnd.png");

int rows = getHeight() / 16;

int cols = getWidth() / 16;

LayerManager bkgnd =

new LayerManager(cols, rows, bkgrndImage, 16, 16);

However, Jim notices that code snippet is not producing required results. What should Jim do to solve the problem?

1,Jim needs to implement the Layer class instead of the LayerManager class.

Page 43: j2me

72

Donna Davidson is working as a software developer at Super Software Inc. Red Eye Experts has assigned the organization a project of developing a MIDP application. The organization assigns Donna the task of creating a gaming application for the MIDlet. While creating the gaming application, Donna needs to perform the following tasks:

Keep track of all the graphic objects that are added or removed from the gaming application

Create a graphic object that is larger than the size of the screen of a mobile device.

View the specific sections of a graphic object on the screen of a mobile device, if the graphic object is larger than the size of the screen

Place a new graphic object behind all the existing graphic objects in the gaming application.

What should Donna do to perform the tasks? 1,Donna should implement the Layer class.

Page 44: j2me

73

Ed Young is working as a software developer at Super Software Inc. Ed is developing a gaming application for the mobile devices. Ed needs to create the animation effect in the gaming application on the basis of user input. To control the animation effects in a game, the gaming application needs to have instant access to the current state of a key of a mobile device. Ed writes the following code snippet to enable the gaming application to access the state of a key:

int keyState = getKeyState();

if ((keyState | LEFT_PRESSED) != 0) {

System.out.println("You have pressed Left Key");

}

if ((keyState | RIGHT_PRESSED) != 0) {

System.out.println("You have pressed Right Key");

}

Ed notices that code is not running properly and has many errors in it. What should Ed do to solve the problem?

1,Ed needs to replace the code snippet with the following code snippet:

int keyState = getKeyStates();

if ((keyState && LEFT_PRESSED) != 0) {

System.out.println("You have pressed Left Key");

}

if ((keyState && RIGHT_PRESSED) != 0) {

System.out.println("You have pressed Right Key");

}

Page 45: j2me

74

Corrine Wallace is working as a software developer at Super Software Inc. Corrine is developing a gaming application for the mobile devices. Corrine needs to create animation effect in the gaming application. To create the animation effect, Corrine needs to perform the following tasks:

Retrieve the number of frames in a graphic object to manage the sequence of the frames.

Display a sequence of frames containing different parts of a graphic object on the screen of the mobile device.

Verify whether a frame has collided with a TiledLayer object.

Flip and rotate the parts of the graphics object.

What should Corrine do to perform the task? 1,Corrine needs to implement the Layer class

75

Bob Edwin is an application developer at Deez Inc. Bob has developed a MIDlet application for the mobile devices. When the MIDlet application is downloaded on a mobile device, the mobile device sends a report of unsuccessful installation of MIDlet with status code of 901.What could be the cause of the problem? 1,Loss of service

Page 46: j2me

76

Donna Johnson is an application developer at Global Inc. Donna has developed a MIDlet application. When the MIDlet application is downloaded on a mobile device, the mobile device sends a report of unsuccessful installation of MIDlet with status code of 905.What may be the cause of the problem? 1,Loss of service

77

Mary Peterson is working as a UI designer and programmer at SuperSoftware 2002 Inc. Mary has been assigned the task of developing a J2ME application for mobile devices. Mary wants that the application inform users about a specific event, such as birthdays at a particular time and date. Which method should Mary implement to develop the application? 1,registerAlarm()

78

John David is an application developer at Safest Software. John has developed a MIDlet application. When the MIDlet application is downloaded on a mobile device, the mobile device sends a report of unsuccessful installation of MIDlet with status code of 904.What may be the cause of the problem? 1,Represents an invalid JAD file

79

Pat Wilkins is an application developer at Global Inc. Pat has developed a MIDlet application. When the MIDlet application is downloaded on a mobile device, the mobile device sends a report of unsuccessful installation of MIDlet with status code of 907.What could be the cause of the problem? 1,Represents an invalid JAD file

Page 47: j2me

80

Donna Johnson is working as an application developer at with Safest Software. The company organization has launched a new mobile device. Therefore, the business manager of the company organization asks Donna to developed a J2ME application for the newly launched mobile device. The business manager also wants that the application should provide some services and content that can be downloaded over different types of wireless network, such as GSM and CDMA. Which feature of J2ME is used to develop such an application? 1,Enhanced User Interface

81

Jim is a mobile application developer, working with Red-Eye Experts Inc. Jim needs to develop a mobile application for J2ME enabled mobile device. In the application Jim needs to provide facility so that the users can download applications and run them on the mobile device, without using a browser to access an application. Which of the following wireless technologies should Jim use in the application to perform the above-mentioned task? 1,GPRS

Page 48: j2me

82

Diane Frye, the mobile application developer with Blue Moon Computers, is developing a mobile application for J2ME enabled mobile device. Jim needs to develop the application in such a way, that it provides enhance User Interface (UI) and graphical capabilities in the mobile devices. Which of the following package should Jim use while developing the application? 1,javax.microedition.lcdui

83

Donna Bard is a mobile application developer, working with Red-Eye Experts inc. Donna needs to develop a mobile application for J2ME enabled mobile device that enables mobile users to download video and music clips and access the Internet. Which of the following wireless technologies should Donna Bard use to perform the task? 1,GPRS

84

Consider the Statements:

Statement A: An applet is a Java class file embedded into an HTML page.

Statement B: A MIDlet is a Java class file packaged into a JAR file.

Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statement B is False.

Page 49: j2me

85

Steve Irving is working as a programmer in the application development department of Red Sky IT Systems. The job profile requires Steve to develop mobile applications by using J2ME platform. Steve Steve has been assigned the task to develop a MIDlet application by using J2MEj2me platform, to provide Web services to the users.. Steve wants to deploy the MIDlet application on a Web server to enable the users to download the application on a mobile device. However, before deploying the application Steve needs to test the application for a mobile device. To test the application Steve wants to simulate the behavior of a mobile device on his computer. Which tool should Steve use to perform the required task and what should Steve do acquire the tool?

1,Use the RAD tool and install JDK-j2sdk.5_06 on his the computer

Page 50: j2me

86

Ron Floyd is an application developer at with Global Inc. The organization develops mobile applications by using J2ME platform. The organization has developed a mobile application, which can send and receive animated images and access the data from the remote server. The mobile application also has a facility to deliver textual and visual information, such as sports scores, news headlines, and weather information on the mobile device. Now, organization Global Inc. decides to upgrade the mobile application to support broader bandwidth and faster data transfer in mobile devices. Ron is has been assigned the task of upgrading the mobile application. The organization asks Ron to provide features, which enables the mobile users to download video and music clips and access high-speed Internet in on the mobile device. Which technology should Ron use to develop the mobile application with all specified features? 1,General Packet Radio Service (GPRS)

Page 51: j2me

87

Technology Systems Inc., a New York based company organization, provides wireless services to its customers. Jim Lewis is working as a mobile application developer in with Technology Systems Inc. Jim develops a MIDlet application and needs to test the MIDlet to ensure whether the application is running properly. To test the MIDlet application, Jim decides to install J2ME Wireless Toolkit on a computer. However, when Jim tries to install the Wireless Toolkit on the computer, he is not able to install it. He ensures that the J2SE 1.5.0 SDK is already installed on the computer. Jim informs John, the system administrator, about the problem and asks him to resolve the problem. What should John do to resolve the problem? 1,Update the PATH environment variable.

88

Jim Lewis is working as a software developer at with Blue Moon Computers. The organization receives a project of developing a mobile application by using J2ME API. The management of the organization assigns the task of developing the mobile application to Jim. . To develop the mobile application, Jim needs to implement the MIDlet class. To implement the MIDlet class, Jim needs to identify the structure of the MIDlet class. Following is the structure of the MIDLet class identified by Jim to perform the task:

public class MyMIDlet extends MIDlet {

MIDlet( ) {

}

protected void startApp( ) throws MIDletStateChangedException {

}

1,Jim needs to implement the MIDlet class using the following structure:

public class MyMIDlet extends MIDlet {

MIDlet( ) {

}

protected void startApp(boolean unconditional ) throws MIDletStateChangedException {

}

protected void pauseApp( ) {

}

Page 52: j2me

protected void destroyApp(boolean unconditional)

throws MIDletStateChangedException {

}

}

However, Jim notices that the application, which is developed by using this structure of the MIDlet class is not working properly and has many errors . What should Jim do to solve the problem?

protected void destroyApp(boolean unconditional)

throws MIDletStateChangedException {

}

}

89

Pat Wilkins is working as a software developer at with Technology Systems Inc. Pat develops a mobile application by using J2ME platform. The application enables mobile users to download wireless application on mobile devices and view information such as, news headlines and weather reports. However, the management of the organization notices that the bandwidth and quality of voice and text transmission provided by the mobile application is low. Therefore, organization asks Pat to upgrade the mobile application. The organization also asks Pat to provide advanced multimedia services, such as animated games in the mobile application. Which technology should Pat use to perform the task? 1,General Packet Radio Service (GPRS)

Page 53: j2me

90

Global Systems Inc. is a software development company organization in Texas. The management of the organization decides to develop MIDP applications based on the J2ME platform. However, management identifies that J2ME architecture is designed for small devices, having limited memory, such as mobile phones. What is the maximum memory of the devices for which J2ME architecture is designed? 1,1 MB

91

Pat Wilkins is working as J2ME programmer at with Red Eye Experts. The organization asks Pat to develop a mobile application. However, Pat identifies that to implement the mobile application on the mobile device, the device should be CLDC compatible. What should be the minimum volatile memory for the virtual machine for a CLDC compliant mobile device? 1,32 KB

92

Pat Wilkins is working as a MIDP developer at with Technology systems Inc. Pat has been assigned the task to develop a MIDlet application. To run the MIDlet application, Pat needs to use resources, such as images or data files stored in the JAR file. Therefore, he needs to gather information about the contents of the JAR file. Which component of the MIDlet suite should Pat should use to perform the task? 1,Java Class Files

Page 54: j2me

93

Corrine Wallace is working as MIDP developer in with Super Software Inc. Corrine is developing a MIDlet application for mobile devices. To run the MIDlet application, Corrine needs to gather information about the contents of the JAR file by using the manifest file. Corrine needs to specify the name of the PNG file within the JAR file, which is used to represent the MIDlet suite. Which MIDlet attributes of the manifest file should Corrine use to perform the task? 1,MIDlet-Name

94

Anne Johnson is working as a software developer with Red Eye Experts. Anne is developing a MIDlet application for the mobile devices. Anne needs to use resources such as image and data files stored in the JAR file to run the MIDlet application. However, Anne identifies that the application manager is not able to load the JAR file. What could be the reason of the problem?

1,The MIDlet-<n> attributes is not specified in the manifest file.

95

Chris is working as a MIDP UI designer at with Technology Systems Inc. The organization asks Chris to create a registration form, which consists of text boxes and radio buttons, to enable mobile users to fill their details on a mobile device. Chris needs to create a graphical object to display the list of radio buttons from which the user can select an item. Which Item class should Chris use to implement the list of radio buttons? 1,CustomItem

Page 55: j2me

96

John Beret is working as a software developer at with Red Eye Experts. John is developing a J2ME application for mobile devices. The application enables mobile users to enter new phone numbers in the memory of a mobile device. Which Item class should John use to develop the application? 1,ImageItem

97

Mary Peterson is working as a UI designer and programmer at SuperSoftware 2002 Inc. Mary has been assigned the task of creating a J2ME application for mobile devices. The application should enable mobile users to compose a message on the mobile device. Mary also wants that users should be able to edit the text of a message by using the keypad. Which class should Mary use to develop the application? 1,Item class

98

Global System Inc. is a software development organization in Washington. The organization launches a new mobile device. The organization asks Donna, a UI designer and programmer, to design an application to enable users to set wallpapers on the screen of their mobile devices. Which class should Donna use to develop the application? 1,ImageItem

Page 56: j2me

99

Ronald Billing is working as a software developer at with InfoSuper Inc. Ronald is developing a J2ME application for mobile devices. Ronald needs to develop an application that represents volume level or network availability in mobile phones, in the form of a bar graph. Which class should Ronald use to design the application? 1,ChoiceGroup

100

Jim Lewis is working as a software developer at with Global Systems, Inc., which develops software for mobile devices. Jim is developing an application for mobile wireless devices. Jim needs to ensure that networking capabilities, such as socket, serial, datagram, and http protocol are provided in the mobile devices. In addition, Jim also needs to ensure that the application supports device-specific requirements of the mobile device. What should Jim do to perform the required tasks? 1,Use the WMA package.

Page 57: j2me

101

Chris Donaldson is working as a programmer in the application development department of Global Systems Inc. Chris develops a PDA application for mobile wireless devices. Chris also ensures that the PDA application supports floating-point operations and all features of CLDC library. However, the mobile device with 160 KB of non-volatile memory, 32 KB of volatile memory, and a 16- bit processor does not support the PDA application. What is the reason and what should Chris do to run the application on a mobile device?

1,The minimum non-volatile memory for the device should be 192 KB to support the application.

Page 58: j2me

102

Corrine Wallace is working as a software developer at with Technology Systems Inc. The organization asks Corrine to develop a J2ME application for mobile devices. Corrine needs to display a list of elements on the screen of the mobile device. To perform the task, Corrine writes following code snippet:

List list1=null;

list1 = new List("Message1",List.Implicit);

list1.append("Reply",null);

list1.append("Forward",null);

list1.append("Delete",null);

Display.getDisplay(listMidlet.instance).setCurrent();

When Corrine executes this code snippet, he encounters various errors in it. What should Corrine to do solve the problem?

1,Corrine needs to replace this code snippet with the following code snippet:

List list1=null;

list1 = new List("List Demo",List.IMPLICIT);

list1.append("Reply",null);

list1.append(“Forward",null);

list1.append("Delete",null);

Display.getDisplay(ListMidlet.instance).setCurrent(list1);

Page 59: j2me

103

Anne Johnson is working as a software developer at with Red Eye Experts. Anne is developing a MIDP application. Anne needs to display hyperlink text on the form displayed on the screen of the mobile device. The label of the hyperlink text should be My Pictures and tText. Pic1 should be displayed as a hyperlink. , which is to be displayed as a hyperlink is Pic1. Anne writes following code snippet to perform the task:

StringItem strItem = new StringItem(‘My Picture’, ‘Pic1’, ‘Item.HYPERLINK’);

When Anne executes the MIDP application with this code snippet, she encounters errors in it. What should Anne do to solve the problem?

1,Anne needs to replace this code snippet with the following code snippet:

StringItem strItem = new StringItem(‘Pic1’, ‘My Picture’, Item.HYPERLINK);

Page 60: j2me

104

Mary Peterson is working as a software developer at with SuperSoftware 2002 Inc. Mary is creating a J2ME application for mobile devices. To provide information about different features of the mobile devices, Mary needs to display read only text on the screen of the mobile devices. Mary writes the following code snippet to perform the task:

Form form1 = new Form("Functionality of Inbox");

List str = new List("","Enables you to store messages");

form1.append(str);

display.getDisplay(StringMidlet.instance)setCurrent(form1);

However, Mary encounters various errors while running this code. What could be the reason for the problem?

1,Mary implements the List class instead of the Text class in the code snippet.

105

Global System Inc. is a software development organization in Washington. The organization receives a project of developing a mobile application in J2ME. The organization asks Donna, a MIDP developer to create UI for the mobile application. In order to provide user interaction, Donna needs to handle events, which are generated in response to the user interaction with the UI. In addition, Donna needs to set the event listener and provide the code to be executed on receiving an event. What should Donna do to perform the task?

1,Donna needs to implement the Command class and define the commandAction() method. In addition, Donna needs to implement the CommandListener interface.

Page 61: j2me

106

Ronald Billing is working as a software developer at with InfoSuper Inc. Ronald is developing a J2ME application for mobile devices. Ronald needs to add an editable text component on the form displayed on the screen of the mobile device to allow users to enter and save phone numbers in the mobile device. In addition, Ronald needs to restrict the users from entering characters in the text component. Ronald needs to set the size of the text component as 25. Ronald writes the following code snippet to perform the task:

TextField Pn = new TextField("PhoneNumber",25,TextField.ANY);

this.append(Pn);

After creating the mobile application with this code, Ronald notices that application is not running properly and not providing required output. What should Ronald do to solve the problem?

1,Ronald needs to replace the code snippet with the following code snippet:

TextField Pn = new TextField("PhoneNumber","",25,TextField.ANY);

this.append();

Page 62: j2me

107

Larry Williams is working as a software developer at with Technology Systems. The job profile requires Larry to develop mobile applications by using the J2ME platform. The management asks Larry to develop a gaming application for mobile devices. The gaming application will contain several graphical objects, such as vehicles and road. Larry creates a template for drawing graphical objects on the display screen of the mobile device. Which of the following methods should Larry use to draw the graphical objects? 1,paint() method of the canvas class.

108

Christine Turner is working in the application development department of SuperGraphics. The management asks Christine to develop a gaming application for a mobile device. The management also asks Christine to ensure that the images of the application to be displayed on the screen are flicker-free. Christine decides to use the double buffering technique to enhance the quality of the display of mobile devices. For this, Christine needs to create a copy of the original image. Which of the following methods will Christine use to perform the required task? 1,paint() method.

Page 63: j2me

109

Jim Lewis is working as a mobile application developer at with BlueMoon Computers. Jim needs to draw a two-dimensional geometric figure for the display screen of a mobile device. Jim creates the template for drawing the figure on the display screen of a mobile device. Now, Jim needs to use the methods provided by MIDP low level UI APIs for drawing the geometric figure on the template. Which of the following methods should Jim use to perform the required task?

1,The drawImage (Image img, int x, int y, int anchor) method.

110

Chris Donaldson is working as a software developer with Technology Systems. Chris needs to develop a gaming application for mobile devices. For this, Chris needs to draw graphical objects on the display screen of the mobile devices. Which class of MIDP low-level UI APIs should Chris use to perform the required task? 1,Canvas class

Page 64: j2me

111

Ken Burton is working as an application developer with InfoSuper Corp. The management asks Ken to develop a gaming application for mobile devices. The management also asks Ken to ensure that the display of the application is flicker-free. For this, Ken creates a copy of the original images to be displayed on the screen. Now, Ken needs to obtain the copy of the images for the offscreen buffer to draw the images on the offscreen buffer. What should Ken do to perform the required task?

1,Use the following code:

public void paint (Graphics g)

{

g.drawImage ( buffer, 0, 0, 0);

}

112

John Irvin is working as a software developer in with Technology Systems Inc. The organization assigns John the task of developing a mobile application. John needs to create the UI of the application to ensure that users can interact with the mobile device. While creating UI for a mobile application, John needs to draw graphical objects on the display screen of the mobile device. Identify the code snippet John needs to implement to perform the task?

1,Class MyClass extends Canvas

{

void paint(Graphics obj) {

}

}

Page 65: j2me

113

Nancy Jones is working as a software developer at with Smart Software Developers. Nancy is developing a MIDP application for a mobile device. The organization asks Nancy to create visual effects on the screen of the mobile device. For this, Nancy needs to perform the following tasks:

Draw two-dimensional geometric figures, such as rectangle and circle, on the display screen of a mobile device.

Fill the geometric figures with colors.

Draw the specified characters by using the current font and color.

Draw more than one character simultaneously.

What should Nancy do to perform the task? 1,Nancy needs to implement the Font class.

114

Ken Burton is working as a software developer at with Safest Software Inc. Ken is developing a MIDP application. To create UI of the mobile application, Ken decides to develop visual effects on the screen of the mobile device. To develop visual effects, Ken needs to draw the specified characters by using the current font and color. He also needs to draw more than one character simultaneously. In addition, Ken wants to draw a rectangle on the screen of the mobile device by intersecting a set of pixels, which are painted by the Graphical objects. Which methods should Ken implement to perform the task?

1,drawChar (char character, int x, int y, int anchor) and drawRect (int x, int y, int width, int height)

Page 66: j2me

115

Mike Womack is working as a software developer at with Red Eye Experts. Mike is developing a J2ME application for the mobile devices. Mike makes some changes in an object of the Canvas class and needs to reflect the changes on the screen of the mobile device. To perform the task, Mike should refresh the screen of the mobile device. For this, Mike needs to invoke the paint() method to draw the graphical objects on the specified drawing region. Mike also needs to synchronize the paint() method and method that is used to refresh the screen of the mobile device. Which of the following methods Mike needs to implement to perform the task?

1,repaint (0, 0, getWidth (), getHeight ()) and serviceRepaints()

116

Pat Wilkins is working as a software developer at with Super Graphics Inc. Pat is developing a J2ME application for the mobile devices. The organization asks pat to avoid flickering of screen of the mobile device to improve the quality of display. For this, Pat decides to draw graphical objects on an off-screen buffer of a mobile device before drawing the graphical objects on the original display screen. Pat needs to copy the contents of the off-screen buffer to the display screen to display the graphical objects on the screen of the mobile device. What task should Pat perform to copy the contents of the off-screen buffer to the display screen?

1,Override the paint () method to copy the off-screen buffer on the screen of a mobile device by writing the following code snippet:

public void paint (Graphics g) {

g.createImage ( buffer, 0, 0, 0);

}

Page 67: j2me

117

Chris is working as a UI designer at withTechnology Systems. Chris is creating a mobile application, which displays a page that contains text. and The users need to press EXIT to exit the application. To perform the task, Chris writes the following code snippet:

class TextCanvas extends Canvas implements CommandListener

{

private Command cmExit;

private CanvasBasics midlet;

private String txt = "Center this text";

public TextCanvas(CanvasBasics midlet)

{

this.midlet = midlet;

// Create commands & listen for events

cmExit = new Command("Exit", Command.OK, 1);

addCommand(cmExit);

setCommandListener(this);

}

But when Chris presses the Exit button, the application is not closed. What should Chris do to solve the problem?

1,Chris needs to replace this code snippet with the following code snippet:

class TextCanvas extends Canvas implements CommandListener

{

private Command cmExit;

private CanvasBasics midlet;

private String txt = "Center this text";

public TextCanvas(CanvasBasics midlet)

{

this.midlet = midlet;

// Create commands & listen for events

cmExit = new Command("Exit", Command.CANCEL, 1);

addCommand(cmExit);

setCommandListener(this);

}

Page 68: j2me

118

John Beret is working as a software developer at with Red Eye Experts. John is developing a J2ME application on a mobile device. The management asks John to create a user interface of a mail application that enables the users to send messages. For this, John needs to implement the compose message confirmation page in which the user has to press the OK button to continue in the application. He writes the following code snippet for the application:

class TestCanvas extends Canvas implements CommandListener

{

private Command cmExit; // Exit midlet

Exitcm= new Command("OK", Command.EXIT, 1);

addCommand(Exitcm);

setCommandListener(this);

}

When John executes the MIDP application with this code snippet, he encounters errors in it. What should John do to solve the problem?

1,John needs to replace this code snippet with the following code snippet:

class TestCanvas extends Canvas implements CommandListener

{

private Command cmExit; // Exit midlet

Exitcm= new Command("OK", Command.OK, 1);

addCommand(Exitcm);

setCommandListener(this);

}

Page 69: j2me

119

Mary Peterson is working as a software developer with SuperSoftware 2002 Inc. Mary has been assigned the task of creating a J2ME application for mobile devices. Mary is creating a screensaver that displays various rotating graphical objects. Mary writes the following code to display a rectangle:

protected void paint(Graphics g)

{

g.drawRect(1, 1, 25, 25, 25);

g.drawRoundRect(28, 28, 45, 45, 15, 45);

// g.fillRect(1, 1, 25, 25);

// g.fillRoundRect(28, 28, 45, 45, 15, 45);

}

However, Mary encounters various errors while running this code. What should Mary do to resolve the problem?

1,Mary needs to replace this code snippet with the following code snippet:

protected void paint(Graphics g)

{

g.drawArc(1, 1, 25, 25, 25);

g.drawRoundRect(28, 28, 45, 45, 15, 45);

// g.fillRect(1, 1, 25, 25);

// g.fillRoundRect(28, 28, 45, 45, 15, 45);

}

120

Global System Inc. is a software development organization in Washington. The organization asks Donna, a UI designer and programmer to create a screensaver by using the low level UI API classes and interfaces. The screensaver displays the user specified text in various fonts. She has created the following code to display the text, in bold and italics:

protected void paint(Graphics g)

{

int xcenter = getWidth() / 2,

ycenter = getHeight() / 2;

g.setFont(Font.getFont(Font.FACE_MONOSPACE,

1,Donna needs to replace this code snippet with the following code snippet:

protected void paint(Graphics g)

{

int xcenter = getWidth() / 2,

ycenter = getHeight() / 2;

g.setFont(Font.getFont(Font.FACE_SYSTEM,

Font.STYLE_BOLD|Font.STYLE_ITALIC, Font.SIZE_MEDIUM));

Page 70: j2me

Font.STYLE_BOLD|Font.STYLE_PLAIN, Font.SIZE_MEDIUM));

g.drawRect(xcenter, ycenter, xcenter, ycenter);

// x and y are always at the center of the display

g.drawString("This is a screensaver!",

xcenter, ycenter, midlet.getAnchorPoint());

}

When Donna executes this code snippet, she encounters various errors in it. What should Donna to do solve the problem?

g.drawLine(xcenter, ycenter, xcenter, ycenter);

// x and y are always at the center of the display

g.drawString("This is a screensaver!",

xcenter, ycenter, midlet.getAnchorPoint());

}

Page 71: j2me

121

Tom Wilkins is working as a mobile application developer at with Technology Systems Inc. Tom has been assigned the task of developing a MIDP application. Tom needs to draw graphical objects on the screen of the mobile device. To avoid the flickering of the screen and to improve the quality of the display, Tom wants to create a copy of the screen in the memory of the mobile device. For this, Tom needs to create a mutable image with the size of the screen. To perform the task, Tom writes following code snippet:

int width = getWidth ();

int height = getHeight ();

Image buffer = Image.drawImage (width, height);

When Tom executes this code snippet, he encounters various errors in it. What should Tom to do solve the problem?

1,Tom needs to replace this code snippet with the following code snippet:

int width = getWidth ();

int height = getHeight ();

Image buffer = Image.createImage (width, height);

Page 72: j2me

122

Tom Wilkins is working as a mobile application developer with InfoSuper Corp. Tom develops an application by using the J2ME platform. The application enables the employee working at the client sites to access the detail about the organization’s products stored in a RMS database of their organization, through their cell phones. Pat, an employee working at the client site need to delete a record in the database. Which method of the javax.microedition.rms.RecordStore class should Pat use to perform the required task? 1,deleteRecord(int recordId) method

123

Chris Donaldson is working in the application development department of SuperGraphics. Chris develops a PDA application, which serves the purpose of an address book. However, when Chris tries to access a record from the application, InvalidRecordIDException is thrown. What could be the possible reason for the error? 1,Attempt is made to access a deleted record.

124

Donna Bard is working as application developer at with Global Systems Inc. Chris develops a PDA application, which serves the purpose of an address book. However, when Chris tries to add a record in the PDA application, an exception, RecordStoreFullException, is thrown. What could be the possible reason for the error? 1,A record store is not opened.

Page 73: j2me

125

Donna Bard is working as a mobile application developer at with BlueMoon Computers. Donna is developing an application for a phone appointment diary. Donna develops an interface that will enable the users to navigate through the records. In addition, Donna needs to display the records in the recordstore. What should Donna do to perform the required task?

1,Implement Record Listener and use the int nextRecordID() method.

126

Jim Lewis is working as an application developer at with Technology Systems. Jim develops an application to enable the employee working at the client sites to access the details about organization’s products. These details , which are stored in an RMS database through their mobile devices. Pat, an employee working at the client site needs to add a record in the recordstore. However, a RecordStoreFullException exception is raised. What could be the possible reason of the error? 1,A record store is not opened.

Page 74: j2me

127

Pat Wilkins is working as a software developer at with Blue Moon Computers. Pat is developing a MIDP application. Pat implements RMS for storing J2ME objects so that the objects can be used even after the application is closed. Pat needs to add a new record to the RMS. To perform the task, Pat implements the addrecord() method. However, while executing the method, Pat encounters the RecordStoreException. What could be the possible reason?

1,The record cannot be added to a record store due to security limitations.

128

Christine Turner is working as a mobile application developer at with SuperGraphics. Christine develops a MIDlet application for mobile devices. However, Christine observes that the application does not run on a mobile device with a display depth of 1-bit. The device has a non-volatile memory of 160 KB and volatile memory of 32 KB. The mobile device also supports two-way wireless connectivity of limited bandwidth and the user input mechanism in the device supports one-handed keyboard. What could be the reason and what does Christine do to solve the problem?

1,A MIDlet compliant device should have a maximum volatile memory of 128 KB.

Page 75: j2me

129

Donna Bard is working as a software developer at with InfoSuper Corp., which provides wireless services to its customers. The management asks Donna to develop MIDlet applications for a mobile wireless device to allow users to use the e-mail facility and other Web services. For this, Donna writes the following code to be included in the manifest file of the MIDlet suite:

MIDlet-Name: HelloWorld

MIDlet-Vend fileor: AB Corp

MIDlet-1: HelloWorld, HelloWorld.png, HelloWorld

MicroEdition-Profile: MIDP-2.0

However, the device does not load the JAR file, which contains the MIDlet suite, installed on a mobile device. What modifications should Donna perform in the code, such that the device loads the JAR file?

1,Replace the code with the following code:

MIDlet-Name: HelloWorld

MIDlet-Vend fileor: AB Corp

MIDlet-1: HelloWorld, HelloWorld.png, HelloWorld

MicroEdition-Configuration: CLDC-1.0

MicroEdition-Profile: MIDP-2.0

Page 76: j2me

130

Chris Donaldson is working as a programmer in the application development department with SuperGraphics. SuperGraphics, which develops software for mobile devices. Chris develops mobile applications by using J2ME platform. The management asks Chris to develop a PDA application, which allows users to perform floating-point operations. Chris also needs to ensure that the application resolves all error-handling requirements and runs on the mobile device with non-volatile memory of 192 KB. What should Chris do to perform the required tasks?

1,Use the CLDC 1.0 configuration provided by the J2ME platform.

Page 77: j2me

131

Jim Lewis is working as a mobile application developer at with Technology Systems Inc. The organization asks Jim to create a registration form, which consists of text boxes and radio buttons to enable the users to fill their details in a mobile device. Jim needs to create an object to display the list of radio buttons from which the user can select an item. To perform the task, Jim writes the following code snippet:

//Create a Form object

Form writemail = new Form("Registration Form");// Create a ChoiceGroup object

Spacer login_save = new ChoiceGroup("",ChoiceGroup.MULTIPLE);login_save.append("Save Login",null);writemail .append(login_save);Display.getDisplay(listMIDlet.instance).setCurrent(writemail);

When Jim executes this code snippet, he encounters various errors in it. What should Jim to do solve the problem?

1,Jim needs to replace this code snippet with the following code snippet:

//Create a Form object

Form writemail = new Form("Registration Form");// Create a ChoiceGroup object

Spacer login_save = new

Spacer("",ChoiceGroup.MULTIPLE);login_save.append("Save Login",null);writemail .append(login_save);Display.getDisplay(MIDlet.instance).setCurrent(writemail);

Page 78: j2me

132

John Beret is working as a software developer at with Red Eye Experts. John is developing a J2ME application on a mobile device. John needs to display an image on the mobile device displayscreen. John writes the following code snippet to perform the task:

Form writemail = new Form("Form heading");

ImageItem imgItem = new ImageItem("Image Item", img, Item.LAYOUT_CENTER, null, Item.BUTTON);

Writemail.getImage(image);

Display.getDisplay(MIDlet.instance).setCurrent(writeMail);

When John executes the MIDP application with this code snippet, he encounters errors in it. What should John do to solve the problem?

1,John needs to replace this code snippet with the following code snippet:

Form writemail = new Form("Form heading"); ImageItem imgItem =        new ImageItem("Image Item", img,Item.LAYOUT_CENTER, null,                   

Writemail.getImage(image);

Display.getAppearanceMode(MIDlet.instance).setCurrent(writeMail);

Page 79: j2me

133

Mary Peterson is working as a software developer at SuperSoftware 2002 Inc. Mary has been assigned the task of creating a J2ME application for mobile devices. Mary needs to display a text box on the screen of a mobile device to enable the users to compose the message. For this, Mary wants to display a text box with the label ‘Compose SMS’ on the screen of the mobile devices. Mary writes following code snippet to perform the task:

TextBox tb = new TextBox("Compose SMS", "Write the text here", 200, TextField.ANY); Display.getDisplay(StringMIDlet.instance).setCurrent(tb);

However, Mary encounters various errors while running this code. What could be the possible reason?

1,Mary needs to replace this code snippet with the following code snippet: TextBox tb = new TextBox("Compose SMS", "Write the text here", 200, TextField.ANY); Display.getDisplay(MIDlet.instance).setCurrent(tb);

Page 80: j2me

134

Global System Inc. is a software development organization in Washington. The organization launches a new mobile device. The organization asks Donna, a UI designer and programmer to design and implement the phonebook of the latest mobile phone. The phonebook should display the inbox as a header and the list of usernames in the header.

To perform the task, Donna writes following code snippet:

Form writemail = new Form("Phonebook");Spacer login_save = new Spacer("",Spacer.MULTIPLE);login_save.append("Username1",null);

login_save.append("Username2",null);writemail .append(login_save);Display.getDisplay(listMIDlet.instance).setCurrent(writemail);

When Donna executes this code snippet, she encounters various errors in it. What should Donna to do solve the problem?

1,Donna needs to replace this code snippet with the following code snippet:

Form writemail = new Form("Phonebook");

ChoiceGroup login_save = new ChoiceGroup("",ChoiceGroup.MULTIPLE);login_save.append("Username1",null);

login_save.append("Username2",null);writemail .append(login_save);Display.getDisplay(MIDlet.instance).setCurrent(writemail);

Page 81: j2me

135

Ronald Billing is working as a software developer with InfoSuper Inc. Ronald is developing a J2ME application for mobile devices. Ronald needs to create a registration form, which consists of text boxes and radio buttons to enable the users to fill their details on a mobile device. Ronald wants to create a Form object to provide the information about the registration form. Ronald writes the following code snippet to perform the task:

Form writemail = new Form("Registration Form");writemail.append(‘You need to fill the form\n to access the mobile services provided by the InfoSuper’);Display.get(MIDlet.instance).setCurrent(writemail);

After creating the mobile application with this code, Ronald notices that application is not running properly and is not providing required output. What should Ronald do to solve the problem?

1,Ronald needs to replace the code snippet with the following code snippet:

Form writemail = new Form("Registration Form");writemail.append(“You need to fill the form\n to access the mobile services provided by the InfoSuper”);Display.get(MIDlet.instance).setCurrent(writemail);

136

Donna Johnson is working as a software developer with Blue Moon Computers. Donna is developing a mobile application by using J2ME. She needs to design user interface of the mobile application to enable users to interact with the mobile device. For this, Donna needs to store information about the events, which are generated by the users while interacting with the mobile device. Which class should Donna use to perform the task? 1,Command

Page 82: j2me

137

Global System Inc. is a software development organization in Washington. The organization receives a project of developing a mobile application by using J2ME. The organization asks Donna, a MIDP developer to create user interface for the mobile application. To provide user interaction, Donna needs to handle events, which are generated in response to the user interaction with the UI. Donna implements the Command class to handle the events. Which method of the Command class should Donna should use to gather information about the Command object, such as function of the Command object? 1,getLabel()

138

Pat Wilkins is working as a MIDP developer at with Technology systems Inc. Pat is developing a MIDP application. Pat is using the List class to implement phone book in the application. However, Pat needs to replace a specific element of the list with the new text and image. Which method of the List class should Pat should use to perform the task? 1,removeCommand()

Page 83: j2me

139

Corrine Wallace is working as a MIDP developer in with Super Software Inc. Corrine is developing a J2ME application for mobile devices. Corrine needs to display date and time on the screen of a mobile device such that they scroll along the screen continuously. Which class should Corrine implement to perform the task? 1,StringItem

140

Anne Johnson is working as a software developer at with Red Eye Experts. Anne is developing an MIDP application. Anne wants that a progress indicator should be displayed to the mobile users whenever an application is downloaded on the mobile device. Which class should Anne should use to perform the task? 1,Command

141

Larry Williams is working as a chief MIDP programmer at Technology Systems Inc. Larry needs to enable the programmers developing the MIDP application to use the J2ME objects even after the application is closed. Therefore, Larry implements RMS to store the objects, which are created by using J2ME. Larry needs to display a list of all the records in the RMS to the MIDP programmers. However, Larry notices that the records stored in the RMS are not in the sequential order and cannot be traversed because whenever a record is deleted, the recordID of the deleted record is not assigned to any other record. What should Larry do to solve the problem? 1,Larry needs to implement the RecordListener interface.

Page 84: j2me

142

Donna Johnson is working as a software developer with Global System Inc. Donna is developing a MIDP application. Donna implement RMS to store the objects created in J2ME so that the objects can be used even after the application is closed. Donna needs to share a record store, Sharable with other MIDlet suites. She writes the following code snippet to perform the task:

int authMode = RecordStore.AUTHMODE_PRIVATE;

boolean writable = False;

rs = RecordStore.openRecordStore( " Sharable ", True,authMode, writable );

However, Donna notices that MIDP application is not running properly and Sharable record store cannot be shared with other MIDlet suites. What should Donna do to perform the task?

1,Donna needs to replace the code snippet with the following code snippet:

int authMode = RecordStore.AUTHMODE_Any;

boolean writable = False;

rs = RecordStore.openRecordStore( " Sharable", True,authMode, writable );

Page 85: j2me

143

Pat Wilkins is working as a software developer at with Blue Moon Computers. Pat is developing a J2ME application for mobile devices. Pat is using persistent storage to store the objects created in J2ME so that the objects can be used even after the application is destroyed. Pat needs to display a list of all the records stored in the record store. However, Pat notices that the record stored in the record store cannot be traversed, as records are not in sequential order. To solve the problem, Pat decides to implement the Enumeration class and invoke the enumerateRecord() method to traverse the record store. However, while executing the enumerateRecord(), Pat encounters the RecordStoreNotOpenException. What could be the possible reason? 1,The record store is not open.

144

Debbie Howe is working as a software developer at with Safest Software Inc. Debbie implements persistent storage to store the objects created in J2ME so that the objects can be used even after the application is destroyed. Debbie needs to allow all the MIDlet suites to access the record store of a specified MIDlet suite. However, the MIDLet suites should not be able to modify the records stored in the record store of the specified MIDlet suite. What should Debbie do to perform the task?

1,Debbie needs to set the authmode and writable parameter of the openRecordStore method to RecordStore.AUTHMODE_PRIVATE and True respectively.

145

Pat Wilkins is working as a software developer at with Blue Moon Computers. The organization receives a project of developing a J2ME application for mobile devices. Pat is

1,Pat needs to replace the code snippet with the following code snippet:

Page 86: j2me

assigned the task of managing the record store containing data of the mobile application. Pat needs to open an existing record stored in the record store. To perform the task, Pat writes the following code snippet:

public void analyze( String rsName ){

RecordStore rs;

try {

rs = RecordStore.openRecordStore( rsName, True );

analyze( rs ); // call overloaded method

} catch( RecordStoreException e ){

logger.exception( e );

} finally {

try {

rs.closeRecordStore();

} catch( RecordStoreException e ){

}

}

}

However, Pat notices that code snippet is not running properly and has many errors in it. What should Pat do to solve the problem?

public void analyze( String rsName ){

RecordStore rs;

try {

rs = RecordStore.openRecordStore( rsName, False );

analyze( rs ); // call overloaded method

} catch( RecordStoreException e ){

logger.exception( e );

} finally {

try {

rs.closeRecordStore();

} catch( RecordStoreException e ){

// Ignore this exception

}

}

}

Page 87: j2me

146

Larry Williams is working as a chief MIDP programmer at Technology Systems Inc. Larry is developing a MIDP application. Larry needs to store the data of the application in the persistent storage so that the object created in J2ME can be used even after the application is destroyed. However, to store the data, Larry needs to convert the data to byte arrays. Larry writes the following code to convert the data to byte arrays:

byte[] data = recordStore.getRecord(recordID);

ByteArrayOutputStream byteOut = new ByteArrayOutputStream(data);

DataOutputStream out = new DataOutputStream(byteOut);

int someInt = out.readInt();

int someString = out.readUTF();

However, Larry notices that code has many errors in it because of which code is not producing required results. What should Larry do to solve the problem?

1,Larry needs to replace the code snippet with the following code snippet:

String data = recordStore.getRecord(recordID);

ByteArrayInputStream byteIn = new ByteArrayInputStream(data);

DataInputStream in = new DataInputStream(byteIn);

int someInt = in.readInt();

String someString = in.readUTF();

Page 88: j2me

147

Donna Johnson is working as a software developer with Global System Inc. The organization receives a project of developing a J2ME application for mobile devices. Donna is assigned the task of managing the record store containing the data of the mobile application. Donna needs to add a new record to the record store. To perform the task, Donna writes the following code snippet:

try

{

ByteArrayInputStream strmBytes = new ByteArrayInputStream();

DataInputStream strmDataType = new DataInputStream(strmBytes);

record = strmBytes.ByteArray();

rs.addRecord(record, 0, record.length);

}

However, while running the code, Donna notices that the code has many errors in it. What should Donna do to solve the problem?

1,Donna needs to replace the code snippet with the following code snippet:

try

{

ByteArrayOutputStream strmBytes = new ByteArrayOutputStream();

DataOutputStream strmDataType = new DataOutputStream(strmBytes);

record = strmBytes.toByteArray();

rs.addRecord(record, 0, record.length);

}

148

Pat Wilkins is working as a software developer at with Blue Moon Computers. Pat is developing a J2ME application for mobile devices. Pat needs to display a list of all the records stored in the record store, which is storing data of the mobile application. However, Pat notices that the record stored in the record store cannot be traversed, as records are not in the sequential order. To solve the problem, Pat writes the following code snippet:

RecordStore rs = RecordStore.openRecordStore(rsName, True);

RecordEnumeration enu;

try {

enu = rs.enumerateRecords( null, null, False );

1,Pat needs to replace the code snippet with the following code snippet:

RecordStore rs = RecordStore.openRecordStore(rsName, True);

RecordEnumeration enu = null;

try {

enu = rs.enumerateRecords( null, null, True );

while( !enu.hasMoreElements() ){

int id = enu.getNextRecordId();

// do something here with the record

Page 89: j2me

while( !enu.hasMoreElements() ){

int id = enu.getNextRecordId();

}

}

catch( RecordStoreException e ){

}

finally {

enu.destroy();

}

However, Pat notices that code snippet is not running properly and has many errors in it. What should Pat do to solve the problem?

}

}

catch( RecordStoreException e ){

}

finally {

enu.destroy();

}

149

Debbie Howe is working as a software developer at with Safest Software Inc. Debbie is developing a MIDLet application. Debbie implements persistent storage to store the objects created in J2ME so that the objects can be used even after the application is destroyed. Debbie needs to search a particular record in the record store on the basis of the specific search criteria. To perform the task, Debbie writes the following code snippet:

class SearchRec implements RecordListener

{

private String searchCriteria = null;

public SearchRec (String searchCriteria)

{

this.searchCriteria = searchCriteria.toUpperCase();

}

public boolean matches (byte [] candidate)

{

String str = new String (candidate).toUpperCase();

if (searchCriteria != null && str.indexOf(searchCriteria) != -1)

return True; 1,Debbie should implement the RecordFilter interface instead of the RecordListener interface.

Page 90: j2me

else

return False;

}

}

However, while running the code, Debbie notices that code has many errors in it. What should Debbie do to solve the problem?

150

John Lewis is working as an application developer at with Global System Inc. John has created a record store for the newly developed MIDlet application. John wants to add new record in a record store by using addRecord() method. But, at the time of adding record in the record set, an exception is raised as RecordStoreException. What may be the cause of this exception? 1,The exception is raised if a record store is not opened.

151

Steve Irving is working as an application developer at with Blue Moon Computers. Steve has developed MIDlet application by using MIDP 2.0. Steve wants to create and open a Record Store for storing some records of the MIDlet application in the persistent Record Management System (RMS) database. What should Steve do to perform the above task?

1,Steve needs to write the following code:

RecordStore OpenRecordStore(String RecordListener listener,

boolean createIfNecessary)

Page 91: j2me

152

Bob Edwin is working as an application developer at with Red Sky Experts. Bob has developed MIDlet application by using MIDP 2.0. Bob also created a Record Store for storing some records of a MIDlet application in the persistent Record Management System (RMS) database. Now, Bob wants to remove a record store because the application is no longer in use. What should Bob do to perform the above task?

1,Bob needs to write the following code:

Static RecordStore.deleteRecordStore(String storeName)

153

Pat Greene is working as an application developer at with Deez Inc. Pat has created a Record Store for the newly developed MIDlet application. Now, Pat wants to add new record in a record store by using addRecord () method. But, at the time of adding the record in the record set, the RecordStoreFullException exception is raised. What may be the cause of this exception? 1,The exception is raised if a record store is not opened.

154

Donna Johnson is working as an application developer at with Safest Software. Donna has developed MIDlet application by using MIDP 2.0. Donna has also created a Record Store for storing some records of MIDlet application in the persistent Record Management System (RMS) database. Now, Donna wants to share this record store across another MIDlet application to remove the redundancy of data. What should Donna do to perform the above task?

1,Donna needs to write the following code:

RecordStore openRecordStore(String recordStoreName,

boolean createIfNecessary)

Page 92: j2me

155

Jim Lewis is a MIDP developer at with Red Sky IT System. Jim has been assigned the task to develop a MIDP application. Therefore, Jim needs to use the package, which provides all the basic classes required for a MIDP application. Which package should Jim use to develop the MIDP application? 1,javax.microedition.midlet

156

John Edwin is a mobile application developer at with BlueMoon Computers. The business manager of the company organization asks John to develop a mobile application in using J2ME. Therefore, John needs to use a package that supports the GUI components, for the screens of mobile devices. Which package should John use to perform the above task? 1,javax.microedition.midlet

157

Chris Wilkins is an application developer with Global Systems. Chris develops a MIDlet application in J2ME. After developing the application, Chris wants to establish a two-way communication for the MIDlet application, over a network. Which protocol should Chris use to perform this task? 1,UDP Protocol

158

Donna Johnson is a mobile application developer at with BlueMoon Computers. Donna has developed a mobile application in using J2ME. Now, Donna wants to add a package that provides support for networking in mobile devices. Which package should Donna use to perform the above task? 1,javax.microedition.midlet

Page 93: j2me

159

Pat Wilkins is an application developer at with Global Inc. Pat has developed a MIDlet application in using J2ME. Now Pat wants to store and retrieve the MIDlet data from persistent database. Which package should Pat use to perform the above task? 1,javax.microedition.midlet

160

Chris is working as a MIDP UI designer at Technology Systems Inc. Chris develops a MIDlet application to provide Web services, such as news to the users and installs the application on a mobile device. After the MIDlet application is installed, the mobile device, where the MIDlet application is installed, generates and sends a status report about the installation of the MIDlet application to a Web server from where the application is installed. Chris notices that the MIDlet application is not installed on the mobile device and the Web server responds with status code, 901. What could be the problem? 1,Insufficient memory in the mobile device

Page 94: j2me

161

John Beret is working as a software developer at Red Eye Experts. John is developing a MIDlet application on a mobile device. John wants to display news on a mobile device. For this, John needs to enable the mobile device to launch the news MIDlet application using push registry feature. John performs registration to avoid errors, such as syntax error in the push attributes. However, the registration is not performed properly and an error is displayed stating Security Exception. What could be the reason of error?

1,The J2ME platform does not support push notification for the requested connection protocol

162

Pat Wilkins is an application developer at Global Inc. Pat has developed a MIDlet application. Pat wants to register a MIDlet connection dynamically using the Push Registry class at runtime. However, at the time of dynamic registration an exception occurs as “IOException.” What may be the cause of the problem? 1,Connection is already registered

163

Consider the Statements:

Statement A: During dynamic configuration IllegalArgumentException is thrown if the connection of filter arguments is null.

Statement B:

During dynamic configuration ClassNotFoundException is thrown if the MIDlet argument is null or if the name of the class is not found in the MIDlet suite.

Which of the following is True, with respect to the above Statements? 1,Statement A is True and Statement B is False.

Page 95: j2me

164

Ronald Billing is working as a software developer at InfoSuper Inc. Ronald develops a MIDlet application and installs the application on a mobile phone. The mobile device, where the MIDlet application is installed, generates and sends a status report about the installation of the MIDlet application to a Web server. Ronald identifies that the MIDlet application is not installed on the mobile device and the Web server responds with status code, 905. What could be the problem?

1,A mismatch in the actual attributes and the attributes specified in the JAR file

165

Christine Turner is working as a programmer at Technology Systems, which provides wireless services to its customers. The management asks Christine to develop MIDlet application to provide Web services, such as news, stocks to its customers. In addition, Christine wants that the customers are able to access the application remotely. Therefore, Christine needs to deploy the JAR and the JAD files of the MIDlet application on the Web server to enable the users to download the MIDlet application from the Web server. For this, Christine writes a code to configure a Tomcat Web server to recognize the JAD and JAR files. However, the Tomcat Web server is not configured. Which of the following codes should Christine use to perform the required task?

1,<mime-mapping>

<extension>jad</extension>

<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>

</mime-mapping>

<mime-mapping>

<extension>jar</extension>

<mime-type>application/java-archive</mime-type>

</mime-mapping>

Page 96: j2me

166

Jim Lewis is working as a software developer at Global Systems Inc, which provides wireless services to its customers. Jim Lewis develops a MIDP application, which enables the users to download video and movie clips. Now, Christine needs to declare a static push registration so that the MIDlet application is launched when the mobile device receives a network connection request. For this, Christine adds a MIDlet-Push-n attribute while installing the MIDlet application on a mobile device. However, the mobile device does not register the MIDlet application to accept a network connection request. Which of the following options should Jim use to solve the problem?

1,Use the following code to add the MIDlet-Push-n attribute:

MIDlet-Push-n: ConnectionURL, Filter

167

Jim Lewis is working as a software developer at Blue Moon Computers. Jim needs to use push registry feature to enable the mobile device to launch the news MIDlet application to display news information on a mobile device. For this, Jim performs registration to avoid errors, such as syntax error in the push attributes. However, the registration is not performed properly and an error is displayed stating Security Exception. What type of registration did Jim perform and what is the cause of the error?

1,Jim performed static push registration and error is because a connection that is already reserved for another MIDlet application is declared

Page 97: j2me

168

Pat Greene is working as a software developer at Safest Software Co. Pat develops a MIDlet application that provides a service of selling movie tickets on a mobile device. The application can send an alarm to the ticket holder at the time of beginning of the movie show. However, when the MIDlet application is invoked, the registerAlarm() method displays an error stating ClassNotFoundException. Pat needs to set a new alarm for the MIDlet application. The alarm should alert the ticket holder just before a movie is about to begin. What could be the reason for the error and what should Pat do to retrieve the time of previous alarm and perform the required modifications to the application?

1,The error is because the J2ME platform does not support alarm based push registry. Use the PushRegistry.Alarm() method to perform modifications.

169

Donna Bard is working as a programmer at BlueMoon Computers, which develops software for mobile devices. Donna develops mobile applications using J2ME platform. Donna develops a MIDlet application, which provides Web services, such as cricket news, stock news to the users. To activate the MIDlet application, Donna needs to create an inbound connection by using only the protocol of the network connection. What should Donna do to perform the required task?

1,Use the following code:

Connector.open("socket:\\")

Connector.open("datagram:\\")

Page 98: j2me

170

Ken Burton is working as a software developer at Global Systems Inc, which provides wireless services to its customers. Ken develops a MIDlet application for mobile wireless device that enables the users to use the e-mail facility. Ken needs to deploy the MIDlet application on a Web server to enable the users to download application to a mobile device from the Web server using a wireless network. In addition, when a user tries to download the application, the application is not installed and the mobile device generates the status code 901. What does Ken do to perform the required task and what could be the possible reason of error?

1,To deploy a MIDlet application on a Web server, Ken needs to establish a network connection between the mobile device and the computer on which Ken wants to deploy the MIDlet application. The error has occurred because the user is not authorized to install a MIDlet.

Page 99: j2me

171

Larry Williams is working as a software developer at SuperSoft2000. The management asks Larry to develop a MIDlet application to enable the users to access the Web services, such as news. Now, Larry needs to implement the push registry on the MIDlet application so that the application can use the remote connection feature of the push registry to launch a news MIDlet application. The application needs to connect to a remote server to display news information on a mobile device. In addition, Larry develops a MIDlet application that is invoked based on scheduled tasks, such as birthdays. Therefore, Larry also needs to register an alarm based push registry to launch the application. Which method does Larry use to perform the required tasks?

1,Use the registerConnection() and the registerAlarm()method of the javax.microedition.io.PushRegistry class.

Page 100: j2me

172

Chris Donaldson is working as a software developer at InfoSuper Corp. Chris develops a MIDlet application, which serves the purpose of an address book. Chris performs the following steps to deploy the MIDlet application using the IR port to enable the users to install the application on a mobile device using IR port.

Install an interface for the IR port on the computer on which you want to deploy the MIDlet application.

Send the JAR and JAD files of the MIDlet application to the mobile device through the IR port.

However, the MIDlet application is not deployed. What could be the possible reason of error? 1, The IR port on the mobile device is not activated.

173

Diane Frye is a mobile application developer at SmartLabs. Diane is developing a MIDlet application. Diane needs to start the MIDlet application from a remote connection without the user intervention. Therefore, Diane needs to implement Push registries in the MIDlet application. However, to implement the Push registry in MIDlet application, Diane needs to implement inbound connections because MIDlet applications are activated by an inbound connection. Diane needs to implement the inbound connection such that it can be identified only with the help of the protocol of the network connection. Identify the code snippet Diane needs to write to perform the task.

1,Connector.open("sms://")

Connector.open("datagram://")

Page 101: j2me

174

John Edwin is working as an application developer at Blue Moon computers. John has developed a MIDlet application providing the connection string, the MIDlet to launch, and the filter string. Now, John wants to connect the MIDlet application dynamically, using the PushRegistry class at runtime. While registering the dynamic connections, it throws the exceptions as IllegalArgumentException.

In addition, John develops a MIDlet application that provides e-mail facility to the users. Now, Jim needs to create an inbound connection to activate the MIDlet application.

What may be the cause of this Exception and what should John do to create an inbound connection?

1,The name of the class is not found in the MIDlet suite. Use the following code to create inbound connection:

Connector ("socket://")

Connector ("datagram://")