Learn About Sun Certified Associate for the Java Platform

These practice test questions from MeasureUp are based on Sun's exam CX-310-019: Sun Certified Associate for the Java Platform , Standard Edition, Exam Version 1.0.

The audience for this exam includes individuals who develop applications that are based on the Java platforms and individuals who manage software development projects that use Java technologies.

To prepare for this exam, you should become familiar with object-oriented programming concepts and with Java platforms and client and server technologies.

Candidates who pass exam CX-310-019 earn the Sun Certified Java Associate (SCJA) certification.

FYI: One of the reference products used in these questions is a book. Here are the details for the book:

Object-Oriented Modeling and Design with UML
Publisher: Prentice Hall
ISBN: 81-203-3016-1

Another reference product is an e-learning course:

Java Programming with J2SE 5
Publisher: SkillSoft
URL: http://www.skillport.com/catalog/courses.asp?oid=5001568&pid=5000434&sid=200030&cid=5013155
 

Objective: Fundamental Object-Oriented Concepts.
SubObjective: Describe, compare and contrast concrete classes, abstract classes and interfaces, and how inheritance applies to them.

Single answer, multiple choice.

Which statement is true about concrete classes?

A.    Class methods and variables of a class can be accessed by an object of a class.
B.    A concrete class cannot be instantiated.
C.    A concrete class can inherit multiple abstract classes.
D.    Instance methods and variables of a class can only be accessed by an object of a class.

Answer:
D

Tutorial:
Instance methods and variables of a class can only be accessed by an object of a class. All the nonstatic methods and variables are known as instance methods and variables, respectively. To access nonstatic methods, you have to create an instantiated object. A nonstatic method or variable cannot be directly accessed through class name.

Class methods and variables of a class cannot be accessed through an object of a class. All static methods and variables are known as class methods and variables, respectively. Class methods and variables cannot be accessed through instantiated objects. You can access static methods or class methods directly by using the class name.

A concrete class can be instantiated. You can create instance objects of a concrete class. Using these instance objects, you can access instance methods or nonstatic methods of a class.

A concrete class cannot inherit multiple abstract classes. A class can implement multiple interfaces but can inherit or extend at most one class.

References:
Classes and methods: Classes, objects and messages in Java
Java Programming with J2SE 5
Creating Classes in Java

Objective: UML Representation of Object-Oriented Concepts.
SubObjective: Recognize the UML representation of class associations, compositions, association multiplicity indicators and association navigation indicators.

Single answer, multiple choice.

A person is an employee with respect to a company. A company is an employer with respect to the person. The person can be unemployed but cannot work with more than one company at a given point of time. A company can have many employees.

Which Unified Modeling Language (UML) class diagram correctly represents the WorksFor association between the Person and Company classes with association end names?

 

 
Answer:
C

Tutorial:
The UML class diagram C represents the WorksFor association between Person and Company classes with association end names. The diagram represents the relationship between the Person and Company classes where a person is represented as an Employee and a company as Employer using the association end names. The diagram also represents multiplicity constraints in which many persons can work for none or at most one company. A person cannot be associated with more than one company, and it is also possible that the person is not working for any company. The diagram represents the association between Person and Company classes with the name WorksFor.

Diagram A is incorrect. According to the requirement, a person should be an Employee, and a company should be an Employer, which is not represented correctly in this diagram. Additionally, the diagram does not represent any association multiplicity.

Diagram B is incorrect. According to the requirement, a person cannot work with more than one company.

Diagram D is incorrect. According to the requirement, the person can be unemployed or can work with at most one company. Therefore, the Person class should display a 0 or 1 association multiplicity with the Company class.

References:
Link and Association Concepts
Object-Oriented Modeling and Design with UML
Chapter 3: Class Modeling

Objective: Algorithm Design and Implementation.
SubObjective: Given an algorithm as pseudo-code, develop method code that implements the algorithm.

Single answer, multiple choice.

The exhibit shows a Java program with a set of iteration and conditional statements.

What will be the output of the program?

A.    0, 2, 4, 8,10
B.    0, 2, 4
C.    0, 2, 4, 6, 8, 10
D.    2, 4, 6, 8
E.    2, 4, 6, 8, 10

Answer:
A

Tutorial:
The program will display the following output:
0, 2, 4, 8, 10

The program implements a for loop that initializes with 0 and will run until it reaches 10 with a step value of 2. So, the variable i will always store an even value. The for loop has two if conditions and a print statement. The first if statement will break the loop if the value of variable i reaches 5, but this will never happen because the variable i will always store even values. The second if condition will return to the beginning of the innermost enclosing loop without completing the rest of the statements in the body of the loop. Therefore, the loop will skip the value 6.

The following output is incorrect:
0, 2, 4

According to the program, the for loop should run from values 0 to 10 with a step value of 2. The for loop will not break at the first if condition because the variable i will always hold even values and the condition that the value of i should be 5 will never be met.

The following output is incorrect:
0, 2, 4, 6, 8, 10

The program will satisfy the second condition and will return to the beginning of the innermost enclosing loop without completing the rest of the statements in the body of the loop. Therefore, the loop will skip the value 6 and will not generate the output given in this option.

All the other options are incorrect because the for loop will start from the value 0 and therefore the output should include 0. Additionally, the program will satisfy the second condition and will return to the beginning of the innermost enclosing loop without completing the rest of the statements in the body of the loop. Therefore, the loop will skip the value 6.

References:
Controlling program flow: The Java for loop construct
Java Programming with J2SE 5
Operators and Flow Control in Java

Controlling program flow: Selection statements in Java
Java Programming with J2SE 5
Operators and Flow Control in Java

Objective: Java Platforms and Integration Technologies.
SubObjective: Describe at a high level the benefits and basic characteristics of RMI.

Single answer, multiple choice.

Which statement is true regarding Remote Method Invocation (RMI)?

A.    RMI uses the same port to communicate between client and server.
B.    RMI uses low-level sockets to invoke remote machines.
C.    RMI is an example of the client/server model.
D.    RMI isolates clients from servers by a well-defined encapsulating interface.

Answer:
D

Tutorial:
RMI isolates clients from the server by a well-defined encapsulating interface. RMI provides a distributed object system to develop distributed Java applications. You can easily develop distributed applications by using RMI instead of using sockets for the same purpose. RMI does not design a protocol to communicate between client and server. RMI defines and implements the remote interface, develops client/server applications, generates stubs and skeletons, compiles the server and client, and starts the RMI registry.

RMI does not use any port to communicate between client and server. In RMI, a client sends a message to an object that interprets the message to decide what to do and which service to perform. A client/server model uses ports to communicate between client and server.

RMI does not use low-level sockets to invoke remote machines. RMI isolates the client from the server by a well-defined encapsulating remote interface. A client/server model uses low-level sockets to establish communication between client and server.

RMI is not an example of the client/server model. RMI is an example of a distributed object-based system. In the client/server model, a client interacts with the server by using low-level sockets and the same set of protocols. RMI uses a distributed object-based system to establish communication between client and server.

References:
Distributed Java Programming with RMI and CORBA
Java.sun.com
http://java.sun.com/developer/technicalArticles/RMI/rmi_corba/

Objective: Client Technologies.
SubObjective: Describe at a high level the basic characteristics of servlet and JSP support for HTML thin-clients.

Multiple answers, multiple choice.

Which statements are true regarding servlets and Java Server Pages (JSP)? (Choose two.)

A.    During the translation phase, JSP pages are converted to a servlet source.
B.    During the translation phase, servlets are converted to JSP pages.
C.    Servlets and JSP pages are compiled into class files.
D.    Servlets, not JSP pages, are compiled into class files.
E.    The translation phase is carried out each time a Web server receives an incoming request for the JSP page.
F.    The translation phase is carried out each time a Web server receives an incoming request for the servlet page.

Answers:
A, D

Tutorial:
The following statements are correct regarding servlets and JSP:

* During the translation phase, JSP pages are converted to a servlet source.
* Servlets, not JSP pages, are compiled into class files.

During the translation phase, JSP pages are converted to a servlet source, and then the converted servlet code is compiled into a class file. The translation phase is carried out by the JSP engine.

The translation phase does not convert the servlets to JSP pages. The translation phase is carried out by the JSP engine, which converts JSP pages to a servlet source.

Servlets and JSP pages are not compiled into class files. The JSP engine converts JSP pages to servlets, and the converted servlet code is compiled into a class file.

The option stating that the translation phase is carried out each time a Web server receives an incoming request for the JSP page is incorrect. The translation phase is carried out for the first time when it receives an incoming request for the JSP page.

The option stating that the translation phase is carried out each time a Web server receives an incoming request for the servlet page is incorrect. The JSP engine translates JSP pages to servlets. Additionally, the translation phase is carried out for the first time when it receives an incoming request for the JSP page.

References:
Servlets and JSP Pages Best Practices
Java.sun.com
http://java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/  

Like what you see? Share it.Google+LinkedInFacebookRedditTwitterEmail
cmadmin

ABOUT THE AUTHOR

Posted in Certification|

Comment: