Click the Task button.
Place the appropriate platform label on the class name. If the class exists in both CLDC and J2SE, choose the "Exists in BOTH..." option, regardless of whether the package names are different.
Select and Place:
Given:
7.
ServerSocketConnection ssc =
8.
SocketConnection sc = (SocketConnection) ssc.acceptAndOpen(); Which entry in the JAD file is used to request multiple permissions?
(ServerSocketConnection)Connector.open("socket://:5999");
A. MIDlet-Permission: javax.microedition.io.Connector.socket; javax.microedition.io.Connector.serversocket
B. MIDlet-Permission: javax.microedition.io.socket MIDlet-Permission: javax.microedition.io.socketserver
C. MIDlet-Permission: javax.microedition.io.Connector.socket, javax.microedition.io.Connector.serversocket
D. MIDlet-Permission: javax.microedition.io.Connector.socket MIDlet-Permission: javax.microedition.io.Connector.serversocket
E. MIDlet-Permission: javax.microedition.io.socket; javax.microedition.serversocket
Given:
10. //...
20.
try {
21.
Hashtable table = new Hashtable();
22.
for (;;) table.put(new Object(), new Object());
23.
} catch (OutOfMemoryException e) {
24.
Display.getDisplay().setCurrent(new Alert("Out of Memory!"));
25.
}
26.
//... Which is true?
A. Out of Memory! is printed to the system console.
B. An exception is thrown at runtime but there is no guarantee an alert will be shown to the user.
C. Compilation fails.
D. The program hangs at line 22.
Given:
12.
canvas.repaint(x1,y1,wd,ht);
13.
canvas.repaint(x2,y2,wd,ht);
14.
canvas.serviceRepaints(); Which two are true? (Choose two.)
A. serviceRepaints() blocks waiting for paint() to return.
B. paint() is called three times, once for each repaint() and once for serviceRepaints().
C. paint() is always called twice, once for each repaint() request.
D. If the two regions specified in repaint() overlap, repaint() may attempt to paint the union of the two areas.
A suite is signed with a X.509 PKI certificate. The root certificate is not present in the device's keystore. What is the installation result?
A. The JAD file is rejected. Installation fails.
B. The JAD file is rejected. It installs in the untrusted domain.
C. Authentication fails. It installs in the untrusted domain.
D. Authentication fails. Installation fails.
Which interaction generates an application event in a MIDlet that uses only high-level APIs?
A. navigation
B. making a choice in a multiple choice List
C. scrolling
D. responding to a command
How does a TiledLayer determine the sequence of frames in animated tiles?
A. The tile to be displayed must be set during each frame of the animation.
B. They CANNOT be set. Animation is possible only with a Sprite.
C. The sequence of frames is obtained from the location in the source image.
D. The sequence of frames is obtained from an animated Sprite.
A MIDlet suite on a device uses socket connections. The device always asks the user for permission when the suite tries opening a socket connection. What is always false about the MIDlet suite?
A. It is trusted and requests permission to use sockets with MIDlet-Permissions-User.
B. It is untrusted.
C. It is trusted and requests permission to use sockets with MIDlet-Permissions.
D. It is trusted and requests permission to use sockets with MIDlet-Permissions-Opt.
Which exception is generated if a user rejects permission to any restricted resource?
A. ConnectionNotFoundException
B. IllegalAccessException
C. SecurityException
D. CertificateException
Given:
DateField df = new DateField("Date", DateField.DATE_TIME);
Which requests the width of df to fill available screen space?
A. df.setLayout(Item.LAYOUT_MAXIMUM);
B. df.setLayout(Item.LAYOUT_RIGHT);
C. df.setLayout(Item.LAYOUT_EXPAND);
D. df.setLayout(Item.LAYOUT_FULL);
A JTWI device has a working socket implementation. A MIDlet requests permission to use socket connections on this device using the attribute MIDlet-Permissions-Opt, but is denied permission. Given:
20.
public void connect() {
21.
try {
22.
String addr = "socket://host.com:79";
23.
SocketConnection sc;
24.
sc = (SocketConnection) Connector.open(addr);
25.
sc.setSocketOption(SocketConnection.LINGER, 5);
26.
InputStream is = sc.openInputStream();
27.
OutputStream os = sc.openOutputStream();
28.
os.write("\\r\\n".getBytes());
29.
int ch = is.read();
30.
// ...
35.
} catch (IOException ioe) {
36.
// ...
40.
}
41.
}
Which is true assuming that the argument to Connector.open() points to a valid destination, and the device has resources to create new socket connections?
A. The device disallows the MIDlet to be installed.
B. If connect() executes, a SecurityException is thrown at runtime at line 26.
C. If connect() executes, a SecurityException is thrown at runtime at line 28.
D. If connect() executes, a ConnectionNotFoundException is thrown at runtime at line 24.
E. If connect() executes, a SecurityException is thrown at runtime at line 24.
Which two are true about record store listeners? (Choose two.)
A. A record store can have only one registered listener.
B. When a record store is closed, listeners are removed.
C. A record store can have more than one registered listener.
D. Listeners are notified if a record store is deleted.
E. To listen for all events, three listeners must be registered.
What is the minimum number of simultaneously running threads that a JTWI 1.0 device must support for each MIDlet suite?
A. 3
B. two running threads for each class of the MIDlet suite
C. 1
D. 10
Click the Exhibit button.
The method in the Exhibit must create an HTTP GET connection that works reading both of the following HTTP server response cases:
HTTP server response headers n.1
1.
HTTP/1.1 200 OK
2.
Server: MyServer/1.3.0
3.
Content-Length: 3245
4.
Content-Type: text/html
HTTP server response headers n.2
1.
HTTP/1.1 200 OK
2.
Server: MyServer/1.3.0
3.
Content-Type: text/html
Which two can be used in the fragment of code starting at line 12? (Choose two.)
A. 12. int ch;
13.
while ((ch = is.read()) != -1) {
14.
//...
20. }
B. 12. int ch;
13.
while ((ch = is.read()) == -1) {
14.
//...
20. }
C. 12. if (len > 0) {
13.
byte[] data = new byte[len];
14.
int actual = is.read(data);
15.
//...
20.
} else {
21.
int ch;
22.
while ((ch = is.read()) != -1) {
23.
//...
examollectionvce.com Leaders in IT Certification 153
30.
}
31.
}
D. 12. byte[] data = new byte[len];
13. int actual = is.read(data);
A JTWI device has a working socket implementation. A MIDlet requests permission to use socket connections on this device using the attribute MIDlet-Permissions-Opt, but is denied permission. Given:
20.
public void connect() {
21.
try {
22.
String addr = "socket://host.com:79";
23.
SocketConnection sc;
24.
sc = (SocketConnection) Connector.open(addr);
25.
sc.setSocketOption(SocketConnection.LINGER, 5);
26.
InputStream is = sc.openInputStream();
27.
OutputStream os = sc.openOutputStream();
28.
os.write("\\r\\n".getBytes());
29.
int ch = is.read();
30.
// ...
35.
} catch (IOException ioe) {
36.
// ...
40.
}
41.
}
Which is true assuming that the argument to Connector.open() points to a valid destination, and the device has resources to create new socket connections?
A. The device disallows the MIDlet to be installed.
B. If connect() executes, a SecurityException is thrown at runtime at line 26.
C. If connect() executes, a SecurityException is thrown at runtime at line 28.
D. If connect() executes, a ConnectionNotFoundException is thrown at runtime at line 24.
E. If connect() executes, a SecurityException is thrown at runtime at line 24.