Java Adapter Classes Past Paper PDF

Document Details

Uploaded by Deleted User

Tags

java adapter classes java programming computer programming software development

Summary

This document includes a set of Java questions and answers related to adapter classes. Multiple choice questions test the student's knowledge of common adapter classes like WindowAdapter. The questions cover fundamental topics and aim to help the student understand how adapter classes work.

Full Transcript

22517 new Questions Set 1 Which package is required for an adapter classes? A. java.awt.event B. java.lang C. java.util D. java.swing Answer optiona Marks: 1 An adapter class provides an empty implementation of all 2 methods in an _________...

22517 new Questions Set 1 Which package is required for an adapter classes? A. java.awt.event B. java.lang C. java.util D. java.swing Answer optiona Marks: 1 An adapter class provides an empty implementation of all 2 methods in an __________________. A. inheritance B. class C. Class ,Object D. event listener interface Answer optiond Marks: 1 3 Which one of the following is adapter class? A. WindowAdapter B. KeyAdapter C. MouseAdapter D. All the above Answer optiond Marks: 1 What is the output of following code? import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class FrameClosing2 extends Frame { public FrameClosing2() { CloseMe cm = new CloseMe(); addWindowListener(cm); setTitle("Frame closing Style 2"); setSize(300, 300); 4 setVisible(true); } public static void main(String args[]) { new FrameClosing2(); } } class CloseMe extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(0); } } A. B. C. D. Answer optionc Marks: 2 5 _________ class have the KeyListerner interface. A. KeyListernerAdapter B. KeyAdapter C. Adapter D. None Answer optionb Marks: 1 Write correct word at blank spaces. f.addWindowListener(new _____________ { 6 public void windowClosing(WindowEvent e) { System.exit(0); } ________ A. } and ); B. WindowAdapter() and }); C. KeyAdapter() and }); D. Window and ; Answer optionb Marks: 2 Identify the correct adapter name and event name. public class MyFocusListener extends _______________ { public void focusGained(_________________ fe) 7 { Button button = (Button) fe.getSource(); label.setText(button.getLabel()); } } A. Focusevent, Focusadapter B. FocusAdapter, Event C. FocusAdapter, FocusEvent D. Adapter, FocusEvent Answer optionc Marks: 2 8 Adapter classes are an ____________class for receiving various events. A. Abstract B. Inner C. Inline D. Inherited Answer optiona Marks: 1 9 Adapter classes are used to create _________objects. A. Class B. Method C. Package D. Listener Answer optiond Marks: 1 10 Identify the class which is not an adapter class? A. KeyAdapter B. FocusAdapter C. ItemAdapter D. MouseMotionAdapter Answer optionc Marks: 1 11 Adapter classes are used to ___________ the process of event handling. A. solve B. simplify C. avoid D. create Answer optionb Marks: 1 12 An _________ class listener interface and Event class Listener interfa A. adapter B. Static C. Inner D. Super Answer optiona Marks: 1 13 ____________is a subclass of ComponentEvent. A. InputEvent B. ContainerEvent C. TextEvent D. WindowEvent Answer optionb Marks: 1 An adapter class provides an _________ implementation of all methods i 14 interface. A. pluggable B. simple C. empty D. Interface Answer optionc Marks: 1 15 Which of the following method does not belongs to WindowListerner in A. windowActivated B. windowClosed C. windowClosing D. windowReactivated Answer optiond Marks: 1 Which of the following method is invoked when a window is changed fro 16 minimized state? A. windowActivated() B. windowClosed() C. windowClosing() D. windowIconified() Answer optiond Marks: 1 17 What is adapter class for component listener interface? A. Component B. ComponentAdapter C. ComponentListenerAdapter D. None Answer optionb Marks: 1 18 Whether adapter classes use the methods of event classes? A. Yes B. No C. Sometimes D. Depends on some requirement Answer optiona Marks: 1 19 Which of these methods is defined in MouseMotionAdapter class? A. mouseDragged() B. mousePressed() C. mouseReleased() D. mouseClicked() Answer optiona Marks: 1 20 Which of these is a superclass of all Adapter classes? A. Applet B. ComponentEvent C. Event D. InputEvent Answer optiona Marks: 1 If an adapter class is inherited , there is no need of implementing a 21 listener interfaces. A. Sometimes B. Never C. always D. None Answer optionc Marks: 1 22 Adapter class can be also used for incorporating ___________property o A. Inheritance B. Polymorphism C. Encapsulation D. All of the above Answer optionc Marks: 1 23 In Adapter class it is sufficient to include only the methods required A. True B. False C. Sometimes D. Never Answer optiona Marks: 1 24 Adapter class makes programmers task easier. A. Sometime B. True C. False D. Never Answer optionb Marks: 1 Filling the blank. 25 this.addComponentListener(new ______________________ { public void componentShown(ComponentEvent evt) { System.out.println("componentShown"); } }); A. Component() B. componentadapter() C. ComponentAdapter() D. ContainerAdapter() Answer optionc Marks: 1 What is the output of following code? import java.awt.*; import java.awt.event.*; import java.applet.*; public class AdapterDemo extends Applet { public void init() { addMouseListener(new MyMouseAdapter(this)); 26 } } class MyMouseAdapter extends MouseAdapter { AdapterDemo adapterDemo; public MyMouseAdapter(AdapterDemo adapterDemo) { this.adapterDemo = adapterDemo; } // Handle mouse clicked. public void mouseClicked(MouseEvent me) { adapterDemo.showStatus("Mouse clicked"); } } A. Mouse moved B. Mouse dragged C. Mouse pressed D. Mouse clicked Answer optiond Marks: 2 27 _____________is a superclass of ContainerEvent. A. ComponentEvent B. WindowEvent C. InputEvent D. MouseMotionEvent Answer optiona Marks: 1 In an adapter class program, if it contains 5 methods, how many method 28 overriden? A. 1 B. 2 C. 4 D. 5 Answer optiond Marks: 1 29 Which is the abstract adapter class for receiving keyboard focus ev A. FocusListener B. FocusAdapter C. AdapterFocus D. AdapterListerner Answer optionb Marks: 1 30 Adapter Class and interfaces are same. A. Sometimes B. Never C. True D. False Answer optiond Marks: 1 31 Adapter class saves _________. A. Time B. Code C. Space D. All of the above Answer optiond Marks: 1 Following are the integer constants which does not belong to 32 ComponentEvent class. A. COMPONENT_HIDDEN B. COMPONENT_ICONIFIED C. COMPONENT_MOVED D. COMPONENT_SHOWN Answer optionb Marks: 1 __________ is a superclass of all AWT events that are handled by the 33 model. A. AWTEvent B. Event C. UtilityEvent D. AWT Answer optiona Marks: 1 A class which adapts methods of another class by giving different name 34 the same methods is called as __________. A. Inner Class B. Simple Class C. Adapter Class D. Inherited Class Answer optionc Marks: 1 If a class MyWindowAdapter extends WindowAdapter and implements the wi 35 method. How to register this class? A. this.addWindowListener(new MyWindowAdapter()); B. this.addWindow(new MyWindowAdapter()); C. this.addWindowAdapter(new MyWindowAdapter()); D. this.addWindowWindow(new MyWindowAdapter()); Answer optiona Marks: 2 36 Commonly used methods of CardLayout class are____________ A. public void next(Container parent) B. public void previous(Container parent) C. public void first(Container parent) D. all the above Answer optiond Marks: 1 Java allows a programmer to write a class within another class,is call 37 _______________. A. Abstract Class B. Inner Class C. Derived Class D. Simple Class Answer optionb Marks: 1 38 What are the different types of inner classes ? A. Local B. Anonymous C. Both A & B D. None Answer optionc Marks: 1 Fill the proper name of class. import java.awt.*; import java.awt.event.*; import java.applet.*; public class AdapterDemo extends Applet { public void init() { addMouseListener(new MyMouseAdapter(this)); 39 } } class MyMouseAdapter extends MouseAdapter { _________________ adapterDemo; public MyMouseAdapter(AdapterDemo adapterDemo) { this.adapterDemo = adapterDemo; } // Handle mouse clicked. public void mouseClicked(MouseEvent me) { adapterDemo.showStatus("Mouse clicked"); } } A. AdapterDemo B. adapterdemo C. AdapterDemo1 D. Adapter Answer optiona Marks: 2 40 Generates _____________ when the user enters a character. A. Text Event B. Character Event C. Label Event D. TextField Event Answer optiona Marks: 1 41 MouseWheelEvent defines integer constants. A. WHEEL_BLOCK_SCROLL,WHEEL_UNIT_SCROLL B. BLOCK_SCROLL,UNIT_SCROLL C. WHEEL_SCROLL,BLOCK_SCROLL D. WHEEL_PAGE_SCROLL,WHEEL_TRACK_SCROLL Answer optiona Marks: 1 42 What is the return type of isTemporary( ) method? A. int B. Long C. String D. boolean Answer optiond Marks: 1 The abstract class ______________ is a subclass of ComponentEvent and 43 for component input events. A. FocusEvent B. InputEvent C. WindowEvent D. TextEvent Answer optionb Marks: 1 44 Inner class can access all the members of outer class including_______ methods. A. Private B. Public C. Protected D. Static Answer optiona Marks: 1 45 ____________________can be achieved by using Inner Class. A. Code Extension B. Code Inheritance C. Code Optimization D. Code Development Answer optionc Marks: 1 46 The __________method returns the object that generated the event. A. Adjustable( ) B. getModifiers( ) C. getAdjustable( ) D. getAdjust( ) Answer optionc Marks: 1 47 ________ is a class which is declared inside the class or interface. A. Inner Class B. Inherited Class C. Nested Interfaces D. Static Class Answer optiona Marks: 1 48 To handle any events of mouse, you must implement following interfaces A. MouseListener, MouseMotionListener, MouseWheelListener B. MouseListener, MouseWheelListener C. MouseMotionListener, MouseWheelListener D. MouseListener Answer optiona Marks: 1 The _________method returns a reference to the component that was adde 49 from the container. A. getParent( ) B. get( ) C. getTime( ) D. getChild( ) Answer optiond Marks: 1 50 A class that have no name is known as_______________ inner class in ja A. Anonymous B. Local C. Nested D. Static Answer optiona Marks: 1 51 Which are two ways to create Java Anonymous inner class ? A. Class,Interface B. Class,Object C. Interface,Object D. Class,Constructor Answer optiona Marks: 1 52 Which event is generates, when button is pressed? A. TextEvent B. ItemEvent C. InputEvent D. ActionEvent Answer optiond Marks: 1 53 Which event is generates when checkable menu item is selected or desel A. ActionEvent B. InputEvent C. ItemEvent D. TextEvent Answer optionc Marks: 1 54 If you compile a file containing inner class how many.class files are A. 1 B. 4 C. 3 D. 2 Answer optiond Marks: 1 When a component is added to and removed from a container, _________ 55 generates. A. ComponentEvent B. WindowEvent C. FrameEvent D. ContainerEvent Answer optiond Marks: 2 56 What is the output of the following code :- class TestMemberOuter1 { private int data=30; class Inner{ void msg(){System.out.println("data is "+data);} } void display() { Inner in=new Inner(); in.msg(); } public static void main(String args[]) { TestMemberOuter1 obj=new TestMemberOuter1(); obj.display(); } } A. error B. data is Null C. data is 30 D. data is 0 Answer optionc Marks: 2 57 The AdjustmentEvent class defines integer constants. A. ALT, CTRL, META, and/or SHIFT B. BLOCK_DECREMENT, BLOCK_INCREMENT,TRACK C. ALT, CTRL, UNIT_INCREMENT,UNIT_DECREMENT D. UNIT_INCREMENT,UNIT_DECREMENT,SHIFT Answer optionb Marks: 1 Since Nested class is a member of its enclosing class Outer, you can 58 notation to access Nested class and its members. A. ->(arrow) B..(dot) C. * (asterisk) D. &(ampersand) Answer optionb Marks: 1 59 Inner classes provides______________ mechanism in Java. A. Safety B. Protection C. Security D. Risk Handling Answer optionc Marks: 1 60 ItemEvent class defines the integer constants. A. DESELECT,SELECT B. DESELECTED,SELECTED C. ENABLED,NOTENABLED D. CHECKED, UNCHECKED Answer optionb Marks: 1 61 The non-static nested classes are also known as _______________. A. event class B. class C. adapter classes D. inner classes Answer optiond Marks: 1 62 Inner class mainly used for _________________. A. for Code Optimization B. to access all the members C. to develop more readable and maintainable code D. all of these Answer optiond Marks: 1 63 Can outer Java classes access inner class private members? A. No B. Sometimes C. Yes D. Never Answer optionc Marks: 1 What is the output of following? import java.applet.*; import java.awt.event.*; 64 public class InnerClassDemo extends Applet { public void init() { addMouseListener(new MyMouseAdapter()); } class MyMouseAdapter extends MouseAdapter { public void mousePressed(MouseEvent me) { showStatus("Mouse Pressed"); } } } A. Mouse Clicked B. Mouse Moved C. Mouse Dragged D. Mouse Pressed Answer optiond Marks: 2 Fill in the blanks. import java.applet.*; import java.awt.event.*; public class InnerClassDemo extends Applet { 65 public void init() { __________ (new MyMouseAdapter()); } class MyMouseAdapter extends _________________ { public void mousePressed(MouseEvent me) { showStatus("Mouse Pressed"); } } } A. addMouse, Adapter B. addMouseListener, Adapter C. addMouseListener, MouseAdapter D. addListener, MouseAdapter Answer optionc Marks: 2 What is the output of the following java program? class Outer { void outerMethod() { System.out.println("inside outerMethod"); // Inner class is local to outerMethod() class Inner { void innerMethod() { System.out.println("inside innerMethod"); } 66 } Inner y = new Inner(); y.innerMethod(); } } class MethodDemo { public static void main(String[] args) { Outer x = new Outer(); x.outerMethod(); } } A. inside innerMethod inside outerMethod B. inside outerMethod inside innerMethod C. inside innerMethod inside innerMethod D. inside outerMethod inside outerMethod Answer optionb Marks: 2 Identify the correct adapter name and event name. class MyWindowAdapter extends ________________ { 67 public void windowClosing(_____________ e) { System.exit(0); } } A. Window, WindowEvent B. WindowAdapter, Window C. WindowAdapter, WindowEvent D. Adapter, Event Answer optionc Marks: 2 In the following code, what is the name of the inner class? Public class Periodical { long ISBN; public class Book { 68 public long getISBN() { retrun ISBN; } } } A. getISBN B. Periodical C. ISBN D. Book Answer optiond Marks: 2 Identify the type of class for following code? import java.applet.*; import java.awt.event.*; public class Demo extends Applet { 69 public void init() { addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { showStatus("Mouse Pressed"); } }); } } A. Inner Class B. Adapter class C. Anonymous Inner Class D. static class Answer optionc Marks: 2 In case of _______ we can implement only required 70 methods of any interface. A. interface B. package C. adapter classes D. event classes Answer optionc Marks: 1 The ___________ method returns a value that indicates which modifier k 71 when the event was generated. A. getModifiers( ) B. getAdjustable( ) C. Modifiers( ) D. Adjustable( ) Answer optiona Marks: 1 getLocalHost() method simply returns the InetAddress object which 72 represents______________ A. host name B. machine name C. local host D. remote host Answer optionc Marks: 1 73 The getByName() method returns an ________________ with host name A. IP address B. InetAddress Object C. port number D. IPv4 Answer optiona Marks: 1 getAllByName() method returns an array of_____________ that represents 74 addresses that specific host name has A. host names B. InetAddresses C. ipaddresses D. objects Answer optionb Marks: 1 what is the output of following program import java.net.*; class Demo { public static void main(String arg[]) throws UnknownHostException 75 { InetAddress ipa=InetAddress.getLocalHost(); System.out.println(ipa); } } A. host name/IP address B. iPAddress/Host name C. IPAddress D. Host name Answer optiona Marks: 2 76 Which type of Statement can execute parameterized queries? A. ParameterizedStatement B. PreparedStatement C. ParameterizedStatement and CallableStatement D. All kinds of Statements Answer optionb Marks: 1 77 How can you retrieve information from a ResultSet? A. By invoking the method get(String type) on the ResultSet, where type i By invoking the method get(Type type) on the ResultSet, where Type is B. represents a database type C. By invoking the method getValue(), and cast the result to the desired By invoking the special getter methods on the ResultSet: getString(), D. getClob() Answer optiond Marks: 1 78 Which type of statement can execute parameterized queries ? A. PreparedStatement B. ParameterizedStatement C. CallableStatement D. All of the Above Answer optiona Marks: 1 79 What is the meaning of ResultSet.TYPE_SCROLL_INSENSITIVE A. This means that the ResultSet is insensitive to scrolling This means that the Resultset is sensitive to scrolling, but insensit B. i.e. not updateable This means that the ResultSet is sensitive to scrolling, but insensiti C. by others The meaning depends on the type of data source, and the type and versi D. you use with this data source Answer optionc Marks: 1 80 What statements are correct about JDBC transactions A. A transaction is a set of successfully executed statements in the dat B. A transaction is finished when commit() or rollback() is called on the C. A transaction is finished when commit() or rollback() is called on the D. A transaction is finished when close() is called on the Connection obj Answer optiond Marks: 1 81 What happens if you call the method close() on a ResultSet object? A. the method close() does not exist for a ResultSet. Only Connections ca B. the database and JDBC resources are released C. you will get a SQLException, because only Statement objects can close the ResultSet, together with the Statement which created it and the Co D. the Statement was retrieved, will be closed and release all database a Answer optionb Marks: 1 82 What happens if you call deleteRow() on a ResultSet object? A. The row you are positioned on is deleted from the ResultSet, but not f B. The row you are positioned on is deleted from the ResultSet and from t The result depends on whether the property synchronizeWithDataSource C. false. You will get a compile error: the method does not exist because you ca D. from a ResultSet. Answer optionb Marks: 1 83 What is correct about DDL statements DDL statements are treated as normal SQL statements, and are executed A. execute() method on a Statement B. To execute DDL statements, you have to install additional support file DDL statements can not be executed by making use of JDBC, you should u C. database tools for this D. Support for DDL statements will be a feature of a future release of JD Answer optiona Marks: 1 Which of the following statements is false as far as different type of 84 concern in JDBC? A. Regular Statement B. Prepared Statement C. Callable Statement D. Interim Statement Answer optiond Marks: 1 JDBC facilitates to store the java objects by using which of the metho 85 Statement 1. setObject () 2. setBlob() 3. setClob() A. 1, 2 B. 1, 2,3 C. 1,3 D. 2,3 Answer optionb Marks: 1 86 _______method to establish actual database connection. A. executeQuery() B. executeUpdate() C. getConnection() D. prepareCall() Answer optionc Marks: 1 Which of the following describes the correct sequence of the steps inv connection with a database. 1. Loading the driver 87 2. Process the results. 3. Making the connection with the database. 4. Executing the SQL statements. A. 1,3,4,2 B. 1,2,3,4 C. 2,1,3,4 D. 4,1,2,3 Answer optiona Marks: 1 88 Which method is used to perform DML statements in JDBC? A. execute() B. executeQuery() C. executeUpdate() D. executeResult() Answer optionc Marks: 1 Can we retrieve a whole row of data at once, instead of calling an in 89 ResultSet.getXXX method for each column ? A. No B. Yes C. Statement is incorrect D. None of the above Answer optionb Marks: 1 90 Are Prepared Statements actually compiled? A. Yes B. No C. Statement is incorrect D. None of the above Answer optiona Marks: 1 In order to transfer data between a database and an application writte 91 programming language, the JDBC API provides which of these methods? A. Methods on the ResultSet class for retrieving SQL SELECT results as Ja Methods on the PreparedStatement class for sending Java types as SQL s B. parameters. C. Methods on the CallableStatement class for retrieving SQL OUT paramete D. All mentioned above Answer optiond Marks: 1 92 _________calls get converted into native c or c++ API calls. A. API B. ODBC C. JDBC API D. None of the above. Answer optionc Marks: 1 93 Which method Drops all changes made since the previous commit/rollback A. public void rollback() B. public void commit() C. public void close() D. public Statement createStatement() Answer optiona Marks: 1 94 Which of the following is used to set the maximum number of rows can A. setMaxRows(int i) B. setMinRows(int i) C. getMaxrows(int i) D. getMinRows(int i) Answer optiona Marks: 1 ____method of ResultSet is used to move the cursor to the row next fro 95 position. A. fetch method B. current method C. next method D. access method Answer optionc Marks: 1 Which of the following encapsulates an SQL statement which is passed t 96 be parsed, compiled, planned and executed? A. DriverManager B. JDBC driver C. Connection D. Statement Answer optiond Marks: 1 97 The interface ResultSet has a method, getMetaData(), that returns a/an A. Tuple B. Value C. Object D. Result Answer optionc Marks: 1 98 Which method is used to find the number of column in ResultSet? A. getNumberOfColumn() B. getMaxColumn() C. getColumnCount() D. getColumns() Answer optionc Marks: 1 99 commit() method is belongs to which interface? A. ResultSet B. Statement C. PreparedStatement D. Connection Answer optiond Marks: 1 100 Which one is the correct syntax for creating a Statement? A. Statement stmt = connection.createStatements(); B. Statement stmt = connection.preparedStatement(); C. Statement stmt = connection.createStatement(); D. none of these Answer optionc Marks: 1 101 Which statement is correct? A. ResultSet rs = stmt.selectQuery("SELECT ROLLNO,STUDNAME FROM STUDENT") B. ResultSet rs = stmt.executeSelect("SELECT ROLLNO,STUDNAME FROM STUDENT C. ResultSet rs = stmt.executeUpdate("SELECT ROLLNO,STUDNAME FROM STUDENT D. ResultSet rs = stmt.executeQuery("SELECT ROLLNO,STUDNAME FROM STUDENT" Answer optiond Marks: 1 102 INSERT, DELETE, UPDATE comes under ? A. Data Modification Language B. Data Definition Language C. Data Control Language D. Data Manipulation Language Answer optiond Marks: 1 103 The return type of execute(String query) is? A. int B. ResultSet C. boolean D. void Answer optionc Marks: 1 Consider the following program. Select the missing statement in given import java.sql.*; class PreparedExample{ public static void main(String args[]){ try{ 104 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:snrao","scott PreparedStatement stmt=con.prepareStatement("select * from stud rollno=?)"); stmt.setInt(1,1); ------------------------------------------ while(rs.next()) {} con.close(); }catch(Exception e){ System.out.println(e);} } } A. stmt.setString(2,"Ratan"); B. int i=stmt.executeQuery(); C. ResultSet rs=stmt.executeQuery(); D. ResultSet rs=stmt.executeQuery("select * from student†); Answer optionc Marks: 2 Consider the following code. To execute the query, which of the follow used? String sql = "update people set firstname=? , lastname=? where id=?"; 105 preparedStatement = connection.prepareStatement(sql); preparedStatemen "Gary"); preparedStatement.setString(2, "Larson"); preparedStatement.setLong (3, 123); A. int rowsAffected = preparedStatement.executeUpdate(); B. ResultSet rs=preparedStatement.executeQuery(sql); C. int rowsAffected = preparedStatement.executeQuery(sql); D. ResultSet rs=preparedStatement.executeUpdate(); Answer optiona Marks: 2 106 which method is used to insert image in database A. statement.getImage() B. statement.getDouble() C. statement.getBLOB() D. statement.getIcon() Answer optionc Marks: 1 All raw data types (including binary documents or images) should be re 107 the database as an array of A. byte B. int C. char D. long Answer optiona Marks: 1 108 Consider the following code and Select the missing statement in given import java.sql.*; class MySQL { public static void main(String args[]){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection( "jdbc:mysql://localhost:3306/dsn","root","root"); Statement stmt=con.createStatement(); ------------------------------------------------------------ while(rs.next()) System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3 con.close(); }catch(Exception e){ System.out.println(e);} } } A. ResultSet rs=stmt.runQuery("select * from emp"); B. ResultSet rs=stmt.executeQuery("select * from emp"); C. int n=stmt.executeQuery("select * from emp"); D. int n=stmt.executeUpdate("select * from emp"); Answer optionb Marks: 2 Consider the following program. Find which statement contains error import java.awt.*; import javax.swing.*; public class JTableDemo extends JApplet { public void init() { Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); final String[] colHeads = { "Name", "Phone", "Fax" }; final Object[][] data = { { "Pramod", "4567", "8675" }, { "Tausif", "7566", "5555" }, { "Nitin", "5634", "5887" }, { "Amol", "7345", "9222" }, { "Vijai", "1237", "3333" }, { "Ranie", "5656", "3144" }, { "Mangesh", "5672", "2176" }, { "Suhail", "6741", "4244" }, { "Nilofer", "9023", "5159" }, { "Jinnie", "1134", "5332" }, { "Heena", "5689", "1212" }, { "Saurav", "9030", "1313" }, { "Raman", "6751", "1415" } }; JTable table = new JTable(data, colHeads); int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp = new JScrollPane(table, v, h); contentPane.add(jsp, BorderL A. No error B. error C. compile time error D. Run time errror Answer optiona Marks: 2 Consider the following code and write the value of String sql to delet employee. import java.sql.*; import java.util.*; 110 public class DeleteRecord { public static void main(String args[]) throws Exception { String sql; Scanner sc=new Scanner(System.in); System.out.println("Please Enter the ID no:"); int num = sc.readInt(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:EMP","scott" Statement stmt=con.createStatement(); int affectedRecords = stmt.executeUpdate(sql); br.close(); stmt.close(); con.close(); } } A. sql="delete from Employee where empid="+ num B. sql="delete * Employee where empid="+ num C. sql=" select * from Employee " D. sql="delete from Employee where empid=" Answer optiona Marks: 2 Following four methods belongs to which class? 1) public void add(Component c) 111 2) public void setSize(int width,int height) 3) public void setLayout(LayoutManager m) 4) public void setVisible(boolean) A. Graphics class B. Component class C. Both A & B D. None of the above Answer optionb Marks: 2 Which is the container that does not contain title bar and MenuBars bu 112 components like button, textfield etc? A. Window B. Menu bar C. Panel D. Output Screen Answer optionc Marks: 1 113 Whose object is to be created to show any number of choices in the vis A. JLabel B. JButton C. JList D. JCheckbox Answer optionc Marks: 1 What is used to store partial data results, as well as to perform dyn 114 return values for methods, and dispatch exceptions? A. Window B. Button C. Container D. Frame Answer optiond Marks: 2 115 Which class is used for processActionEvent( ) Processing Method ? A. JButton,JList,JMenuItem B. JButton Only C. JScrollbar D. None of the above Answer optiona Marks: 1 a) It is lightweight. b) It supports pluggable look and feel. 116 c) It follows MVC (Model View Controller) architecture Above advantages are of _____________ A. Swing B. AWT C. Networking D. Databases Answer optiona Marks: 1 JFrame myFrame = new JFrame (); 117 Any command (such as the one listed above) which creates a new object (in this case a new JFrame object called myFrame) is generally called A. Constructor B. Layout manager C. Parameter D. GUI Answer optiona Marks: 2 Suppose you are developing a Java Swing application and want to toggle 118 views of the design area. Which of the views given below are present f toggle? A. Design View B. Requirement View C. Source View D. Toggle View Answer optionb Marks: 2 119 The size of a frame on the screen is measured in: A. Inches B. Centimetres C. Dots D. Pixels Answer optiond Marks: 1 120 The layout of a container can be altered by using which of the followi A. setLayout(LayoutManager) B. layoutmanager(LayoutManager) C. addLayout(LayoutManager) D. setLayoutManager(LayoutManager) Answer optiona Marks: 1 121 In JDBC _____ imports all java classes concerned with database connect A. javax.sql.* B. java.mysql.* C. java.sql.* D. com.* Answer optionc Marks: 1 122 Methods of ResultSet throws...... exception. A. IOException B. SQLException C. MethodNotFoundException D. ResultSetException Answer optionb Marks: 1 123 Which of the following is FALSE with reference to JDBC Driver A. All drivers implements the java.sql.Driver interface. B. driver classes are not supplied by the database vendor C. Driver class return a java.sql.Connection object. D. None of the Above Answer optionb Marks: 1 124 How do you indicate where a component will be positioned using Flowlay A. North, South, East, West B. Assign a row/column grid reference C. Do nothing, the FlowLayout will position the component D. Pass a X/Y percentage parameter to the add method Answer optionc Marks: 2 Match the following i) Type 1 Driver a) Native API, partly Java 125 ii)Type 2 Driver b) Pure Java direct to database iii)Type 3 Driver c) JDBC-ODBC bridge iv)Type 4 Driver d) Pure Java to database middleware A. i -> c, ii -> b , iii -> d, iv -> a B. i -> c, ii -> a , iii -> d, iv -> b C. i -> c, ii -> a , iii -> b, iv -> d D. i -> c, ii -> d , iii -> a, iv -> b Answer optionb Marks: 1 126 PreparedStatements are used for calling........ statements A. Interpreted Statements B. Exceuted statements C. Resultset statements D. precompile Statement Answer optiond Marks: 1 127 Which TextComponent method is used to set a TextComponent to the read- A. setReadOnly() B. setRead() C. setUpdate() D. setTextReadOnly() Answer optiona Marks: 1 128 Which type of Driver communicate using a network protocol to a middlew A. Type 1 Driver B. Type 2 Driver C. Type 3 Driver D. Type 4 Driver Answer optionc Marks: 1 129 Which method will cause a JFrame to get displayed? A. show( ) B. setVisible( ) C. showFrame( ) D. displayFrame( ) Answer optionb Marks: 1 Which of the Following Drivers Sun describes it as being experimental 130 use only where no other driver is available. A. Type 1 Driver B. Type 2 Driver C. Type 3 Driver D. Type 4 Driver Answer optiona Marks: 1 131 ___________ interface allows storing results of query? A. ResultSet B. Connection C. Statement D. Result Answer optiona Marks: 1 Which of the Following Drivers require native library files to be inst 132 on client systems. A. Type 1 Driver B. Type 2 Driver C. Type 3 Driver D. Type 4 Driver Answer optionb Marks: 1 133 InetAddress also Includes a factory method called____ A. getByAddress() B. getHostName() C. getAddress() D. getIPAddress() Answer optiona Marks: 1 134 Which of the following statements are TRUE in case of Type 2 JDBC Driv A. It use native methods to call vendor-specific API functions. B. native library files are to be installed on client systems. C. Both of the Above D. None of the Above Answer optionc Marks: 1 135 in JDBC 2.0 a Connection object is created either by a call to A. DriverManager.getConnection() B. DataSource.Connection() C. Both of the Above D. None of the Above Answer optiona Marks: 1 136 How to create the Tabbed pane in swings? A. JTab jt=new JTab(); B. JTabPane jt=new JTabPane(); C. JTabP =new JTabP(); D. JTabbedPane jt=new JTabbedPane (); Answer optiond Marks: 1 137 In JDBC URL string protocol is always A. jdbc B. odbc C. Jdbc-odbc D. Any one of the above Answer optiona Marks: 1 Choose the correct option to insert rollno and student name into table 138 display its contents import java.sql.*; class Example1{ public static void main( ("jdbc:oracle:thin:@localhost:1521:xe","system","o A. PreparedStatement stmt=con.prepareStatement("insert into studen System.out.println(e);} } } import java.sql.*; class Example1{ public static void main( ("jdbc:oracle:thin:@localhost:1521:xe","system","o B. PreparedStatement stmt=con.preparedStatement("insert into stude stmt.setInt(1,"Ratan"); stmt.setString(2,101); int i=stmt import java.sql.*; class Example1{ public static void main( values(?,?)") ; stmt.setInt(1,101); stmt.setString(2,XYZ); C. i=stmt.executeQuery(); con.close(); }catch(Exception e){ System.out.println(e);} } } import java.sql.*; class Example1{ public static void main( ("jdbc:oracle:thin:@localhost:1521:xe","system","o PreparedStatement stmt=con.preparedStatement("insert into stude D. stmt.setInt(1,101); stmt.setString(2,"Ratan"); int i=stmt.executeUpdate(); con.close(); }catch(Exception e){ System.out.println(e);} } } Answer optiond Marks: 2 what is the output of following program import java.net.*; class Demo 139 { public static void main(String arg[]) { InetAddress ip=InetAddress.getByName("www.google.com"); System.out.println(ip) } A. www.google.com/217.56.216.195 B. www.google.com C. 217.56.216.195 D. All of the above Answer optiona Marks: 2 What does the following line of code do? 140 JTextfield text = new JTextfield(10); A. Creates text object that can hold 10 columns of text. B. Creates text object that can hold 10 rows of text. C. Creates the object text and initializes it with 10. D. The code is illegal Answer optionc Marks: 1 141 Which of the following is FALSE with reference to JDBC database URL A. URL string has three components B. protocol in URL string is always jdbc C. subprotocol in URL string is always odbc. D. subname identifies the specific database to connect Answer optionc Marks: 1 The Swing component classes that are used to encapsulate a mutually ex 142 buttons ? A. AbstractButton B. ButtonGroup C. JButton D. Button Answer optionb Marks: 1 143 Which class has strong support of the JDBC architecture? A. The JDBC driver manager B. JDBC driver test suite C. JDBC ODBC bridge D. All of these Answer optiona Marks: 1 Connection object can be initialized using the ____________method of t 144 Class. A. putConnection() B. setConnection() C. Connection() D. getConnection() Answer optiond Marks: 1 In model-view-controller (MVC) architecture of swings, model defines 145 the_______________________________ A. Data layer B. Presentation layer C. Business-logic layer D. Both A and C Answer optiond Marks: 1 146 Which of the following methods are needed for loading a database drive A. registerDriver() method B. Class.forName () C. Both A and B D. getConnection () Answer optionb Marks: 1 147 Disadvantages of MVC architecture can be : A. Navigation control is decentralized B. Time consuming C. both a& b D. UI components are not user friendly Answer optionc Marks: 1 148 Native API converts ____________into the ________________used by DBMS. A. JDBC API, network protocol B. JDBC API, Native API calls C. JDBC API, User call D. JDBC API, ODBC API calls Answer optionb Marks: 1 149 _______ method of DriverManager class is used to establish connection A. openConnection() B. getConnection() C. connect() D. createConnection() Answer optionb Marks: 1 150...... helps you to maintain data when you move from controller t A. View Bag B. View Data C.. Temp Data D. Both A and B Answer optiond Marks: 1 What is output of following program import java.net.*; class Demo { public static void main(String arg[]) throws UnKnownHostException 151 { InetAddress ipa[]=InetAddress.getAllByName("www.google.com"); for(int i=0;i. The method setLabel() can be used with what type of Object? A. Float B. int C. JTextField D. String. Answer optionc Marks: 2 Which Swing Component classes that are used to Encapsulates a mutually 171 buttons? A. AbstractButton B. ButtonGroup C. JButton D. Button Answer optionb Marks: 1 172 Which method is used to add tooltip text to almost all components of J A. getToolTipText() B. setToolTipText(String s) C. setToolTip (String s) D. getToolTipText(String s) Answer optionb Marks: 1 173 In Swing the content pane can be obtained by using ________method. A. getContent() B. getContentPane() C. Both A & B D. getContainedPane() Answer optionb Marks: 1 Which one of the following is the correct sequence of activities to pe 174 connectivity in java Register the Driver class - Create statement - Create connection - Exe A. Close connection Register the Driver class - Create connection - Create statement -Exec B. connection Create connection - Register the Driver class - Create statement -Exec C. connection Create connection - Create statement - Register the Driver class - Exe D. Close connection Answer optionb Marks: 1 175 Model is the _________ in the MVC architecture. A. top most level B. middle most level C. bottom most level D. None of the above Answer optionc Marks: 1 Double-buffering built in, tool tips, dockable tool bars, keyboard , a 176 cursors, etc. are new features of _______? A. AWT B. Networking C. Swing D. All of the above Answer optionc Marks: 1 177 JCheckBox is ___________________Component. A. heavyweight B. mediumweight C. No weight D. lightweight Answer optiond Marks: 1 178 The default layout manager for the content pane of a swing is : A. CardLayout B. GridLayout C. BorderLayout D. None of the above Answer optionc Marks: 1 Type of server in two-tier architectures which provides data to client 179 pages is called A. transaction server B. functional server C. disk server D. data server Answer optiond Marks: 1 Application program interface in two tier architecture database manage 180 provided by the A. close module connectivity B. open module connectivity C. close database connectivity D. open database connectivity Answer optiond Marks: 2 181 Database system compiles query when it is A. prepared B. invoked C. executed D. initialized Answer optiona Marks: 1 182 Standard which allows access to DBMS by Java client programs is classi A. JCBD standard B. JDBC standard C. BDJC standard D. CJBD standard Answer optionb Marks: 2 183 Which of the Following is NOT a valid Syntax for getConnection() Metho A. public static Connection getConnection(String url) B. public static Connection getConnection(String url, String userID, Stri public static Connection getConnection(jdbc::Str C. password) D. None of the Above Answer optiond Marks: 1 In two-tier client/server architecture, running of application program 184 interface programs is in control of___________ A. modulation side B. client side C. server side D. host side Answer optionb Marks: 2 185 Which of the following must be closed at end of Java program ? A. Result B. Connection C. Query D. Both A and B Answer optionb Marks: 1 186 A Java application program does not include declarations for A. Data stored in database B. Data retrieved of database C. Data executed D. Data manipulated Answer optiona Marks: 1 A label is a simple control which is used to display 187 _________________on the window A. button B. Editable Text C. Non-Editable Text D. All of above Answer optionc Marks: 1 Which statement is true with respect to the following code? import java.awt.*; import javax.swing.*; public class Test { public static void main(String[] args) { 188 JFrame frame = new JFrame("My Frame"); frame.getContentPane().add(new JButton("OK")); frame.getContentPane().add(new JButton("Cancel")); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true); } } A. Only button OK is displayed. B. Only button Cancel is displayed. Both button OK and button Cancel are displayed and button OK is displa C. side of button OK. Both button OK and button Cancel are displayed and button OK is displa D. side Answer optionb Marks: 2 189 Label is ___________ entity. A. Active B. Passive C. Both A& B D. None of these Answer optionb Marks: 1 190 ___________ method is used to set or change the text in a Label. A. setText(String strLabel) B. getText() C. getAlignment() D. None of these Answer optiona Marks: 1 191 getAlignment() is the method of ________ class. A. Button B. List C. Choice D. Label Answer optiond Marks: 1 Label(String str) creates a label that contains the string specified b 192 _________ A. Right-Justified B. Left-Justified C. Center-Justifed D. All of above Answer optionb Marks: 1 193 Which of the following Statement is NOT true for Type-2 Drivers A. Driver needs to be installed separately in individual client machines B. The Vendor client library needs to be installed on client machine. C. Type-2 driver isn't written in java, that's why it isn't a portable dr D. None of the Above Answer optiond Marks: 1 194 Which of the following method is used to set Label for Button B A. B.setLabel(String S) B. B.getLabel() C. Both A& B D. B.setText(String S) Answer optiona Marks: 1 With respect to Type-3 drivers A)Type-3 drivers are fully written in Java, hence they are portable dr 195 B)No client side library is required because of application server tha tasks like auditing, load balancing, logging etc. A. A is True But B is False B. B is True But A is False C. Both are False D. Both are True Answer optiond Marks: 1 196 The various controls supported by AWT are A. Buttons,Scrollbar B. Label,TabbedPanes C. Tress,Tables D. All of above Answer optiona Marks: 1 197 Which of the following is NOT true for Type - 4 drivers A. Type-4 driver is also called native protocol driver. B. Different driver is not needed for different database. C. No client-side or server-side installation required. D. It is fully written in Java language, hence they are portable drivers. Answer optionb Marks: 1 198 Which method does return true value if specified address is a multicas A. isMulticastHostName() B. isMulticastHostAddress() C. isMulticastAddress() D. isMulticastIPAddress() Answer optionc Marks: 1 199 InetAddress has two subclasses called as: A. IPV4Address() and IPV6Address() B. IP4VAddress() and IP6VAddress() C. Inet4Address() and Inet6Address() D. InetAddress4() and InetAddress6() Answer optionc Marks: 1 What is output of following code? import java.net.*; 200 class Inet{ public static void main(String arg[]){ InetAddress ip=InetAddress.getLocalHost(); System.out.println(ip.getHostAddress(); }} A. 192.168.0.100 B. localhost/192.168.0.100 C. localhost machine D. localhost//8080: Answer optionc Marks: 2 what is the output of following program import java.net.*; class Demo { public static void main(String arg[]) throws UnKnownHostException { 201 InetAddress ipa=InetAddress.getLocalHost(); InetAddress ipa1=InetAddress.getLocalHost("www.google.com"); boolean b=ipa.equals(ipa1); System.out.println(b); } } A. true B. false C. compile time error D. 0 Answer optionc Marks: 1 what is the output of following program import java.net.*; class Demo { public static void main(String arg[]) throws UnKnownHostException { 202 InetAddress ipa=InetAddress.getLocalHost(); InetAddress ipa1=InetAddress.getLocalHost(); boolean b=ipa.equals(ipa1); System.out.println(b); } } A. true B. false C. 0 D. 1 Answer optiona Marks: 2 203 InetAddress class is used to encapsulate both numerical IP address and A. port number B. host name C. server name D. socket name Answer optionb Marks: 1 what is the output of following program import java.net.*; class Demo { public static void main(String arg[]) throws UnKnownHostException 204 { InetAddress ipa=InetAddress.getByName("www.google.com"); System.out.println(ipa.getHostName()); } } A. www.google.com B. www.google.com/217.196.214.99 C. 217.196.214.99 D. None of the above Answer optiona Marks: 2 You can simply use InetAddress class when working with IP address beca 205 accommodate both ___________ styles. A. IP4V and IP6V B. IPV4 and IPV6 C. host name and IP D. A and B Answer optionb Marks: 1 206 What does getHostAddress() of InetAddress class terurn? A. Returns host address with ipaddress. B. Returns a string that represents ipaddresses with hostname. C. Returns a string that represents a host address associated with the In D. Returns a string that represents a host name associated with Inetaddr Answer optionc Marks: 1 207 getHostName() of InetAddress class is used to_______ A. Return a string that represents host name associated with Inetaddress B. Return a string that represents host address associated with Inetaddre C. Return an object that represents Ipaddress associated with host name D. Return Ipaddress that is associated with InetAddress object. Answer optiona Marks: 1 208 Which of the following statement is correct ? A. There are two kinds of sockets in java one is for server and other for B. There is only one socket for server. C. There is only one socket for client. D. There is only one socket for server as well as for client. Answer optiona Marks: 1 209 Which of the following class is used to create server that listen for A. httpserver B. ServerSocket C. DatagramSocket D. Socket Answer optionb Marks: 1 210 What happens if server socket is not able to listen on specified port A. The system exits gracefully with appropriate message B. The system will wait till port is free. C. IoExeption is thrown when opening the socket D. PortOccupiedException is thrown. Answer optionc Marks: 1 Which exception will be thrown if client socket does not specify the h 211 created ? A. IOException B. UnknownHostException C. UnknownHostNameException D. UnknownPortException Answer optionb Marks: 1 Which constructor will you use to create client socket using a preexsi 212 object and a port ? A. Socket (String hostname, int port ) B. Socket (Inetaddress ipAdd, int port ) C. Socket (Inetaddress ip Add, string Hostname) D. Socket ( int port, Inetaddress ipAdd ) Answer optionb Marks: 1 213 __________method returns the local part to which the invoking socket o A. int getLocalHost() B. int getLocalPort() C. int getPort() D. int GetLocalHost() Answer optiona Marks: 1 214 Which of the following are factory methods of InetAddress class? A. static InetAddress[] getAllByName(String hostname) B. static InetAddres getLocalHost() C. string getHostName() D. A and B Answer optiond Marks: 1 215 Which of the following methods belong to ServerSocket class A. accept() B. connect() C. bind() D. A and C Answer optiond Marks: 1 216 ServerSocket class has one of the following constructor A. ServerSocket(int port) B. ServerSocket(String host, int port) C. ServerSocket(int port, InetAddress add) D. ServerSocket(InetAddress add, int port) Answer optiona Marks: 1 Socket method called______returns the port number that socket is bound 217 machine A. int getLocalPortt() B. int getPort() C. InetAddress getInetAddress() D. string getHostAddress() Answer optionb Marks: 1 218 What are different factory methods of InetAddress class? A. getByName() B. GetLocalHost() C. getByAddress() D. both A & C Answer optiond Marks: 1 How long is an IPv6 address? 219 A. 32 bits B. 128 bytes C. 64 bits D. 128 bits Answer optiond Marks: 1 __________________method is needed only when you instantiate the socke 220 argument constructer. A. bind() B. connect() C. accept() D. SetHostName() Answer optionb Marks: 1 InetAddress class having method which returns a string that shows the 221 address. A. toString() B. getHostAddress() C. getLocalHost() D. none of the above Answer optiona Marks: 1 If server socket is created using serversocket () constructer then whi 222 use to bind the serve socket ? A. isbind() B. bind() C. bind To() D. bind ( socketAddress host , int backlog) Answer optiond Marks: 1 223 accept method is used for _______________________ A. Incoming Client connection B. Incoming Server socket C. Accepting request from server D. Waiting socket Answer optiona Marks: 1 _____________Class represents the socket that both the client & server 224 with each other A. java.net.Serversocket B. java.net.Server C. Java.net.socket D. java.net.Clientsocket Answer optionc Marks: 1 225 Socket s1= Socket ( localhost, 1346), What does it means ? A. Client socket is waiting for connection B. Client socket is created to connect with specified host name and port C. Client socket is name as localhost and Port number is 1346 D. server socket is connected to local host with port number 1346 Answer optionb Marks: 1 What is the output of following statements Socket s1=new Socket("localhost",1234); 226 int a=s1.getPort(); System.out.println(a); A. localhost B. localhost/1234 C. 1234 D. 1234/localhost Answer optionc Marks: 2 227 Correct way of using ServerSocket is___________ A. ServerSocket(int port) B. ServerSocket(int port,int maxQueue) C. ServerSocket(int port,int maxQueue,InetAddress localAddress) D. All of the above Answer optiond Marks: 1 What is the output of following statements? ServerSocket ss=new ServerSocket(1349); 228 Socket s1=ss.accept(); System.out.println(ss.getLocalPort()); A. port number of client socket B. 1349 C. local port D. None of the above Answer optionb Marks: 1 229 public InputStream getInputStream() is method of ____________ class A. Serversocket B. ClientSocket C. Socket D. All of the above Answer optionc Marks: 1 230 getOutputStream() returns the output stream of the ________ A. Socket B. ServerSocket C. ClientSocket D. None of the above Answer optiona Marks: 1 231 Which of the following statement is correct? A. The input stream of socket is connected to the output stream of remote B. The output stream of socket is connected to the input stream of remote C. The output stream of socket is connected to the output stream of remot D. A and B Answer optiond Marks: 1 232 __________method makes socket object no longer capable of connecting a A. send() B. wait() C. connect() D. close() Answer optiond Marks: 1 If your application has successfully bound to specified port and is re 233 request then_________ A. an exception is thrown B. an IOException is thrown C. it does not throw an exception D. UnknownHostException is thrown Answer optionc Marks: 1 234 Socket is the combination of ______________ and __________. A. IP address and port number B. port number and local host C. IPAddress and machine number D. All of the above Answer optiona Marks: 1 235 Which steps occur when establishing a TCP connection between two compu A. The server initiates a ServerSocket object denoting port number to be The server invokes the accept() method of ServerSocket class. This met B. client connects to the server on the given port After the server is waiting, a client instantiates a socket object wit C. name and port number D. All of the above Answer optiond Marks: 1 What is the output of the following statement? ServerSocket ss=new ServerSocket(1234); 236 Socket s1=ss.accept(); System.out.println(s1.getPort()); A. port number of client socket B. 1234 C. local port D. All of the above Answer optiona Marks: 2 What is the output of following statement? ServerSocket ss=new ServerSocket(1234); 237 Socket s1=ss.accept(); System.out.println(s1.getRemoteSocketAddress()); A. 1234 B. iPAddress of serversocket C. IPAddress of client with port number D. IPAddress of server with port number Answer optionc Marks: 1 What is the output of following statement? 238 Socket s1=new Socket("localhost",1234); System.out.println(s1.getRemoteSocketAddress()); A. IPAddress of client with port number B. host name, IPAddress and port number of Serversocket C. host name and IPAddress Serversocket D. IPAddress of server with port number Answer optionb Marks: 1 239 Connection timed out exception is occurred _________ A. if client socket is not created B. if serversocket does not accept client request C. if port number is not available which is specified by client socket wi D. None of the above Answer optionc Marks: 1 Which method is used to expose the details of establishing connection 240 socket & client socket ? A. connect() B. receive() C. there is no such method D. None of the above Answer optionc Marks: 1 You can gain access to the input and output streams associated with so 241 getInputStream() A. getOutStream() B. setOutputStream() C. getOutputStream() D. getOutputClass() Answer optionc Marks: 1 Which exception will occur when port is already bound with an applicat 242 application is requesting for same port? A. IOException B. PortNotFoundException C. UnknownPortNameException D. ConectException Answer optiona Marks: 1 When you will use this ServerSocket(int port, int que) constructor to 243 socket A. to create ServerSocket with port number B. to create ServerSocket with port number & Ip address C. to create ServerSocket with port number and number of incoming client D. B & C Answer optionc Marks: 1 Socket(InetAddress host, int port) in this constructor, what does firs 244 for ? A. host name B. host name and IPAddress specified by InetAddress object C. IpAddress of host D. ipaddress and port number Answer optionb Marks: 1 Which constructor will you use to connect to specified host and port b 245 on the local host at specified address & port A. Socket() B. Socket(String host, int port) C. Socket (Inetaddress ipAdd,int port) D. Socket ( String host,int port, Inetaddress ipAdd, int localport ) Answer optiond Marks: 1 246 Which of the following class is used to create client socket A. httpserver B. Datagram Socket C. Socket D. ClientSocket Answer optionc Marks: 1 What will be the output of following statements 247 Socket s1=Socket("localhost",1349); System.out.println(s1.getLocalPort()); A. 1349 B. port number of local machine C. local host D. localhost/1349 Answer optionb Marks: 2 248 Which of the following are Instance method of InetAddress Class A. byte[] getAddress() B. string getHostName() C. A and B D. static InetAddress getByName(string hostname) Answer optionc Marks: 1 Which constructor of DatagramSocket class is used to create a datagram 249 it with the given port number? A. DatagramSocket(int port) B. DatagramSoclet(int port InetAddress add) C. DatagramSoclet() D. None of the above Answer optiona Marks: 1 250 Which class is used for connection-less socket programming ? A. DatagramSoclet B. DatagramServer C. A and B D. None of the above Answer optiona Marks: 1 251 Which exception will occur if specified port number is not available f A. UnknownException B. SocketException C. UnknownSocketException D. UnknownPortException Answer optionb Marks: 1 Which of the following constructor is used to create datagram socket w 252 host address A. DatagramSoclet(int port) B. DatagramSoclet(int port InetAddress add) C. DatagramSoclet() D. A & B Answer optionb Marks: 1 253 Which constructor will you use to send packet? A. DatagramPacket(byte[] bar, int len) B. DatagramPacket(byte[] bar, int len, int port) C. DatagramPacket(string s1, int len, InetAddress, int port) D. All of the above Answer optionb Marks: 1 Java DatagramSocket and DatagramPacket classes are used for __________ 254 programming A. Connection-oriented B. Connection-less C. A & B D. Reliable Answer optionb Marks: 1 255 Datagram Packet is a message than can be used for _________ messages A. Connection-oriented or connection less B. send and store C. send and receive D. receive and read Answer optionc Marks: 1 256 Which constructors are used to receive data from packet? A. DatagramPacket(byte[] bar, int len) B. DatagramPacket(byte[] bar, int off, int len) C. DatagramPacket(string s1, int len, InetAddress, int port) D. A and B Answer optiond Marks: 1 257 getData() & getLenght() are the methods of ___________ class A. DatagramSoclet B. ServerSocket C. DatagramPacket D. ClientSocket Answer optionc Marks: 1 What is the output of following code? 258 DatagramPacket dp =new DatagramPacket(byte[] data, 1024); System.out.println(dp.getLength()); A. 1024 B. data, 1024 C. 1024, data D. Null Answer optiona Marks: 2 259 Find the correct code from following program for given output import java.awt.*; import javax.swing.*; public class JLabelDemo A. public void init() { Container contentPane = getContentPane(); ImageIcon ii = new ImageIcon("IC.jpg"); JLabel jl = new JLabel("IC", ii, JLabel.CENTER); contentPane.add(jl); } } import java.awt.*; import javax.swing.*; B. public class JLabelDemo extends JApplet { public void init() { Cont getContentPane(); ImageIcon ii = new ImageIcon("IC.jpg"); JLabel jl = new JLabel("IC", } } import java.awt.*; import javax.swing.*; public class JLabelDemo extends JApplet { C. public void init() { ImageIcon ii = new ImageIcon("IC.jpg"); JLabel jl = new JLabel("IC", ii, JLabel.CENTER); contentPane.add(jl); } } publi extends JApplet { public void init() { Container contentPane = getC D. ImageIcon ii = new ImageIcon("IC.jpg"); JLabel jl = new JLabel("IC", contentPane.add(jl); } } Answer optiona Marks: 2 Consider the following code and state the missing code. import java.sql.*; class Example1{ public static void main(String args[]){ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); 260 Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", PreparedStatement stmt=con.prepareStatement("insert into Emp values(?, ---------------------------------------------- int i=stmt.executeUpdate(); con.close(); }catch(Exception e){ System.out.println(e);} } } A. stmt.setInt(1,101); stmt.setString(2,"Ratan"); stmt.setString(2,50 B. stmt.setInt(1,101); stmt.setString(2,"Ratan"); stmt.setInt(3,50000 C. stmt.setInt(1,101); stmt.setString(2,2); stmt.setInt(3,50000); D. stmt.setInt(101); stmt.setString(2,2); stmt.setInt(3,50000); Answer optionb Marks: 2 261 Choose the correct code to display the following output. import javax.swing.*; public class JC JApplet implements ItemListener { JTextField jtf; public void init() { contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() new JCheckBox("C", true); cb.addItemListener(this); contentPane.add(cb C. JCheckBox("C++", false); cb.addItemListener(this); contentPane.add(cb) JCheckBox("Java", false); cb.addItemListener(this); contentPane.add(cb JCheckBox("Perl", false); cb.addItemListener(this); contentPane.add(cb JTextField(15); contentPane.add(jtf); } public void itemStateChanged(I JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText()); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JC JApplet implements ItemListener { JTextField jtf; public void init() { contentPane.add(cb); cb = new JCheckBox("C++", false); cb.addItemListe D. contentPane.add(cb); cb = new JCheckBox("Java", false); cb.addItemList contentPane.add(cb); cb = new JCheckBox("Perl", false); cb.addItemList contentPane.add(cb); jtf = new JTextField(15); contentPane.add(jtf); } itemStateChanged(ItemEvent ie) { JCheckBox cb = (JCheckBox)ie.getItem( jtf.setText(cb.getText()); } } Answer optionc Marks: 2 262 Choose the correct code to display the following output. import javax.swing.*; public class JBu JApplet implements ActionListener { JTextField jtf; public void init() contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() = new ImageIcon("green.jpg"); JButton jb = new JButton(france); jb.setActionCommand("Green"); jb.addActionListener(this); contentPane. germany = new ImageIcon("red.jpg"); jb = new JButton(germany); jb.setActionCommand("Red"); jb.addActionListener(this); contentPane.ad italy = new ImageIcon("yellow.jpg"); jb = new JButton(italy); jb.setActionCommand("Yellow"); jb.addActionListener(this); contentPane japan = new ImageIcon("black.jpg"); jb = new JButton(japan); jb.setActionCommand("Black"); jb.addActionListener(this); contentPane. JTextField(15); contentPane.add(jtf); } public void actionPerformed(Ac } import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JBu JApplet implements ActionListener { JTextField jtf; public void init() contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() = new ImageIcon("green.jpg"); JButton jb = new JButton(france); jb.setActionCommand("Green"); jb.addActionListener(this); contentPane. germany = new ImageIcon("red.jpg"); jb = new JButton(germany); C. jb.setActionCommand("Red"); jb.addActionListener(this); contentPane.ad italy = new ImageIcon("yellow.jpg"); jb = new JButton(italy); jb.setActionCommand("Yellow"); jb.addActionListener(this); contentPane japan = new ImageIcon("black.jpg"); jb = new JButton(japan); jb.setActionCommand("Black"); jb.addActionListener(this); contentPane. JTextField(15); contentPane.add(jtf); } public void actionPerformed(Ac jtf.setText(ae.getActionCommand()); import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JBu JApplet implements ActionListener { JTextField jtf; public void init() contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() = new ImageIcon("green.jpg"); JButton jb = new JButton(france); jb.setActionCommand("Green"); jb.addActionListener(this); contentPane. germany = new ImageIcon("red.jpg"); jb = new JButton(germany); D. jb.setActionCommand("Red"); jb.addActionListener(this); contentPane.ad italy = new ImageIcon("yellow.jpg"); jb = new JButton(italy); jb.setActionCommand("Yellow"); jb.addActionListener(this); contentPane japan = new ImageIcon("black.jpg"); jb = new JButton(japan); jb.setActionCommand("Black"); jb.addActionListener(this); contentPane. JTextField(15); contentPane.add(jtf); } public void actionPerformed(Ac jtf.setText(ae.getActionCommand()); } } Answer optiond Marks: 2 Choose the correct code to display the following output. 263 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JC JApplet implements ItemListener { JTextField jtf; public void init() { contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() new JCheckBox("C", true); cb.addItemListener(this); contentPane.add(cb A. JCheckBox("C++", false); cb.addItemListener(this); contentPane.add(cb) JCheckBox("Java", false); cb.addItemListener(this); contentPane.add(cb JCheckBox("Perl", false); cb.addItemListener(this); contentPane.add(cb JTextField(15); contentPane.add(jtf); } public void itemStateChanged(I JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText()); } } import javax.swing.*; public class JC JApplet implements ItemListener { JTextField jtf; public void init() { contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() new JCheckBox("C", true); cb.addItemListener(this); contentPane.add(cb C. JCheckBox("C++", false); cb.addItemListener(this); contentPane.add(cb) JCheckBox("Java", false); cb.addItemListener(this); contentPane.add(cb JCheckBox("Perl", false); cb.addItemListener(this); contentPane.add(cb JTextField(15); contentPane.add(jtf); } public void itemStateChanged(I JCheckBox cb = (JCheckBox)ie.getItem(); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JC D. JApplet implements ItemListener { JTextField jtf; public void init() { contentPane = getContentPane(); contentPane.setLayout(new FlowLayout() new JCheckBox("C", true); cb.addItemListener(this); contentPane.add(cb JCheckBox("C++", false); cb.addItemListener(this); contentPane.add(cb) JCheckBox("Java", false); cb.addItemListener(this); contentPane.add(cb JCheckBox("Perl", false); cb.addItemListener(this); contentPane.add(cb JTextField(15); contentPane.add(jtf); } public void itemStateChanged(I JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText()); Answer optiona Marks: 2 264 Choose the correct code to display the following output. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class J extends JApplet implements ItemListener { JLabel jl; ImageIcon green, public void init() { Container contentPane = getContentPane(); content A. FlowLayout()); JComboBox jc = new JComboBox(); jc.addItem("Green"); jc jc.addItem("Black"); jc.addItem("Yellow"); jc.addItemListener(this); c jl = new JLabel(new ImageIcon("green.jpg")); contentPane.add(jl); } pu itemStateChanged(ItemEvent ie) { String s = (String)ie.getItem(); jl.s ImageIcon(s + ".jpg")); } } import javax.swing.*; public class JScrollPaneDemo extends JApplet init() { Container contentPane = getContentPane(); contentPane.setLayo BorderLayout()); JPanel jp = new JPanel(); jp.setLayout(new GridLayout A. 0; for(int i = 0; i < 20; i++) { for(int j = 0; j < 20; j++) { jp.add( " + b)); ++b; } } int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NE ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp = v, h); contentPane.add(jsp, BorderLayout.CENTER); }} p JScrollPaneDemo extends JApplet { public void init() { Container conte getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel jp jp.setLayout(new GridLayout(20, 20)); int b = 0; for(int i = 0; i < 20 B. = 0; j < 20; j++) { jp.add(new JButton("Button " + b)); ++b; } } int v ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp = v, h); contentPane.add(jsp, BorderLayout.CENTER); } import java.awt.*; import javax.swing.*; public class Buttonexample extends Applet { B. init() { Button b1=new Button("ok"); Butt Button("cancel"); Button b3=new Button("exit"); add(b2);add(b1);add(b3); } } import java.awt.*; import java.applet.*; public class Buttonexample extends Applet { D. init() { Button b1=new Button("ok"); Butt Button("cancel"); Button b3=new Button("exit"); add(b3);add(b2);add(b1); } } Answer optionb Marks: 2 What is the output of the following code ? import java.awt.event.*; import java.awt.*; import javax.swing.*; class solution extends JFrame { static JFrame f; static JButton b, b1, b2, b3; 355 static JLabel l; public static void main(String[] args) { f = new JFrame("panel"); l = new JLabel("panel label"); b = new JButton("button1"); b1 = new JButton("button2"); b2 = new JButton("button3"); b3 = new JButton("button4"); JPanel p = new JPanel(new BorderLayout()); p.add(b, BorderLayout.NORTH); p.add(b1, BorderLayout.SOUTH); p.add(b2, BorderLayout.EAST); p.add(b3, BorderLayout.WEST) p.add(l, BorderLayout.CENTER); p.setBackground(Color.red); f.add(p); f.setSize(300, 300); f.show(); } } A. B. C. D. Answer optiona Marks: 2 356 In Swing ____________is a component that displays rows and columns of A. Tabpane B. Table C. Scrollpane D. None of the above Answer optionb Marks: 1 357 Which of the following method is used to display numerical values in a A. paint( ) B. drawstring( ) C. draw( ) D. convert( ) Answer optionb Marks: 1 Consider the following program What will be the output? import java.sql.*; class Example { public static void main(String srgs[]) { try 358 { Class.forname("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:STUD"); System.out.println("connection Established"); } catch(sQLException e) { System.out.pritln("SQL error"); } catch(Exc System.out.println("error"); }}} A. error ; missing B. Error } missing C. Connection Established D. SQL error Answer optionc Marks: 2 We can change the text to be displayed by an applet by supplying new t 359 a____________tag. A. B. C. D. Answer optiond Marks: 1 Which of the following is/are the possible values for alignment attrib 360 i) Top ii) Left iii) Middle iv) Baseline A. i, ii and iii only B. ii, iii and iv only C. i, iii and iv only D. All i, ii, iii and iv Answer optiond Marks: 1 We can change the text to be displayed by an applet by supplying new t 361 through________tag. A. SPACE=pixels B. HSPACE=pixels C. HWIDTH=pixels D. HBLANK=pixels Answer optionb Marks: 1 Debug the following program import java.awt.*; import javax.swing.*; public class JTableDemo extends JApplet { public void init() { Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); 362 final String[] colHeads = { "emp_Name", "emp_id", "emp_salary" }; final Object[][] data = { { "Ramesh", "111", "50000" }, { "Sagar", "222", "52000" }, { "Virag", "333", "40000" }, { "Amit", "444", "62000" }, { "Anil", "555", "60000" }, }; JTable table = new JTable(data,colHeads); int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h = HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp = new JScrollPane(table, v, h); contentPane.add(jsp, BorderLayout.CENTER);}} A. Error in statement in which JTable is created B. Error in statement in which JScrollPane is created C. Error in statement in which Horizontal Scrollbar is declared D. None of the above Answer optionc Marks: 2 __________attribute of applet tag specify the width of the space on th 363 will reserved for the applet. A. WIDTH=pixels B. HSPACE=pixels C. HWIDTH=pixels D. HBLANK=pixels Answer optiona Marks: 1 Consider following code and state missing code? import java.sql.*; class Demo1{ public static void main(String args[])throws Exception { try { Class.forName("_________________________________________"); 364 Connection con=DriverManager.getConnection("Jdbc:Odbc:demo"); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from student"); while(rs.next()) { System.out.println(rs.getInt(1)+" "+rs.getString(2)+" " +rs.getString( } catch(Exception e) {} } } A. sun.odbc.jdbc.OdbcJdbcDriver B. oracle.jdbc.driver.OracleDriver C. sun.jdbc.odbc.JdbcOdbcDriver D. None of the Above Answer optionc Marks: 2 365 What is the super class of container? A. java.awt.Container B. java.awt.Component C. java.awt.Panel D. java.awt.Layout Answer optionb Marks: 1 Following methods belongs to which class? 1) public void add(Component c) 366 2) public void setSize(int width,int height) 3) public void setLayout(LayoutManager m) 4) public void setVisible(boolean) A. Graphics class B. Component class C. Both A & B D. None of the above Answer optionb Marks: 1 367 __________is a server that is mediator between real web server and cli A. IBMServer B. SQLServer C. ReserverSockets D. Proxy server Answer optiond Marks: 1 368 Port number 80 is reserved for A. FTP B. Telnet C. e-mail D. HTTP Answer optiond Marks: 1 369 View Data helps you to maintain data when you move from -------------- A. Controller to View B. Temp Data C. Controller to Data D. None of above Answer optiona Marks: 1 370 What is the purpose of JTable? A. JTable object displays ONLY rows B. JTable object displays ONLY columns C. JTable object displays both rows and columns D. JTable object displays data in Tree form Answer optionc Marks: 1 371 MVC is composed of three components: A. Member Vertical Controller B. Model View Control C. Model View Controller D. Model Variable Centered Answer optionc Marks: 1 372 __________method is used to know the type of content used in the URL. A. ContentType() B. Contenttype() C. GetContentType() D. getContentType() Answer optiond Marks: 1 373 Which of the following is TRUE? A. Action method can be static method in a controller class B. Action method can be private method in a controller class C. Action method can be protected method in a controller class D. Action method must be public method in a controller class Answer optiond Marks: 2 374 Port number 25 is reserved for A. FTP B. Telnet C. SMTP D. HTTP Answer optionc Marks: 1 375 To hold component ___________ are used A. Container B. AWT C. Both D. None Answer optiona Marks: 1 376 What parameter we can pass to public int getInt() method? A. int columnIndex B. int row C. Both D. None of the above Answer optiona Marks: 1 Find the error in the following code : import java.awt.*; import javax.swing.*; public class test extends JApplet { public void init() { Container c=getContentPane(); JTabbedPane jp=new JTabbedPane(); JButton b1=new JButton("COMP.TECH"); p1.add(b1); JButton b2=new JButton("INFO.TECH"); 377 p1.add(b2); JButton b3=new JButton("ELEC.ENGG"); p1.add(b3); JButton b4=new JButton("FIRST"); p2.add(b4); JButton b5=new JButton("SECOND"); p2.add(b5); JButton b6=new JButton("THIRD"); p2.add(b6); jp.addTab("Branch",p1); jp.addTab("Year",p2); c.add(jp); } } A. JPanel p2=new JPanel(); JButton b3=new JButton(); B. variable p1 ,cannot find symbol C. D. jp.addTab() Answer optionb Marks: 2 378 List out few different return types of a controller action method A. View Result B. Javascript Result C. Redirect Result D. All of these Answer optiond Marks: 1 379 What are the steps for the execution of an MVC project? A. Receive first request for the application B. Performs routing C. Creates MVC request handler D. All of the above Answer optiond Marks: 1 Which method of a Frame object is used to place a GUI component (such 380 the Frame? A.. insert( Component c ) B. add( Component c ) C. draw( Component c ) D. click( Component c ) Answer optionb Marks: 1 381 Which of following is TRUE? A. The controller redirects incoming request to model B. The controller executes an incoming request C. The controller controls the data D. The controller render html to view Answer optionb Marks: 1 382 Which class is used to encapsulate IP address and DNS? A. URLConnection B. Telnet C. DatagramPacket D. netAddress Answer optiond Marks: 1 A JFrame supports three operations when the user closes the window. Wh 383 below is not one of the three: A. LOWER_ON_CLOSE B. DISPOSE_ON_CLOSE. C. DO_NOTHING_ON_CLOSE D. HIDE_ON_CLOSE. Answer optiona Marks: 1 384 What is the return type of getString() method? A. String B. int C. byte D. short Answer optiona Marks: 1 385 Which is the correct code for displaying following output import javax.swing.*; public class TableExample { TableExample(){ f=new JFrame(); String data[][ {"101","Amit","670000"}, {"102","Jai {"101","Sachin","700000"}}; String column[]={"ID","NAME"," A. JTable jt=new JTable(data,column); jt.setBounds(30,40,200, JScrollPane sp=new JScrollPane(jt); f.add(sp); f.setSize(300,400); f.setVisible(true); } publi main(String[] args) { } } import javax.swing.*; public class TableExample { TableExample(){ f=new JFrame(); String data[][ {"101","Amit","670000"}, {"102","Jai {"101","Sachin","700000"}}; String column[]={"ID","NAME"," B. JTable jt=new JTable(data,column); jt.setBounds(30,40,200, JScrollPane sp=new JScrollPane(jt); f.add(sp); public static void main(String[] args) { new TableExample( } import javax.swing.*; public class TableExample { TableExample(){ f=new JFrame(); String data[][ {"101","Amit","670000"}, {"102","Jai C. {"101","Sachin","700000"}}; String column[]={"ID","NAME"," JTable jt=new JTable(data,column); jt.setBounds(30,40,200, f.setSize(300,400); f.setVisible(true); } publi main(String[] args) { new TableExample(); } import javax.swing.*; public class TableExample { TableExample(){ f=new JFrame(); String data[][ D. {"101","Amit","670000"}, {"102","Jai {"101","Sachin","700000"}}; String column[]={"ID","NAME"," JTable jt=new JTable(data,column); jt.setBounds(30,40,200, JScrollPane sp=new JScrollPane(jt); f.add(sp); f.setSize(300,400); f.setVisible(true); } publi main(String[] args) { new TableExample(); } Answer optiond Marks: 2 Select correct output for following code: import javax.swing.*; import java.awt.event.*; class RadioButtonExample extends JFrame implements ActionListener{ JRadioButton rb1,rb2; JButton b; RadioButtonExample(){ rb1=new JRadioButton("Male"); rb1.setBounds(100,50,100,30); rb2=new JRadioButton("Female"); rb2.setBounds(100,100,100,30); ButtonGroup bg=new ButtonGroup(); bg.add(rb1);bg.add(rb2); b=new JButton("click"); 386 b.setBounds(100,150,80,30); b.addActionListener(this); add(rb1);add(rb2);add(b); setSize(300,300); setLayout(null); setVisible(true); } public void actionPerformed(ActionEvent e){ if(rb1.isSelected()){ JOptionPane.showMessageDialog(this,"You are Male."); } if(rb2.isSelected()){ JOptionPane.showMessageDialog(this,"You are Female."); } } public static void main(String args[]){ new RadioButtonExample(); }} A. B. C. D. Answer optiona Marks: 2 387 Port number 21 is reserved for A. FTP B. Telnet C. e-mail D. HTTP Answer optiona Marks: 1 388 Select the code for following output: import javax.swing.*; public class TabbedPaneExample { TabbedPane f=new JFrame(); JTextArea ta=new JTextArea(200,200); JPane p1.add(ta); JPanel p2=new JPanel(); JPanel p3=new JPanel() A. tp=new JTabbedPane(); tp.setBounds(50,50,200,200); tp.add( tp.add("visit",p2); tp.add("help",p3); f.add(tp); f.setLayout(null); f.setVisible(true); } public static void { new TabbedPaneExample(); }} import javax.swing.*; public class TabbedPaneExample { JFrame f; TabbedPaneExample(){ f=new JFrame(); JTextArea ta=new JTex JPanel p1=new JPanel(); p1.add(ta); JPanel p2=new JPanel() B. p3=new JPanel(); JTabbedPane tp=new JTabbedPane(); tp.setBounds(50,50,200,200); tp.add("main",p1); tp.add("vi tp.add("help",p3); f.add(tp); f.setSize(400,400); f.setVisible(true); } public static void main(String[] args) { TabbedPaneExample(); }} import javax.swing.*; public class TabbedPaneExample { JFrame f; TabbedPaneExample(){ f=new JFrame(); JTextArea ta=new JTex p1.add(ta); JPanel p2=new JPanel(); JPanel p3=new JPanel() C. tp=new JTabbedPane(); tp.setBounds(50,50,200,200); tp.add( tp.add("visit",p2); tp.add("help",p3); f.add(tp); f.setLayout(null); f.setVisible(true); } public static void { new TabbedPaneExample(); }} import javax.swing.*; public class TabbedPaneExample { JFrame f; TabbedPaneExample(){ f=new JFrame(); JTextArea ta=new JTex JPanel p1=new JPanel(); p1.add(ta); JPanel p2=new JPanel() D. p3=new JPanel(); JTabbedPane tp=new JTabbedPane(); tp.setBounds(50,50,200,200); f.add(tp); f.setSize(4 f.setLayout(null); f.setVisible(true); } public static void { new TabbedPaneExample(); }} Answer optionb Marks: 2 Which of the following statements are true. 1. ResultSet object can be moved forward only and it is not updatable. 2. The object of ResultSet maintains a cursor pointing to a row of a t 389 3. The statement interface is a factory of ResultSet 4. The performance of the application will be faster if you use Prepar interface A. 1,2,3 B. 2,4 C. 1,3,4 D. 1,2,3,4 Answer optiond Marks: 1 390 The Transmission Control Protocol A. Support fast transfer of packets B. support connectionless transport of packets C. support unreliable transport of packets D. support connection oriented transport of packets Answer optiond Marks: 1 391 Which of the following methods cannot be called on JLabel? A. setIcon() B. getText() C. setLabel() D. setBorderLayout() Answer optiond Marks: 1 392 User Datagram Protocol is__________ A. Support fast transfer of packets B. support connection-less transport of packets C. support unreliable transport of packets D. All of the above Answer optiond Marks: 1 393 A JTabbedPane does the following operations_____________________ A. arranges GUI components into layers such that only one layer is visibl B. allows users to access a layer of GUI components via a tab C. extends JComponent D. All of the above. Answer optiond Marks: 1 394 Where are the tabs on a JTabbedPane placed by default A. top B. bottom C.

Use Quizgecko on...
Browser
Browser