You are on page 1of 9

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.

net

1. class Bird { { System.out.print("b1 "); } public Bird() { System.out.print("b2 "); }} class Raptor extends Bird { static { System.out.print("r1 "); } public Raptor() { System.out.print("r2 "); } { System.out.print("r3 "); } static { System.out.print("r4 "); }} class Hawk extends Raptor { public static void main(String[] args) { System.out.print("pre "); new Hawk(); System.out.println("hawk "); } } What is the result? A. pre b1 b2 r3 r2 hawk B. pre b2 b1 r2 r3 hawk C. pre b2 b1 r2 r3 hawk r1 r4 D. r1 r4 pre b1 b2 r3 r2 hawk E. r1 r4 pre b2 b1 r2 r3 hawk F. pre r1 r4 b1 b2 r3 r2 hawk G. pre r1 r4 b2 b1 r2 r3 hawk H. The order of output cannot be predicted. I. Compilation fails. 2. Which interface does java.util.Hashtable implement? A. java.util.Map

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

B. java.util.List C. java.util.Hashable D. java.util.Collection 3. Given: public class Threads3 implements Runnable { public void run() { System.out.print("running"); } public static void main(String[] args) { Thread t = new Thread(new Threads3()); t.run(); t.run(); t.start(); }} What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The code executes and prints "running". D. The code executes and prints "runningrunning". E. The code executes and prints "runningrunningrunning". 4. interface Foo {} class Alpha implements Foo {} class Beta extends Alpha {} class Delta extends Beta { public static void main( String[] args ) { Beta x = new Beta(); // insert code here }} Which code, inserted at line 16, will cause a java.lang.ClassCastException? A. Alpha a = x; B. Foo f = (Delta)x; C. Foo f = (Alpha)x; D. Beta b = (Beta)(Alpha)x; 5. Which object is needed to group Checkboxes to make them exclusive? a.checkboxgroup b.Object

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

c.radiobutton d.chkboxgroup 6. Which is the default layout for applet a. CardLayout b. GridLayout c. FlowLayout d. BorderLayout 7. Which will allow duplicates under the given options 1. Collection 2. List 3. HashSet 4. Map 5. Set

8. Which method has to be called to give visibility to a Frame a.frameobject.setEnable(); b.frameobject.setFocus(); c.frameobject.pack(); d.frameobject.setVisible(); e. frameobject.open(); 9. Which of the following option will set a menubar inside a frame

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

a. Frame f=new Frame(); Menubar mb=new MenuBar(); f.add(mb); b. Frame f=new Frame(); MenuBar mb=new MenuBar(); f .add(mb); c. Frame f=new Frame(); Menubar mb=new MenuBar(); f.setmenubar(mb); d. Frame f=new Frame(); Menubar mb=new MenuBar(); f.setMenuBar(mb); 10.What is the difference between Applet and Frame a. Applet is a container whereas Frame is a component

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

b. Both are same c. Applet is a component and Frame is a container d. none of the above 11.What is the difference between executeQuery and executeUpdate method a. executeQuery is for executing a simple query whereas executeUpdate is for executing a complex query b.executeQuery returns a resultSet object whereas executeUpdate returns an int value which represents the table change. c.both are same d.executeQuery can be used for any operations whereas executeUpdate cant be used. 12.Which of the following will create a connection to oracle database a.Class.forName(oracle.jdbc.driver.OracleDriver); Connection con=Drivermanager.getConnection(jdbc:oracle:thin:@192.168.1.201:1521:oracle); b.Class.forname(oracle.jdbc.driver.OracleDriver);

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

Connection con=Drivermanager.getConnection(jdbc:oracle:thin:@192.168.1.201:1521:oracle); c. Class.forName(oracle.jdbc.driver.OracleDriver); Connection con=DriverManager.getConnection(jdbc:oracle:thin:@192.168.1.201:1521:oracle); d. Connection con=DriverManager.getConnection(jdbc:oracle:thin:@192.168.1.201:1521:oracle); Class.forName(oracle.jdbc.driver.OracleDriver); 13.Which is the default port of RMI server a.8080 b.1099 c.5455 d.1521 14.Which exception has to be thrown by the remote method a.Exception

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

b.RemoteException c.RemoteMethodException d.RemoteObjectException 15.How many jdbc drivers are there a.3 b.2 c.4 d.1 16. What Stack refers to? a. first in first out b. first in last out c. last in first out d. last in last out 17. The data, or variables, defined within a class are called

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

_______ variables a.Object variables b.Class variables c.Instance variables d.none of the above 18.Which interface in java.sql stores the result retrieved by a input query a.Connection b.Statement c.PreparedStatement d.CallableStatement e.ResultSet 19.What is the difference between Iterator and ListIterator

( Word to PDF Converter - Unregistered ) http://www.Word-to-PDF-Converter.net

a.Iterator interface allows to move forward and ListIterator can move in both direction b.Iterator can be applied for any Collection interface and ListIterator to List interface only including the concept of option A c.Iterator cannot be applied for Map interface whereas ListIterator can be applied d.none of the above

20.What does RMI stand for a.RemoteMethodInvocation b.RemoteMethodInvigilation c.RegistryMethodInvocation d.RegistryMethodInterruption

You might also like