"A script enabled browser is required for this page to function properly"

Sun Certification

Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0

Sample Questions

SECTION: 1: 1: Fundamental Object-Oriented Concepts
OBJECTIVE: 1.1: Describe, compare, and contrast primitives (integer, floating point, boolean, and character), enumeration types, and objects.
1) You are creating a space flight simulation for a start-up aeronautics company.  This simulation program must calculate the orbital mechanics and display the flight path on a graphics screen.

What type of data is most appropriate for calculating the orbital mechanics equations?
a) pixel
b) boolean
c) integer
d) floating point (*)
e) enumerated type

REFERENCE:
Option A is incorrect because a pixel cannot be used to calculate orbital mechanics equations.
Option B is incorrect because a boolean type cannot be used to calculate orbital mechanics equations.
Option C is incorrect because an integer type cannot be used to calculate orbital mechanics equations.
Option D is correct because floating point numbers are ideal for calculating orbital mechanics equations.
Option E is incorrect because an enumerated type cannot be used to calculate orbital mechanics equations.

OBJECTIVE: 1.4: Describe information hiding (using private attributes and methods), encapsulation, and exposing object functionality using public methods; and describe the JavaBeans conventions for setter and getter methods.
2) Which two are required for proper information hiding?  (Choose two.)
a) All attributes must be marked with hidden.
b) All attributes must be marked with private. (*)
c) Internal methods must be marked with hidden.
d) Internal methods must be marked with private. (*)
e) All attributes must be given public accessor and mutator methods.
f) All attributes must be given exposed accessor and mutator methods.

REFERENCE:
Option A is incorrect because hidden is NOT a valid attribute modifier.
Option B is correct because a well-encapsulated class must have all of its attributes marked private.
Option C is incorrect because hidden is NOT a valid method modifier.
Option D is correct because a well-encapsulated class must hide all internal methods. This is because this is NOT part of the class's public interface.
Option E is incorrect because NOT all attributes require accessor or mutator methods.
Option F is incorrect because exposed is NOT a valid method modifier.

SECTION: 2: 2: UML Representation of Object-Oriented Concepts
OBJECTIVE: 2.2: Recognize the UML representation of class associations, compositions, association multiplicity indicators, and association navigation indicators.
3) Which two are true? (Choose two.)
a) The multiplicity on the endpoint for class B is undefined. (*)
b) The multiplicity on the endpoint for class B is implicitly one.
c) The arrow between class A and class B is an inheritance relationship.
d) An instance of class A will have a means to navigate to an instance of class B. (*)

REFERENCE:
UML v2.0 specification, section 7.3.32.
UML v2.0 specification, page 41.
Option A is correct because if an endpoint does NOT have a multiplicity indicator, which means that the multiplicity is undefined.
Option B is incorrect because there are no implicit multiplicity indicators in UML. If the multiplicity indicator is missing, that means it is undefined.
Option C is incorrect because the arrowhead indicates navigation. The arrowhead for inheritance is a triangular.
Option D is correct because the arrowhead pointing to class B is the navigation indicator.

EXHIBIT:

SECTION: 3: 3: Java Implementation of Object-Oriented Concepts
OBJECTIVE: 3.2: Develop code that declares concrete classes, abstract classes, and interfaces, code that supports implementation and interface inheritance, code that declares instance attributes and methods, and code that uses the Java access modifiers: private and public.
4) Which valid Java code implements this UML class diagram?
a)
1. class MyClass {
2. - x : int;
3. - y : int;
4. + z : int;
5. - ch : char;
6. + vel : float;
7. + acc : float;
8. }

b)
1. class MyClass {
2. private x : int;
3. private y : int;
4. public z : int;
5. private ch : char;
6. public vel : float;
7. public acc : float;
8. }

c)
1. class MyClass {
2. - int x;
3. - int y;
4. + int z;
5. - char ch;
6. + float vel;
7. + float acc;
8. }

d)
1. class MyClass {
2. private int x;
3. private int y;
4. public int z;
5. private char ch;
6. public float vel;
7. public float acc;
8. }
(*)
e)
1. class MyClass {
2. private:
3. int x;
4. int y;
5. char ch;
6. public:
7. int z;
8. float vel;
9. float acc;
10. }

REFERENCE:
Option A is incorrect because the structure of the attribute declarations is wrong. Java syntax does NOT match UML syntax.
Option B is incorrect because the structure of the attribute declarations is wrong.
Option C is incorrect because the structure of the attribute declarations is wrong. Java syntax does NOT match UML syntax.
Option D is correct because this is the proper Java to implement this UML diagram.
Option E is incorrect because the private and public keywords need to precede every attribute declaration. This is actually C++ syntax.

EXHIBIT:

SECTION: 4: 4: Algorithm Design and Implementation
OBJECTIVE: 4.3: Given an algorithm as pseudo-code, develop method code that implements the algorithm using conditional statements (if and switch), iteration statements (for, for-each, while, and do-while), assignment statements, and break and continue statements to control the flow within switch and iteration statements.
5) Which statement declares a floating point variable and assigns it the initial value of 100?
a) float var = 100.0;
b) float var = 100.0F; (*)
c) var : float = 100.0;
d) var : float = 100.0F;

REFERENCE:
Option A is incorrect because the value 100.0 is double by default. The value token must be cast to a float or marked as a float with a trailing F character.
Option B is correct because this is the proper Java syntax for floating point variable declaration and values.
Option C is incorrect because this is UML syntax, NOT Java syntax.
Option D is incorrect because this is UML syntax, NOT Java syntax.

OBJECTIVE: 4.6: Develop code that uses the concatenation operator (+), and the following methods from class String: charAt, indexOf, trim, substring, replace, length, startsWith, and endsWith.
6) Given:
x = "abcedfghijklmnopqrstuvwxyz"
y = "lmno"

Which line of code will remove the y string from the x string, and store it in the z variable?
a) z = x - y
b) z = x.remove(y)
c) z = x.substract(y)
d) z = x.replace(y, "") (*)

REFERENCE:
Option A is incorrect because the - operator is NOT valid on string arguments.
Option B is incorrect because there is no remove method in the String class.
Option C is incorrect because there is no subtract method in the String class.
Option D is correct because the replace method removes the character sequence in the first argument and replaces it with the character sequence in the second argument.

SECTION: 5: 5: Java Development Fundamentals
OBJECTIVE: 5.3: Describe the purpose and types of classes for the following Java packages: java.awt, javax.swing, java.io, java.net, java.util.
7) Which package contains APIs that are useful for distributed programming and communication?
a) java.awt
b) java.net (*)
c) java.util
d) javax.swing

REFERENCE:
Java SE API documentation.
Option A is incorrect because the java.awt package contains GUI-related classes.
Option B is correct because the classes for TCP and UDP communication are contained in the java.net package.
Option C is incorrect because the java.util package contains utility classes, such as the Collections API.
Option D is incorrect because the javax.swing package contains GUI-related classes.

SECTION: 6: 6: Java Platforms and Integration Technologies
OBJECTIVE: 6.3: Describe at a high level the benefits and basic characteristics of JDBC, SQL, and RDBMS technologies.
8) Which two technologies (boxes H and I) are the primary components of the database tier? (Choose two.)
a) SQL (*)
b) HTTP
c) JDBC
d) RDBMS (*)
e) JavaBeans
f) Entity beans

REFERENCE:
Option A is correct because SQL is used in the database tier.
Option B is incorrect because HTTP is a communication protocol between the web browser and web container.
Option C is incorrect because JDBC is NOT used in the database tier. It is used by the web or EJB containers to interact with the database tier.
Option D is correct because RDBMS is used in the database tier.
Option E is incorrect because JavaBeans is NOT used in the database tier.
Option F is incorrect because Entity beans are NOT used in the database tier.

EXHIBIT:

SECTION: 7: 7: Client Technologies
OBJECTIVE: 7.2: Describe at a high level the basic characteristics, benefits, drawbacks, and deployment issues related to creating clients using J2ME midlets.
9) Which two types of applications are appropriate for J2ME?  (Choose two.)
a) games (*)
b) word processing
c) remote data collection (*)
d) air traffic control system

REFERENCE:
Option A is correct because the J2ME platform supports a specific gaming API.
Option B is incorrect because most J2ME devices do NOT have large enough screens to handle word processing applications.
Option C is correct because J2ME (and the small devices on which it runs) is ideal for remote data collection, such as inventory control applications.
Option D is incorrect because J2ME is NOT a good choice to build a large scale real-time system.

SECTION: 8: 8: Server Technologies
OBJECTIVE: 8.2: Describe at a high level  the basic characteristics of servlet and JSP support for HTML thin-clients.
10) Which describes the role of servlet developer?
a) a Java programmer who creates programs that execute on cell phones
b) a Java programmer who creates classes that respond to HTTP requests (*)
c) a web designer who generates dynamic web pages to create user interfaces
d) a Java programmer who creates components that represent data in a relational database

REFERENCE:
Option A is incorrect because this definition describes a MIDlet developer.
Option B is correct because this definition does describe a servlet developer. That is, servlets are components that handle HTTP requests.
Option C is incorrect because this definition describes a JSP developer.
Option D is incorrect because this definition describes an entity bean developer.