Java Mock Test Set 3
Java Mock Test Set 3
3 3. Which of the following method is used to determine the type of adjustment event?
a. getType( ) b. getEventType( )
c. getAdjustmentType( ) d. getEventObjectType( )
5 8. The __________ package contains classes that help in connecting to a database, sending
SQL statements to the database and process the query request.
a. connection.sql b. db.sql
c. pkg.sql d. java.sql
5 10. In JDBC ______________ imports all Java classes that are concern with Database
connectivity.
a. javax.sql b. java.mysql
c. java.sql d. com.sql
5 12. Database programming using Java throws which of the following exception?
a. SQLException b. ClassNotFoundException
1|Page
c. None of these d. Both of these
6 16. Name the http method used to send resources to the server.
a. FTP method b. PUT method
c. WRITE method d. COPY method
4 17. If a program consists of three classes, then after compilation how many class files will be
created by the compiler?
a. one b. three
c. uncountable d. zero
2 18. Which of the following method is not applicable for Button in swing.
a. setDiableIcon( ) b. setPressedIcon( )
c. setSelectedIcon( ) d. setRollOverIcon( )
1 19. Which of the following does not have its default layout as BorderLayout.
a. Frame b. Dialog
c. JApplet d. All of Above
3 21. void keyTyped(KeyEvent ke) called when a key on the keyboard is ____________.
a. pressed and then released. b. pressed
c. released d. none of the above
2|Page
c. dataPermission( ) d. None of above
4 23. TCP does not supports Multicasting and Broadcasting because ______________.
a. It supports full duplex communication. b. It provides error control.
c. It provides flow control d. It is connection oriented protocol
5 24. In the below statement, which type of query can be used with executeUpdate( ) method.
statement.executeUpdate(query here)
a. Insert, Update, Delete b. Insert, Select, Delete
c. Only Select d. Any Query
1 27. Which of the following package is used for Graphical User Interface?
a. java.applet b. java.awt
c. java.awt.image d. java.io
6 29. Which JSP tag is used to transfer for processing another JSP page?
a. <jsp:include> b. <jsp:forward>
c. <jsp:useBean> d. <jsp:use:include>
3 31. The signature for the registration method for a ActionEvent should be _______.
a. public void addActionListener(ActionEvent L) b. public void setAction(ActionListener
L)
c. public void setActionListener(ActionListener L) d. public void
addActionListener(ActionListener L)
3|Page
6 33. An application wants to invalidate the session both programmatically and declaratively.
Select the best match to do this.
a. httpRequest.getSession( ).end( ) b.
<session-config> httpRequest.getSession( ).invalidate(
<session-timeout-interval>time_in_minutes )
</session-timeout-interval> <session-config>
</session-config> <session-timeout>time_in_minutes
</session-timeout>
</session-config>
c. httpRequest.getSession( ).close( ) d.
<session-config> httpRequest.getSession( ).invalidate( )
<session-timeout>time_in_minutes <session-config>
</session-timeout> <session-duration>time_in_minutes
</session-config> </session-duration>
</session-config>
1 39. The method ___________ places a Menu m into the MenuBar mb.
a. mb.addMenuItem(m) b. mb.addItem(m)
c. mb.add(m) d. None of these
4|Page
1 42. What is use of second parameter given in Label constructor : Label(String, int)
a. Specifies height of label in terms of pixels. b. specifies width of label in terms of
pixels.
c. specifies the alignment of text in label in terms of d. Specifies maximum numbers of
pixels. characters in label.
3 43. Name the method defined in EventObject class that returns the object generated from the
event.
a. getEvent( ) b. getObject( )
c. getId( ) d. getSource( )
4 47. Name the class which is used to create a port where the server will listen?
a. Server b. Socket
c. ServerSocket d. SocketServer
5 49. Native – protocol pure Java Driver converts _______ into the _________ directly.
a. JDBC calls, network protocol b. ODBC class, network protocol
c. ODBC class, user calls d. JDBC calls, user calls
5|Page
5 52. _____________ is a table of data which represents a data from table.
a. MetaData b. ResultSetMetaData
c. ResultSet d. Statement
6 54. ________ is a small piece of information that is passed back & forth in HTTP request &
response.
a. Servlet b. Applet
c. Cookie d. Session
6 56. A user types the URL http://www.msbte.com/result.php. Which request gets generated?
a. GET method b. POST method
c. HEAD method d. PUT method
1 57. Which of these classes can be added to any Container class, using the add method defined
in Container class?
a. Button b. CheckboxMenuItem
c. Menu d. MenuBar
6|Page
A) It is a way of logically grouping classes that are only used in one place.
B) It increases encapsulation.
C) It can lead to more readable and maintainable code.
a. Only A statement is true. b. Only B statement is true.
c. Only C statement is true. d. All A,B and C are true.
4 65. Which is the proper method to retrieve the host name of local machine?
a. static InetAddress getLocalHost( ) throws b. static InetAddress
UnknownHostException getByName(String host_name ) throws
UnknownHostException
c. static InetAddress getAllByName(String host_name d. String getHostAddress( )
) throws UnknownHostException
4 66. Which constructor of DatagramPacket class are used for receiving purpose?
a. DatagramPacket(byte data[ ], int size) b. DatagramPacket(byte data[ ], int
DatagramPacket(byte data[ ], int size, size, InetAddress
int offset, int port) ip, int port)
DatagramPacket(byte data[ ], int
offset, int size,
InetAddress ip, int port)
c. DatagramPacket(byte data[ ], int size) d. All of these
DatagramPacket(byte data[ ], int size,
InetAddress ip, int port)
7|Page
6 72. What the getSession( ) method with “true” parameter will do?
a. The session is completed b. The session object is passed to
another method
c. Creates new session if, the session does not exist d. The session is exist
8|Page