Collaborative Tools Java Test Answers

Best answers, in my opinion, are in red. All answers can be found in the
Bruce Eckel chapters from Thinking in Java or from the Java Primer with the exception of lecture
presented material.

1.  The Java packages have always been intended to work as 
    (circle the letter before the one best answer)

a.	a compiled programming language written close to the machine architecture
b.	an interpreted programming language written close to the machine architecture
c.	a compiled programming language with a high-level abstraction from machine architecture
d.	an interpreted programming language with a high-level abstraction from machine architecture
e.	an intermediary language compiled to byte code and interpreted to the machine architecture

2.  Which of the following is the best benefit of using object-oriented instead of procedural programming?
    (circle the letter before the one best answer)

a.	Object-oriented programs tend to be smaller than procedural ones
b.	Object-oriented programs tend to allow easier reuse of coding solutions and facilitate evolution into design patterns
c.	Object-oriented programs tend to align better with machine architecture
d.	Object-oriented programs tend to be more sequential than procedural ones

4.  Which one of the following statements is true regarding the following boldfaced Java code segment?
    (circle the letter before the one best answer)

package store;
class  FittingRoom { }

a.	The FittingRoom class is public to both store package classes and restaurant package classes
b.	The FittingRoom class is private to both store package classes and restaurant package classes
c.	The FittingRoom class is public to store package classes and private to restaurant package classes
d.	The FittingRoom class is public to restaurant package classes and private to store package classes

5.  Which of the following are from Alan Kay's rules for pure object-oriented languages? 
    (circle the letter before all correct answers)

a.	Everything is an object
b.	Each object has a memory model of other objects
c.	Each object has a type
d.	Each object method returns an object
e.	A program consists of objects telling other objects what to do by sending messages

6.  Which Java library interface defines the programming contract for declaring a class that runs in its own         	programming thread?
    (circle the letter before the one best answer)

a.	Runnable
b.	Separatable
c.	Serializable
d.	Synchronizable
e.	Encapsulatable

7.  Which of the following statements are true regarding the boldfaced Java program statement?
    (circle all the letters before correct answers)

static int session_id = 24903;

a.	All objects that encapsulate this session_id attribute will always share the same value
b.	The session_id variable can not change its value after an object is created with its attribute
c.	The session_id variable can not change its type after an object is created with its attribute
d.	The session_id variable will be stored in a single integer-sized memory location no matter how many different objects are created with its attribute

8.	Match the concept on the left with its best definition on the right
	(place one letter in each underlined space on the left)

_d_ Design Pattern  a. a programming tool for encapsulating the programmer's contract 
_a_ Interface       b. a defining template for creating objects of identical type
_e_ Framework       c. a Java keyword for grouping multiple types into a reusable folder
_c_ Package         d. a reusable solution that evolves from studying many systems of diverse application areas
_b_ Class           e. a bundle of packages for use in solving problems within a specific application area 

9. Match the class associated with project 1 on the left with its purpose on the right
   (place one letter in each underlined space on the left)

_d_ Dispatcher		a. to manage and control proper functioning inside of the Web browser
_a_ Applet		b. to manage and control the type of data encapsulated inside messages
_c_ ClientThread	c. to manage and control communication with the networking socket
_b_ VField		d. to reliably manage the sharing of program data between the networking layer and the application layer

10. What of the following are benefits of incorporating a garbage collector into a Java system? 
    (circle the letter before all correct answers)

a.	The programmer is no longer responsible for deleting unused objects and is therefore not likely to create memory leaks in programs
b.	The programmer is no longer responsible for caching file system accesses and is therefore not likely to waste hard drive space
c.	The programmer can no longer write unreachable code statements and therefore writes more understandable code
d.	The programmer can let the system server worry about client local memory management and therefore ignore memory issues altogether
 
11. What is the significance of the following boldfaced Java code?
    (circle the letter before the one best answer)

class VFieldInputDataStream extends InputDataStream {

a.	a VFieldInputDataStream class is being declared that will have all the data storage and services that an InputDataStream contains plus that which is added after the { symbol.
b.	the VFieldInputDataStream class declares all methods required by the InputDataStream interface declaration.
c.	the VFieldInputDataStream class declares all methods recommended by the InputDataStream interface declaration.

12.	What is the significance of the following piece of boldfaced Java code?
        (circle the letter before the one best answer)

class VFieldInputDataStream implements Serializable {

a.	a VFieldInputDataStream class is being declared that will provide all the data storage and services that a Serializable contains. 
b.	the VFieldInputDataStream class declaration declares all methods required by the Serializable interface declaration.
c.	the VFieldInputDataStream class declaration declares all methods recommended by the Serializable interface declaration.

13.	According to Bruce Eckel, what is the proper sequence of events to take place in the analysis and design of an         object-oriented program solution.
        (place the letters in the blanks in the order of their recommended sequence)

     d then b then e then a then c (and perhaps eventually a design pattern) .

a.	System Extension
b.	Object Assembly
c.	Object Reuse
d.	Object Discovery
e.	System Construction

13. Object-oriented programming techniques align well with which of the following societal trends?
    (circle the letter before all correct answers)

a.	More discussion of programming problems with less consideration of machine architecture
b.	More structure for solving programming problems built into programming language libraries
c.	More emphasis on considering natural systems when solving computing systems problems
d.	More focus on computing systems performance compared to program understandability
e.	Further geographical distribution of programming team members
 
14. Each object encapsulates its data and processing to only allow minimal access by other objects. 
    The most common way to protect an object variable from damage by other objects is to:
    (circle the letter before the one best answer)

a.   declare the variable private and provide limited public functions to access it.
b.   declare the variable public and provide limited private functions to access it.
c.   declare the variable hidden and use a subclass to access it.
d.   declare the variable hidden and use a public interface to access it.

15. What three networking objects are most critical to programming a client connection to a server:
    (circle the letter before the one best answer)

a.   A socket, the server address, and a port.
b.   A socket, the server address, and a subdirectory.
c.   The server address, a port, and a subdirectory.
d.   A socket, a port, and a subdirectory.

16.  Match the line of Java code on the left with its most likely purpose on the right.
     (place one letter in each underlined space on the left)

_b_ husky = new Husky();	a. to tell others that the husky has done something.
_d_ husky.bark();		b. to increase the value of a husky attribute.
_c_ husky.health++;		c. to instantiate a husky object on the heap (in memory).
_a_ announce(Husky.WOOF);	d. to perform a service the husky object can perform.

17. Which of the following are reasonable and valuable features of a language organized with 
    packages (and, in fact, are all features of Java):

a.   the ability to import classes from the different packages into a client program.
b.   available interface technology that specifies how package classes should be implemented.
c.   the ability to adapt package classes for slightly different use than currently available.
d.   the ability to verify proper use of package classes at compile time
e.   the ability to create automated documentation just by using language keywords and syntax.