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

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 :

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

Answer : A,B,C,D

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

Which three can be included in an interface declaration? (Choose three.)
A. void showMessage();
B. public void showMessage();
C. static void showMessage();
D. private void showMessage();
E. abstract void showMessage();
F. protected void showMessage();
G. public void showMessage() {
System.out.println("Hello.");
}


Options are :

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

Answer : A,B,E

Which is NOT associated with the web tier in a J2EE web-based application?


Options are :

  • JNDI
  • JavaBeans
  • message-driven beans
  • JavaMail
  • HTML

Answer : message-driven beans

Which two describe benefits of encapsulation? (Choose two.)
A. Code is more efficient because attributes of the class can be accessed directly by other
classes, without the overhead of going through
access methods.
B. Code is more reusable because the attributes of the class are protected from direct modification
by other code.
C. Code is more useful because attributes of the class can be accessed by other classes for both
reading and writing.
D. Code is safer because attributes of the class CANNOT be directly modified by code outside the
class.
E. Code is more flexible because the attributes can be modified directly from code in other
packages.


Options are :

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

Answer : B,D

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

Which two are benefits of JSP technology? (Choose two.)
A. portability to any HTTP server
B. simplified Swing GUI development
C. separation of dynamic and static content
D. separation of servlet developer and JSP author roles


Options are :

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

Answer : C,D

You are asked to create code that defines a Beverage, and includes method implementation code
for some beverage behaviors. Beverage subtypes will be required to provide implementations of
some, but not all, of the methods defined in Beverage.
Which approach correctly implements these goals?


Options are :

  • Create an abstract Beverage class that defines both abstract and concrete methods.
  • Create a Beverage interface that all beverage subtypes must implement.
  • Create a concrete Beverage class that defines both abstract and concrete methods.
  • Create an abstract Beverage class that defines only abstract methods.

Answer : Create an abstract Beverage class that defines both abstract and concrete methods.

Which two are advantages of using J2EE server-side technologies in a web-based application?
(Choose two.)
A. scalability
B. complexity
C. network latency
D. monolithic design
E. separation of concerns


Options are :

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

Answer : A,E

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

1. public class Boat{
2. // insert code here
3. public void setGas(int v){
4. gas = v;
5. }
6. }
Which, inserted at line 2, is valid and demonstrates encapsulation?


Options are :

  • struct int gas;
  • public int gas;
  • private int gas;
  • protected int gas

Answer : private int gas;

Which correctly declares a class Test in package com.example?


