310-019 Sun Certified Associate.Java Platform Se Exam Set 2

Which statement is true?


Options are :

  • JMS provides interfaces to naming and directory services.
  • The JMS API is located in the java.jms package.
  • JMS enables an application to provide tightly coupled, distributed communication.
  • JMS enables an application to provide flexible, asynchronous data exchange.

Answer : JMS enables an application to provide flexible, asynchronous data exchange.

310-019 Sun Certified Associate.Java Platform Se Exam Set 3

Which is true?


Options are :

  • The Java threading model provides equal processor time to all threads.
  • All threads created by a given Java program share the same invocation stack.
  • A J2SE program can create no more than 10 concurrent threads.
  • Threading allows GUI applications to perform lengthy calculations and respond to user events at the same time

Answer : Threading allows GUI applications to perform lengthy calculations and respond to user events at the same time

1. class Test2 {
2. static String setMessage(String str) {
3. return str + "How are you doing?";
4. }
5.
6. public static void main(String[] args) {
7. String str = "Hello! ";
8. str = setMessage(str);
9. System.out.println("str : " + str);
10. }
11. }
What is the result?


Options are :

  • str : How are you doing?
  • Compilation fails because of an error at line 2.
  • Compilation fails because of an error at line 8.
  • str : Hello! How are you doing?
  • str : Hello!
  • Compilation fails because of an error at line 7.
  • Compilation fails because of an error at line 3.

Answer : str : Hello! How are you doing?

Which is true regarding multiplicity?


Options are :

  • It is used to indicate which class some other class extends.
  • It is used to show the interfaces implemented by a class.
  • It is used to indicate of which class an object is an instance
  • It is used to indicate the number of instances of a class that may be associated with an instance of some other class.

Answer : It is used to indicate the number of instances of a class that may be associated with an instance of some other class.

310-019 Sun Certified Associate.Java Platform Se Exam Set 4

Which technology is used to develop components that interact with server-side objects in a webbased
application?


Options are :

  • JavaScript
  • HTML
  • servlets
  • XML

Answer : servlets

Which two are true about HTML? (Choose two.)
A. It can be generated dynamically by servlets.
B. It is an object-oriented programming language.
C. It is used by the browser to display the client user interface.
D. It contains APIs that are used to access data in an RDBMS.


Options are :

  • A,D
  • A,C
  • C,B
  • C,D

Answer : A,C

1. class Test {
2. public static void main(String args[]) {
3. String str = "Hello!";
4. String str2 = "Bye!";
5. str += str2;

6. str -= str2;
7.
8. if ( str == str2 ) {
9. System.out.println("str = str2");
10. } else {
11. System.out.println("str != str2");
12. }
13. }
14. }

What is the result?



Options are :

  • Compilation fails.
  • str != str2
  • The code runs with no output.
  • str = str2

Answer : Compilation fails.

310-019 Sun Certified Associate.Java Platform Se Exam Set 5

1. class Test {
2. public static void main(String args[]) {
3. String str = new String("Welcome");
4. // insert code here
5. }
6. }
Which, inserted at line 4, produces the output true?


Options are :

  • System.out.println(str.indexOf("W"));
  • System.out.println(str.startsWith("W"));
  • System.out.println(str.indexOf(1));
  • System.out.println(str.startsWith('W'));
  • . System.out.println(str.trim());

Answer : System.out.println(str.startsWith("W"));

4. int n1 = 22, n2 = 67, n3 = 0, n4 = 47, n5 = 17, n6 = 50;
5. boolean b = true;
Which three evaluate to true? (Choose three.)
A. (n2 > n6) || b

B. (!b) && (n1 <= n4)
C. (n2 < n6) && (n4 >= n1)
D. (n3 < n5) || (n2 <= n1)
E. !(n1 < n3) && (n5 != n4)



Options are :

  • C,D,E
  • C,D,B
  • A,B,C
  • A,D,E

Answer : A,D,E

Which three about JMS are true? (Choose three.)
A. JMS is the acronym for Java Mail Service.
B. JMS supports an event-oriented approach to message reception.
C. JMS supports both synchronous and asynchronous message passing.
D. JMS does NOT depend on MOM (Messaging-Oriented Middleware) products.
E. JMS provides a common way for Java programs to access an enterprise messaging system's
messages.


Options are :

  • E,C,A
  • A,E,D
  • B,C,E
  • B,C,D

Answer : B,C,E

310-019 Sun Certified Associate.Java Platform Se Exam Set 6

Which three are provided by the EJB tier in a multitier J2EE application? (Choose three.)
A. security
B. XML parsing
C. concurrency control
D. transaction management
E. dynamic content generation


Options are :

  • B,D,E
  • C,D,E
  • A,C,D
  • B,C,D

Answer : A,C,D

A Java programmer wants to develop a small application to run on mobile phones. Which Java
edition (or editions) are required to develop the application?


Options are :

  • J2EE and J2ME
  • J2SE and J2ME
  • only J2EE
  • only J2SE
  • J2SE and J2EE
  • only J2ME

Answer : J2SE and J2ME

6. int time = 12;
7. if ( time < 12 ) {
8. System.out.println("Good morning");
9. }
10. // insert code here
11. System.out.println("Good afternoon");
12. }
13. else if ( time >= 18 ) {
14. System.out.println("Good evening");
15. }
Which three, inserted independently at line 10, produce the output Good afternoon? (Choose
three.)
A. if ( time >= 12 && time < 18 ) {
B. else if ( time < 12 || time > 18) {
C. else if ( time > 12 || time <= 18 ) {
D. else if ( time > 12 && time >= 18 ) {
E. else if ( time >= 12 || time < 18 ) {


Options are :

  • A,B,C
  • A,C,E
  • B,A,D
  • B,C,E

Answer : A,C,E

310-083 Sun Certified Web Component Developer for J2EE 5 Set 1

Which is true about RMI?


Options are :

  • RMI is the Java API used for executing queries on a database.
  • RMI is the transport protocol used by web servers and browsers.
  • RMI is used to develop applications for wireless mobile devices.
  • RMI is used to create thin web clients.
  • RMI allows objects to be sent from one computer to another

Answer : RMI allows objects to be sent from one computer to another

Which is a benefit of Swing clients?


Options are :

  • They can be used without a JRE on the client.
  • They are easier to deploy than thin clients.
  • They are more universally supported by browsers than thin clients.
  • They can provide a richer graphical user interface experience than thin clients.

Answer : They can provide a richer graphical user interface experience than thin clients.

Given:
4. class Example {
5. int x = 50;
6. int y = 100;
7. public static void main(String args[]) {
8. int x = 0, y = 10;
9. Example ex = new Example();
10. while (x < 3) {
11. x++; y--;
12. }

13. System.out.println("x = " + x + " , y = " + y);
14. }
15. }
What is the result?


Options are :

  • Compilation fails because of an error at line 9.
  • Compilation fails because of an error at line 11.
  • Compilation fails because of an error at line 8.
  • x = 3 , y = 7
  • Compilation fails because of an error at line 10.
  • x = 53 , y = 97

Answer : x = 53 , y = 97

310-083 Sun Certified Web Component Developer for J2EE 5 Set 2

11. class Cat {
14. public static void main(String [] args) {
15. Cat c1 = new Cat();
16. Cat c3 = new Cat();
17. Cat c2 = c1;
18. Cat c4 = c3;
19. c1 = c4;
20. c4 = c2;

21. if (c1 == c2) System.out.print("c1 == c2 ");
22. if (c1 == c3) System.out.print("c1 == c3 ");
23. }
24. }
What is the result?



Options are :

  • c1 == c3
  • No output is produced.
  • c1 == c2 c1 == c3
  • The output is unpredictable
  • c1 == c2

Answer : c1 == c3

A Java programmer wants to develop a browser-based multitier application for a large bank.
Which Java edition (or editions) should be used to develop this system?


Options are :

  • J2SE and J2EE
  • only J2SE
  • J2EE and J2ME
  • J2SE and J2ME
  • only J2ME
  • only J2EE

Answer : J2SE and J2EE

Given:
2. class Test {
3. public static void main(String args[]) {
4. for (int i = 1; i < 5; i++) {
5. if (i == 2) {
6. continue;
7. }
8. System.out.print(" i = " + i);
9. }
10. }
11. }
What is the result?


Options are :

  • Compilation fails.
  • i = 1 i = 3 i = 4 i = 5
  • i = 1 i = 3 i = 4
  • i = 1 i = 2 i = 4
  • i = 1 i = 2 i = 4 i = 5
  • i = 1
  • The code runs with no output.

Answer : i = 1 i = 3 i = 4

310-083 Sun Certified Web Component Developer for J2EE 5 Set 3

3. int num = 0, count;
4. while ( num < 3 ) {
5. num++;
6. // insert code here
7. System.out.println("num = " + num + " : count = " + count);
8. }
9. }
Which, inserted at line 6, produces the following output?
num = 1 : count = 1
num = 1 : count = 2
num = 2 : count = 1
num = 2 : count = 2
num = 3 : count = 1
num = 3 : count = 2


Options are :

  • for ( count = 1 ; count < 2 ; count++ ) {
  • for ( count = 1 ; count < 3 ; count++ ) {
  • while ( ++count < 2 ) {
  • while ( ++count < 3 ) {
  • for ( count = 0 ; count < 3 ; count++ ) {

Answer : for ( count = 1 ; count < 3 ; count++ ) {

Which two are true about J2ME? (Choose two.)
A. It provides a built-in database.
B. It is the foundation platform for J2SE.
C. It can be used to create Swing applications.
D. It can be used to create applications that run on mobile phones


Options are :

  • A,D
  • C,D
  • B,C
  • A,B

Answer : A,D

310-083 Sun Certified Web Component Developer for J2EE 5 Set 4

You need to create a class Foo that will record the number of times the go() method is invoked on
a particular instance of the class. Which solution correctly implements this goal?


Options are :

  • Declare an instance variable invokeCount for the class Foo, and increment the variable within the go() method.
  • . Declare a static variable invokeCount for the class Foo, and increment the variable within the go() method.
  • Declare a local variable invokeCount inside the go() method, and increment the variable within the go() method.
  • . Declare a method parameter invokeCount as the argument to the go() method, and increment the variable within the go() method.

Answer : Declare an instance variable invokeCount for the class Foo, and increment the variable within the go() method.

Which is valid?


Options are :

  • import java.util.*; package com.example; class Test { }
  • package com.example; package com.sun; import java.util.*; class Test { }
  • package com.example; class Test { } import java.util.*; B. C. D.
  • package com.example; import java.util; import java.*; class Test { }
  • package com.example; import java.util.*; import java.io.*; class Test { }

Answer : package com.example; import java.util.*; import java.io.*; class Test { }

Which, inserted at line 8, correctly implements the interface?


Options are :

  • protected boolean land() {
  • boolean land() {
  • public boolean land() {
  • public void land() {
  • boolean land(int i) {

Answer : protected boolean land() {

310-083 Sun Certified Web Component Developer for J2EE 5 Set 5

Which two are true about the java and javac commands? (Choose two.)
A. java -version will print the version of the JVM.
B. java -classpath will print the classpath used by the JVM.
C. javac -D lets you specify the destination directory for the compiled class files.
D. javac -version will print the OS version for the machine on which the JDK is installed.
E. java -classpath lets you specify one or more directories to be used by the JVM to locate class
files.


Options are :

  • D,E
  • A,D
  • A,E
  • B,D

Answer : A,E

What is true about JavaScript clients?


Options are :

  • They CANNOT write to the client's hard drive.
  • They require Java Web Start technology to be deployed.
  • They must be hosted by J2EE containers.
  • They support all standard J2SE syntax.

Answer : They CANNOT write to the client's hard drive.

Which two correctly import the Map class in the java.util package? (Choose two.)
A. import Map;
B. import *.Map;
C. import java.util;
D. import java.util.*;
E. package java.util.*;
F. import java.util.Map;
G. package java.util.Map;


Options are :

  • A,B
  • F,G
  • D,F
  • C,D

Answer : D,F

310-083 Sun Certified Web Component Developer for J2EE 5 Set 6

Which option will correctly initialize the property com.example.property to someValue when
invoking java?


Options are :

  • -Dcom.example.property=someValue
  • com.example.property=someValue
  • . -Pproperty:someValue
  • -P com.example.property someValue
  • -Pcom.example.property:someValue

Answer : -Dcom.example.property=someValue

Which two packages are used to create GUI programs in J2SE? (Choose two.)
A. java.io
B. java.net
C. java.awt
D. java.util
E. javax.swing


Options are :

  • A,B
  • C,E
  • B,E
  • A,C

Answer : C,E


Which is a valid definition of an interface called Transportable given another valid interface,
Movable?



Options are :

  • interface Transportable extends Movable { /*...*/ }
  • class Movable implements Transportable { /*...*/ }
  • interface Transportable implements Movable { /*...*/ }
  • class Movable extends Transportable { /*...*/ }

Answer : interface Transportable extends Movable { /*...*/ }

310-083 Sun Certified Web Component Developer for J2EE 5 Set 7

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions