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

Which is an advantage of RMI over sockets?


Options are :

  • Sockets CANNOT transmit objects. . .
  • . It is NOT necessary to implement an application-level communication protocol to use RMI.
  • RMI transmission speed is faster than sockets.
  • Interactive communication is NOT possible using sockets

Answer : . It is NOT necessary to implement an application-level communication protocol to use RMI.

Which is an advantage of applets over HTML/JavaScript clients?


Options are :

  • In their default state, applets have access to the client's computer
  • Applets are downloaded more quickly to the client.
  • . Applets can use a wider variety of UI components.
  • Applets are more widely supported by browsers.

Answer : . Applets can use a wider variety of UI components.

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 :

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

Answer : A,C,E

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

12. String s = "abcdefgabc";
13. char c = s.charAt(2);
14.
15. if (c == 'c')
16. s = s.replace('c', 'X');
17. else if (c == 'b')
18. s = s.replace('b', 'O');
19. else
20. s = s.replace('c', 'O');
21. System.out.println(s);
What is the result?


Options are :

  • Compilation fails
  • abXdefgabc .
  • abOdefgabO
  • abXdefgabX
  • abOdefgabc
  • aOcdefgaOc
  • .
  • aOcdefgabc

Answer : abOdefgabO

Which two symbols are used to indicate the visibility of an attribute in UML? (Choose two.)
A. -
B. $
C. +
D. &
E. *


Options are :

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

Answer : A,C

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 10.
  • Compilation fails because of an error at line 9.
  • Compilation fails because of an error at line 11.
  • x = 53 , y = 97
  • Compilation fails because of an error at line 8.
  • x = 3 , y = 7

Answer : x = 3 , y = 7

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

Which two are true? (Choose two.)
A. 2..4 is a valid multiplicity indicator.
B. The multiplicity indicators * and 1..* are equivalent.
C. The multiplicity indicators + and 1..* are equivalent.
D. An optional association is shown using the multiplicity indicator 0..1.

E. Multiplicity indicators must always be shown at both ends of an association.
F. Multiplicity indicators are optional, but if they are included they must be shown at both ends of
an association.



Options are :

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

Answer : A,D

Which three classes are part of the java.io package? (Choose three.)
A. URL
B. File
C. String

D. Reader
E. Socket
F. BufferedWriter



Options are :

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

Answer : B,D,F

Given two complete source files:
1. /* Example.java */
2. package pack;
3. public class Example { }
1. /* Test.java */
2. // insert code here
3. public class Test {
4. public static void main(String args[]) {
5. Example obj = new Example();
6. }
7. }
Which, inserted at line 2 in Test.java, allows the code to compile?


Options are :

  • import pack.Example;
  • import pack.Test;
  • . import pack;
  • The code compiles with no changes

Answer : import pack.Example;

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

Which package contains classes to read from, and write to, files?


Options are :

  • java.io .
  • java.net
  • javax.file
  • . java.util
  • javax.swing
  • java.stream
  • java.lang

Answer : java.io .

Which two are associated with the business tier in a J2EE web-based application? (Choose two.)
A. JMS
B. JDBC
C. applets
D. servlets
E. Swing applications


Options are :

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

Answer : A,B

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

Which object-oriented principle is supported by the use of Java packages?


Options are :

  • polymorphism
  • inheritance
  • encapsulation
  • dynamic typing

Answer : encapsulation

A Java programmer wants to develop a stand-alone, desktop, word processing application. Which
Java edition (or editions) are appropriate to develop this application?


Options are :

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

Answer : only J2SE

Which two are true? (Choose two.)
A. An interface can implement another interface.
B. A class can implement more than one interface.
C. Many classes can implement the same interface.
D. Every class must implement at least one interface


Options are :

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

Answer : B,C

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

Which Java technology uses standard mappings between Java classes and XML to support web
service calls using the SOAP protocol?


Options are :

  • JSP
  • JAXM
  • EJB
  • JavaMail
  • JAXB
  • JAX-RPC

Answer : JAX-RPC

Which type of primitive can be assigned a new value within a conditional expression?


Options are :

  • char
  • short
  • boolean
  • int
  • byte

Answer : boolean

Which option for javac sets the destination directory for class files?


Options are :

  • -classpath
  • -dest
  • -directory
  • -classes
  • -output
  • -d

Answer : -d

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

You are asked to create a Dog class that exposes the Dog class String name and int breed to
other code as read-only attributes, provides encapsulation, and adheres to the standard
JavaBeans naming conventions.
Which approach implements these requirements?


Options are :

  • Provide private name() and private breed() methods in the Dog class, and mark the name and breed instance variables public.
  • Provide private getName() and private getBreed() methods in the Dog class, and mark the name and breed instance variables private.
  • Provide public name() and public breed() methods in the Dog class, and mark the name and breed instance variables private.
  • Provide public getName() and public getBreed() methods in the Dog class, and mark the name and breed instance variables private.
  • . Provide public getName()/setName() and public getBreed()/setBreed() methods in the Dog class, and mark the name and breed instance variables private.

Answer : Provide public getName() and public getBreed() methods in the Dog class, and mark the name and breed instance variables private.

Which is true?


Options are :

  • . JDBC is designed to provide a bridge between servlets and EJB technology.
  • . JDBC is designed to provide a bridge between servlets and EJB technology.
  • The JDBC API is located within the java.sql and javax.sql packages
  • You must use JDBC to connect an RDBMS to a Java application.

Answer : The JDBC API is located within the java.sql and javax.sql packages

A J2EE programmer is developing components to encapsulate the business logic in a multitier
web-based application. Which J2EE technology is appropriate?


Options are :

  • servlets
  • JMS
  • JNDI
  • EJB .
  • JAX-RPC

Answer : EJB .

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

Which three are responsibilties of the business tier in a multitier web-based application with web,
business, and EIS tiers? (Choose three.)
A. to provide business logic
B. to participate in transactions
C. to generate dynamic content
D. to integrate with legacy applications
E. to process requests from web-based clients


Options are :

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

Answer : A,B,D

Given that TestClass relies on classes in the someJar.jar file in /some/dir, which javac invocation
will correctly compile TestClass in the current directory?


Options are :

  • javac -classpath /some/dir/someJar.jar ./TestClass.java
  • javac -classpath /some/dir/someJar.jar ./TestClass
  • javac -classpath someJar.jar -sourcepath . TestClass.java
  • javac -classpath /some/dir/*.jar *.java
  • javac ./*.java

Answer : javac -classpath /some/dir/someJar.jar ./TestClass.java

Which Java technology provides a standard API for a publish-subscribe messaging model?


Options are :

  • UDDI
  • JAX-RPC
  • JNDI
  • JSP
  • JMS

Answer : JMS

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

Which Java technology provides a standard API for relational database access?


Options are :

  • JNDI
  • JDC
  • JSP
  • JDBC
  • JMS

Answer : JDBC

Given: 1. public class Foo { 2. public static void main() { 3. System.out.println("Hello."); 4. } 5.
} Which is true?


Options are :

  • The class Foo will run successfully when invoked with the command line java Foo, and will print "Hello."
  • An exception occurs at runtime when class Foo is invoked with the command line java Foo.
  • The class Foo will run successfully when invoked with the command line: java Foo, but will produce no output.
  • Compilation fails.

Answer : An exception occurs at runtime when class Foo is invoked with the command line java Foo.

What type of relationship is needed to represent the relationship between students and the
courses they are enrolled in at a university?


Options are :

  • a one-to-many composition
  • a one-to-many association
  • a one-to-one association
  • a many-to-many composition
  • a one-to-one composition
  • a many-to-many association

Answer : a many-to-many association

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

1. class Exam {
2. private int num = 0;
3. public int getNum() {
4. return num;
5. }

6. }
7. public class Sample {
8. public static void main(String[] args) {
9. Exam e = new Exam();
10. e.num = 100;
11. int num = e.getNum();
12. System.out.println("The number is: " + num);
13. }
14. }

What is the result?



Options are :

  • The number is: 100
  • An exception is thrown at runtime.
  • The number is: 0
  • Compilation fails.

Answer : Compilation fails.

Which four are primitive integer types in Java? (Choose four.)
A. int
B. byte
C. long
D. short

E. float
F. nibble
G. double



Options are :

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

Answer : A,B,C,D

Which two are true about stateless session beans? (Choose two.)
A. They CANNOT hold client state.
B. They implement the JMS API.

C. They are used to implement business logic.
D. They are used to represent data stored in an RDBMS



Options are :

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

Answer : A,C

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

Which two are associated with the business tier in a J2EE web-based application? (Choose two.)
A. JSP
B. HTML
C. servlets
D. entity beans
E. stateless session beans


Options are :

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

Answer : D,E

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions