You are on page 1of 21

If the run() method is directly invoked on a hread bject, an exception is thrown at <BR> runtime.ime.

(***) A Menu can be added to a Menu, a MenuItem can be added to a Menu. (***) All of them (***) RMI (***) RunHandler must implement the java.lang.Runnable interface. (***) The doStuff method will never be executed. (***) The variable should be marked protected (***) This program does not compile (***) "even" will be output for add values of x, and "odd" for even values. (***) A thread's interrupt() method results in the throwing of the BR> InterruptedException. (***) Actions cannot be used within scriptlet blocks (***) After line 9. (***) Although no error will be reported the use of the &lt;jsp:include/&gt; action means that the response object can't be used to create cookies. (***) An except would occur if no thread is waiting on the object when the notify() method is invoked on the object. (***) An exception occurs at runtime. (***) An IllegalMonitorStateException will be thrown if the wait() method is called while the current thread does not hold the lock of the object. (***) An interface that ensures that implementing classes cannot contain duplicates (***) Both Vector and Hashtable use synchronized methods to avoid problems due to more than one thread trying to access the same collection. (***) Buttons (***) Compilation and execution without error (***) Compilation fails because of an error on line 10. (***) Create an instance of the GridBagConstraints class, set the weightx field and then pass the GridBagConstraints instance <BR> with the component to the setConstraints method of the <BR> GridBagLayout class. (***) Gets a database connection with the Employee data source. (***) if there is more than one thread waiting on a condition, there is no way to predict which thread will be notifed (***) if there is more than one thread waiting on a condition, there is no way to predict which thread will be notifed (***) if there is more than one thread waiting on a condition. there is no way to predict which thread will be notifed (***) &lt;%! %&gt; (***) a configuration file (***) ACD (***) After line 10. (***) an ORDER BY clause (***) CallableStatement (***) cb3 (***) Clean compile but no output at runtime (***) Code marked with (2) is a constructor. (***) COM (***) Compilation and output of onetwoOne (***) Compilation fails. (***) Compile-time error; code error within the while loop. (***) connection pooling (***) Constructors are not inherited (***) Create a new Thread object and call the method start(). (***) Database client (***) enclosing the attribute in single quotes (***)

four one three two (***) From waiting to running. (***) getBytes() against the HttpServletrequest object (***) grant entries (***) GridBagLayout. (***) hashCode() can always return the same value, regardless of the object that invoked it. (***) http://host[:port]/path/resource_name[#section][?query_string] i - ii (***) Inserting data and updating data (***) Iterators are used to retrieve the values in a collection. (***) java.util.ArrayList (***) java.util.Hashtable (***) Java.util.StoredSet. (***) Line 21 (***) Line 9 (***) Model-View-Controller. (***) No two threads can concurrently execute synchronized methods on the same object. <BR> <BR> (***) notifyAll(); (***) object that stores the bean (***) One of the waiting threads will be allowed to execute the method, but you can't be sure which one it will be. Public boolean mouseMoved(MouseMotionEvent) (***) public void atMethod(int x){ <BR> assert(x<font face="Symbol">&#62;</font>0); <BR> (***) return (count <FONT face=Symbol>&lt;</FONT><FONT face=Symbol>&lt;</FONT> 16) ^ cumulated; return a <FONT face=Symbol>&gt;</FONT>= o.a; (***)

server (***) Server side program (***) Swing menus are components. (***) System.out.println("running"); (***) The constructor in A that takes an int as an argument will never be called as a result of constructing an object of class B or C. (* The doStuff method will never be executed. (***) The Java-ODBC bridge driver (***) The program displays test twice. (***) The program will compile without errors and will simply terminate without any output when run. (***) The RMI Registry is used to generate stubs and skeletons. (***) The set interface is designed for unique elements (***) The sleep() method should be put in the try-catch block. This is the only reason for the compilation failure. (***) This class is a top-level class: This class is a top-level class: This code will not compile. (***) This program does not compile (***) true (***) try { Thread.sleep(1000); } <BR>catch(InterruptedException e) { } (***) try{ sleep(100); } catch(InterruptedException e){ } (***) wait() (***) x5 = null; (***) Zippo (***) "abcxyzabc" (***)

&lt;%@taglib uri= tagLibraryURI prefix= tagPrefix%&gt; (***) &lt;jsp:param&gt; (***) &lt;%@ and %&gt; (***) <BR> static class CounterBehavior implements Runnable { <BR> public void run() { <BR> try{ <BR> <BR> static class CounterBehavior implements Runnable { public void run() { <BR> try{ <BR> <BR> Thread.sleep(1 000); <BR> } <BR> } catch (InterruptedException x) { } <BR> } <BR> } (***) <BR>guarantee in the order (***) 0..1..2.. (***) 0..1..2.. (***) 1 (***) 1 2 (***) 1 and 2 only (***) 1 is true, 2 is false. (***) 1 only (***) 1..2.. (***) 1099 (***) 10-point TimesRoman (***) 11 (***) 1-3-2-4 (***) 2 (***) 294083. One cannot be certain whether any of the letters i, j, and k will be printed during execution. (***) 3 (***) 4 (***) 80 (***) 80 (***) A *. class file is a compiled *.java file.ass (***) A bean class must be abstract. (***) A component may handle its own events by overriding its event-dispatching method. (***) a database driver (***) A Frame with one large button marked Four in the Centre (***) A Java-to-COM bridge (***) A program terminates when the last non-daemon thread ends. (***) A session bean can be defined without an ejbCreate() method. (***) A TextArea object may generate an ActionEvent. (***) A web server does not support caching, clustering, and load balancing. (***) abcdef (***) Add one or more event listeners to handle the events. (***) After line 16 runs (***) All of the above (***) All of the other answers (***) an array <BR> (***) An error stating that there is a duplicated metho (***) An event listener may be removed from a component (***) An exception is thrown at runtime. (***) An exception occurs at runtime. (***) an inner class (***) Applet (***)

ArrayList (***) ArrayList. (***) b is an instance of A followed by b is an instance of C. (***) backgroundThread.setPriority(1); (***) BCD (***) BeanInfo Editor (***) Boo f = new Boo() {String s; }; (***) Both is true (***) BufferedReader in = new BufferedReader(new InputStreamReader(s .getlnputStream()); (***) By implementing the Runnable interface. (***) By subclassing the Thread class. (***) By their Internet ID number (***) By using the setPriority() method in the class Thread. (***) c = b; (***) Cast v.elementAt(0) to a String. (***) cb3 (***) checked and unchecked (***) Classes have locks. (***) Code block A. (***) Collection (***) Compilation and output of the elements in the order a followed by c followed by z. (***) Compilation and run with the output "Running" (***) Compilation fails (***) Compilation fails because of an error at line 5. (***) Compilation fails because of an error at line 5. (***) Compilation fails because of an error at line 5. (***) Compilation fails because of an error on a line other than 3, 4, or 8. (***) Compilation fails because of an error on line 16. (***) Compilation fails. (***) Compilation fails. (***) Compilation fails. (***) Compile time error (***) Connection (***) Connection (***) Connection. (***) Connectionless (***) container (***) Container extends Component. (***) Cookies (***) Cookies (***) defabc (***) Definition A. (***) designing components (***) Displays a frame with a button covering the entire frame Driver (***) DriverManager (***) Ensures only one thread at a time may access a class or object (***)

Enumeration (***) Enumeration (***) Error at compile time (***) Error at compile time. (***) errorPage = &lt;error_URL&gt; (***) Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block will always <BR>start to execute. Exception (***)

Execution of the run() method ends. (***) FileDialog (***) flush (***) Foo.Bar b = f.new Bar(); (***) foobarhi (***) for(int i=1;i<font face="Symbol">&#60;</font>= 100; i++) { <BR> System.out.println(i); for(int i=1;i<font face="Symbol">&#60;</font>= 100; i++) { <BR> System.out.println(i); <BR> Thread.sleep(1 000); <BR> } <B Frame (***) getParameter (***) getParent() (***) getServletContext().log(message); (***) getSource. (***) go() (***) HashSet (***) however, it is not recommended for production use. (***) HTTP (***) HttpServletRequest (***) HttpServletResponse (***) HttpSessionContext (***) HttpSessions (***) i=6 and j=5 (***) If "Time's Up!" is printed, you can be sure that at least 10 seconds have elapsed since "Start!" was printed. (***) If "Time's Up!" is printed, you can be sure that at least 10 seconds have elapsed since "Start!" was printed. (***) If a class has synchronized code, multiple threads can still access the nonsynchronized code. (***) If a is false and be is true then the output is "ELSE". (***) If an object can be accessed from a live thread, it cant be garbage collected. (***) If multiple listeners are added to a component the events will be processed for all but with no If the hashCode() comparison != returns true, the equals() method might return true. **) if there is more than one thread waiting on a condition. there is no way to predict which thread will be notifed (***) implement the java.lang.Runnable interface. (***) Infinity <BR> -Infinity <BR> 4.4E99 (***) Instance (***) interface TheInterface implements Runnable (***) Invoking wait() on an object whose lock is held by the current thread will relinquish the lock. (***) is an object file (***) is created by calling a Thread constructor. (***) It can access private instance variables in the enclosing object. (***) It can be marked abstract. (***) It can extend exactly one class or implement exactly one interface. (***)

It can perform a virus scan on your applications. (***) It guarantees that delivery of your confidential files will not be altered during transmission. (***) It is an active object (***) It is illegal at compilation. (***) It is slow. (***) It uses the AWT event delegation model. (***) iterator (***) Java Database Connectivitive (***) Java Server Pages (***) java.awt.Container (***) java.lang.StringBuffer (***) java.rmi.registry package (***) java.sql (***) java.sql (***) java.text package (***) java.util.EventObject (***) java.util.LinkedHashMap (***) java.util.TreeMap (***) javax.http.Cookie (***) javax.servlet (***) javax.servlet.jsp.tagtext (***) JDBC (***) JInternalFrame, JDesktopPane. (***) JNDI (***) jsp:ReuseBean (***) JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage. (***) jspService() (***) JTA (***) JTabbedPane (***) JTS (***) Just after line 15. (***) line 15 (***) Line 20 (***) Line 6 (***) LinkedHashMap returns elements in the order they were added. (***) LinkedHashSet (***) LinkedList. (***) Map (***) Multithreading is supported by Java. (***) MyOuter.MyInner m = new MyOuter.MyInner(); (***) MyThread foo (***) MyThread foo (***) name/value (***) Native-protocol pure Java driver (***) network connections (***) new InputStreamReader(System.in); (***) new List(5, true) (***)

new TextArea(10,20) (***) new Thread(new MyRunnable()).start(); (***) no checked exceptions (***) None of the other answers (***) none of them (***) Object (***) Object (***) object instanceof Frame (***) Objects are not collected if they are accessible from live threads. (***) Objects instantiated within anonymous inner classes are placed in the garbage collectible heap. ***) Objects that can be reached from a live thread will never be garbage collected. (***) On the remote service implementation Java file (***) One cannot be certain whether any of the letters i, j, and k will be printed during execution. (***) One of the waiting threads will be allowed to execute the method, but you can't be sure which one it will be. One two three two three done (***) one=1three=3two=2 (***) open (***) OR mapping (object to relational) (***) P1 compiles cleanly but P2 has an error at compile time (***) Package dependency diagram (***) package MyPackage; <BR>import java.awt.*; <BR>class MyClass{} (***) Panel extends Container. (***) prepared statements (***) primary key (***) Prints "Before start method" only (***) Prints out "Sample" (***) Prints out: <BR> Vehicle: drive <BR> Car: drive <BR> Car: drive (***) PropertyEditor. (***) protected (***) public class MyRunnable implements Runnable{public void run(){}} public class MyRunnable implements Runnable{public void run(){}} (***) public class Test{ <BR> public int x=0; <BR> public Test(int x){ <BR> this.x=x; <BR> } <BR> } (***)

public synchronized int read(int a, int b){return a+b;} <BR>public synchronized void set(int a, int b){this.a=a;this.b=b;} (***) public void run() { <BR> for (int i = startHere; i <font face="Symbol">&#60;</font>= endHere; i++) { System.out.println(i); <B public void start(){ <BR> new Thread( this ).start(); <BR> } (***) public void start(){ <BR>new Thread( this ).start(); <BR>} (***) remote/local (***) resizable, closable, maximizable, (***) result set (***) ResultSet (***) ResultSetMetaData (***) ResultSetMetaData (***) RMI (***) RMI will send the stub of the object. (***) run (***) run (***) run() (***)

run() (***) run() (***) RunHandler must implement the java.lang.Runnable interface. (***) RunHandler must implement the java.lang.Runnable interface. (***)\ RunHandler must provide a run() method declared as public and returning void. RunHandler must s=null (***) s1.add(s2) (***) s1.join(s2) (***) s1.subtract(s2) (***) serialization (***) Serialization (***) ServerSocket (***) Servlet (***) Set (***) Set the gridy value of the GridBagConstraint class to a value increasing from 1 to 4 (***) Set. List (***) SetAttribute(string key, Object obj) (***) setEmpty (***) setMaxPriority() (***) setText() (***) show() and setVisible() (***) sleep (***) sleep() (***) socket (***) Socket s = new Socket("java.sun.com", 80); (***) SoftEtchedBorder (***) SQL script (***) start (***) start rmiregistry (***) start( ) (***) start() (***) start() (***) Statement (***) Statement (***) Statement. (***) statement.executeUpdate(query); (***) Store the information in an HttpSession (***) stream of bytes (***) stubs (***) Super Class Service (***) Synchronize the increase() method (***) synchronized (***) synchronized (***) System.gc(); (***) System.out.println("running"); (***) System.out.println('running'); (***) t is running. (***)

t.destroy(); (***) taglib (***) TCP/IP, client, server (***) TextField extends TextComponent. (***) The add method returns false if you attempt to add an element with a duplicate value (***) The bean implements either the EntityBean interface or the SessionBean interface but need not implement all the methods defined in the remote interface. (***) The bean managed entity bean functionally replaces the JDBC API. (***) The CheckboxGroup class is used to define radio buttons. (***) The code will cause an error at compile time. (***) The content pane. (***) The default implementation of equals is to return the memory address of the object. (***) The elements in the collection are guaranteed to be unique. (***) The event listener and adapter classes are deprecated in Java 2. The event-delegation model uses event listeners to define the methods of <BR> event-handling classes (***) The hashcode() method is required to return a positive int value. (***) The implementation class does not require a constructor. (***) The JVM has been implemented on operating systems that use preemptive <BR>scheduling. ***) The last number printed is 12. (***) The last number printed is 12. (***) The letter A is always printed. (***) The LinkedHashSet class ensures elements are unique and ordered. (***) The MouseListener interface defines methods for handling mouse clicks. (***) the name attribute in the getProperty tag (***) The new object will contain all the data it used to including the removed field (***) The Object class declares the wait() and notify() methods. (***) The object issuing the call to wait() will halt until another object sends a notify() or notifyAll() method The output sequence will vary from computer to computer. (***) The output sequence will vary from computer to computer. (***) The program compiles fine, but it does not print anything because t does not invoke the run() method. (***) The program compiles fine, but it does not print anything because t does not invoke the run() method. ***) The program compiles fine, but it does not run because you cannot use the keyword this in the constructor. (***) The program compiles fine, but it does not run because you cannot use the keyword this in the constructor. (***) The program compiles fine. (***) The program compiles, but it does not run because the run() method is not implemented. (***) The program displays test twice. (***) The program exits via a call to System.exit(0); <BR> Another thread is given a higher priority. <BR> A call to the thread's stop The program might print B, End and A, in that order. (***) The program will compile without errors and will simply terminate without any output when run. \ the programmer's fault (***) The Set interface ensures that implementing classes do not have duplicate elements. (***) The size of this driver is smaller than all other types. (***) The sleep() method should be put in the try-catch block. This is the only reason for the compilation failure. (***) The Test1 hashCode() method is less efficient than the Test2 hashCode() method. (***) The thread cannot be restarted. (***) The thread enters the dead state. (***) The thread enters the waiting state. (***)

The top-level abstract classes defined in the java.io package, from which all other byte stream classes inherit. The TreeSet class stores its keys in sorted order. (***) The validate() method is used to cause a Container to be laid out and redisplayed. (***) The vector grows in size to a capacity of 15 elements (***) The wait() method is overloaded to accept a duration. (***) There is no way to determine which listener will be invoked first. (***) They are a mechanism used by the class loader to download applets. (***) They can be added to Swing labels, buttons, and menu items. (***) This program does not compile (***) Thread a = new Thread() { <BR> Thread a = new Thread() { <BR> public void run() { <BR> for (int i = startHere; i <font face="Symbol">&#60;</font>= ThreadGroup tg = new ThreadGroup(" "); <BR> Thread t1 = new Thread(tg, new Runnable()); <BR> (***) ThreadGroup tg = new ThreadGroup(" ");<BR> Thread t1 = new Thread(tg, new Runnable()); (***) throws (***) throws Exception (***) To associate computer names and their IP addresses (***) To call from the currently running thread to allow another thread of the same priority to run (***) To call from the currently running thread to allow another thread of the same priority to run (***) to control the arrangement of components within the display area of a container (***) To load a JDBC driver (***)

en

to terminate the thread. (***) Training users on how to operate a Java-based application (***) Translates JDBC to ODBC and relies on an ODBC driver to communicate with the database. Sun includes the JDBC<font face= Translation time (***) TreeMap (***) TreeSet (***) TreeSet (***) True Pointers (***) try { Thread.sleep(1000); } <BR> catch(InterruptedException e) { } <BR> (***) TTT.addTextListener(EEHH); (***) two fields from the Accounts table where Balance is less than 0 (***) URL (***) URLConnection (***) Use a JList for multiple selection because JComboBox is only single selection. (***) Use the JDBC-ODBC bridge driver. (***) Use the JDBC-ODBC bridge driver. (***) user interface (***) uses delegates to inform listeners. (***) Vector (***) Vector (***) Vector (***) Vector v=new Vector(100); <BR> v.addElement("99"); (***) Video and audio streaming (***) wait (***) web.xml (***) With: addNotify(). (***) Write a class that extends the Thread class (***)

x.contain(element) (***) x.counts() (***) x.delete(element) (***) x3.hashCode() (***) y = (B) x; (***) Yes. (***) yield() (***) yield(); (***) You can create an ordered Collection by instantiating a class that implements the List interface. (***) You can obtain a mutually exclusive lock on any object (***) You can only obtain a mutually exclusive lock on methods in a class that extends Thread or implements runnable (***) You can use the addActionListener method in the Timer class to add a listenner. (***) You cannot be certain when garbage collection will run (***) You cannot force an object to be garbage collected. (***) You place the option buttons you want to group in a JPanel, and then you add a border to the JPanel. (***) You use getFocusOwner from the top window. (***)

object of class B or C. (***)

.sleep(1 000); <BR> } <BR>} catch (InterruptedException x) { } <BR> } <BR> } (***)

is.a=a;this.b=b;} (***) System.out.println(i); <BR> } <BR> } (***)

call to the thread's stop method. (***)

>&#60;</font>=

endHere; i++) { System.out.println(i);} <BR> } <BR> } ; (***)

des the JDBC<font face="Symbol">&#164;</font>ODBC bridge with the JDK. The bridge is handy for testing,

You might also like