Options are :

  • package com.example; public class Test { // some code here }
  • public class com.example.Test { // some code here
  • import com.example; public class Test { // some code here }
  • package com.example { class Test { // some code here }

Answer : package com.example; public class Test { // some code here }

Given:
17. class B { }
Which demonstrates inheritance?


Options are :

  • . class A this B { }
  • class A super B { }
  • class A implements B { }
  • class A extends B { }

Answer : class A extends B { }

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

Which two are true about composition relationships? (Choose two.)
A. Composition relationships can be one-to-many.

B. Composition relationships are never one-to-many.
C. Composition relationships are always many-to-many.
D. Composition relationships are used to show exclusive ownership.
E. Composition relationships are never used when an object is owned by exactly one other object.


Options are :

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

Answer : A,D

1. class X {
2. private Y y;
3. public X(Y y) { this.y = y; }
4. }
5. class Y {
6. private X x;
7. public Y() { }
8. public Y(X x) { this.x = x; }
9. }

The instance variable y is intended to represent the composition relationship "X is composed of Y."
Which code correctly maintains this meaning?



Options are :

  • X x1 = new X(new Y()); X x2 = new X(new Y());
  • Y yy = new Y(); X x1 = new X(yy); X x2 = new X(yy);
  • X xx = new X(null); Y y1 = new Y(xx); Y y2 = new Y(xx);
  • Y y1 = new Y(new X(null)); Y y2 = new Y(new X(null));

Answer : X x1 = new X(new Y()); X x2 = new X(new Y());

3. int calc() {
4. long x = 40L;
5. int i = 30;
6. i = x;
7. System.out.println("result is: " + i);
8. }
What is the result of calling calc()?


Options are :

  • result is: 40
  • Compilation fails because of an error at line 6.
  • result is: 30
  • Compilation fails because of an error at line 4.

Answer : Compilation fails because of an error at line 6.

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

Which two are valid examples of interface implementation? (Choose two.)
A. class C extends D { }
B. class C implements D { }
C. class C extends D, E { }
D. class C implements D E { }
E. class C implements D, E { }
F. class C extends D, implements E { }


Options are :

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

Answer : B,E

Which three are valid? (Choose three.)
A. int j = 'A';
B. int i = 10L;
C. int num = 3.14;
D. int flag = true;
E. byte b = 10;
int i = b;
F. double d = 5.0;
int n = (int)d;


Options are :

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

Answer : A,E,F

Which two are true? (Choose two.)
A. A source file can have from zero to many import statements.
B. An import statement is associated with only one class in a source file.
C. If a source file has one import statement, it must be preceded by a package statement.
D. A single import statement can be used to simplify access to several classes in the Java API.
E. A single import statement can be used to simplify access to several packages in the Java API.


Options are :

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

Answer : A,D

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

Which two are benefits when appropriately using polymorphism? (Choose two.)
A. code that is faster at runtime
B. code that is more efficient at runtime
C. code that is more dynamic at runtime
D. code that is more flexible and reusable
E. code that is protected from extension by other classes


Options are :

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

Answer : C,D

Which two are true? (Choose two.)
A. Classes in the java.awt package are used to paint objects on canvases.
B. Classes in the java.awt package inherit many behaviors from classes in the java.swing
package.
C. Classes in the javax.swing package provide support for complex GUI components, such as
tables and trees.
D. Classes in the java.awt package are designed to provide lightweight components that work the
same across different platforms


Options are :

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

Answer : A,C

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


Options are :

  • char
  • int
  • byte
  • short
  • boolean

Answer : boolean

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

Which two are true? (Choose two.)
A. The servlet API is included in J2SE.
B. A servlet is a Java class that executes within a web browser.
C. The javax.servlet package contains part of the servlet API.
D. A servlet is a Java class that executes within a web container.
E. A servlet is an open source framework developed for creating web applications


Options are :

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

Answer : C,D

Which three are legal ways to declare and initialize an instance variable? (Choose three.)
A. static int x = 42;
B. public int x = 'c';
C. public int x = null;
D. public Integer f = null;
E. static Integer f = new Integer(42);
F. public Integer f = new Integer(42);


Options are :

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

Answer : B,D,F

Which four are primitive data types? (Choose four.)

A. int
B. null
C. long
D. char
E. short
F. String
G. Integer


Options are :

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

Answer : A,C,D,E

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

Which two are provided by the JNDI API? (Choose two.)
A. an interface to query directory services using SQL
B. a service-provider interface to attach providers of directory services
C. an application-level interface used by the application components to access naming services
D. a framework for handling data in different MIME types, originating in different formats and
locations


Options are :

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

Answer : B,C

Which two are NOT Enterprise Beans? (Choose two.)
A. JavaBeans
B. entity beans
C. session beans
D. business beans
E. message-driven beans


Options are :

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

Answer : A,D

Which J2EE technology is used to generate dynamic content for web-based applications?


Options are :

  • JAX-RPC
  • JSP
  • SOAP
  • JNDI
  • JMS

Answer : JSP

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

1. // insert code here
2. void play();
3. void stop();
4. }
5. // insert code here
6. public void play() { }
7. public void stop() { }
8. }

Which, inserted at lines 1 and 5, allows the code to compile?


Options are :

  • 1. abstract class Player { 5. class DVDPlayer extends Player {
  • 1. interface Player { 5. class DVDPlayer implements Player {
  • 1. class Player { 5. interface DVDPlayer implements Player {
  • 1. implements Player { 5. class DVDPlayer interface Player {
  • 1. interface Player { 5. class DVDPlayer extends Player {

Answer : 1. interface Player { 5. class DVDPlayer implements Player {

1. interface A { }
2. interface B { void b(); }
3. interface C { public void c(); }
4. abstract class D implements A,B,C { }
5. class E extends D {
6. void b() { }

7. public void c() { }
8. }
Which is true?



Options are :

  • Compilation fails due to an error in line 2.
  • Compilation fails due to an error in line 6.
  • Compilation fails due to an error in line 4.
  • The code compiles without error.
  • Compilation fails due to an error in line 1.

Answer : Compilation fails due to an error in line 6.

3. interface Pet {
4. void eat();
5. }
6. class Dog implements Pet { public void eat() { } }
7. class Beagle extends Dog { public void eat() { } }
Which demonstrates the "program to an interface" principle?



Options are :

  • class PetFood { public void go(Beagle b) { b.eat(); }
  • class PetFood { public void go(Beagle b) { b.eat(); }
  • class PetFood { public void go(Beagle b) { b.eat(); }
  • class PetFood { public void go(Dog d) { d.eat(); }
  • class PetFood { public void go(Pet p) { p.eat(); }

Answer : class PetFood { public void go(Pet p) { p.eat(); }

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

11. public class Employee {
12. public String name;
13. // insert code here
14.
15. public String getName() {
16. return name;
17. }
18.
19. public int getSalary() {
20. return salary;
21. }
22. }
Which, when inserted at line 13, allows another class to get the value of the salary variable, but
NOT change the value of the salary variable?


Options are :

  • public int salary;
  • private int salary;
  • readOnly int salary;
  • hidden int salary;
  • secure int salary;

Answer : private int salary;

11. class A {
12. public void methodX(int i) { /* some code */ }
13. public String methodY(String s) { /* some code */ }
14. }
15. class B extends A {
16. public void methodX(int i) { /* some code */ }
17. public String methodX(String s) { /* some code */ }
18. public String methodY(String s) { /* some code */ }
19. }

Which two are true? (Choose two.)
A. The methodX(int) in class B overrides methodX(int) in class A.
B. The methodX(String) in class B overrides methodX(int) in class A.
C. The methodX(int) in class A overloads methodX(String) in class B.
D. The methodY(String) in class B overrides methodY(String) in class A.
E. The methodY(String) in class B overloads methodY(String) in class A.


Options are :

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

Answer : A,D

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions