Java Mock Test Set 1
Java Mock Test Set 1
Java Mock Test Set 1
a. MenuComponent b. MenuContainer
c. ComponentMenu d. MenuBar
5. What is API?
a. Application Programming Interchange b. Application Programming
Interaction
c. Application Programming Interface d. None of these
10. Which of this package contains all the classes and methods required for event handling in Java.
a. java.applet b. java.awt
c. java.event d. java.awt.event
11. Name the method defined in EvenObject class that returns the object generated from the event.
a. getEvent( ) b. getObject( )
1|Page
c. getId( ) d. getSource( )
13. Name the class which is used to create a port where the server will listen.
a. Server b. Socket
c. ServerSocket d. SocketServer
16. How many steps are used to connect any java application with the database using JDBC?
a. 5 b. 4
c. 3 d. 6
18. Which class/interface is used for an SQL statement that is executed frequently?
a. Statement b. CallableStatement
c. PreparedStatement d. None of the above
2|Page
Panel
c. Component – Container – Panel d. Container – Component – Panel
28. In the give constructor what third parameter indicates : ScrollBar s = new ScrollBar(0,10,20,0,1000);
a. size of thumb b. minimum value
c. Increment value d. Initial Value
30. To send binary output in the response, the following method of HttpServlet response many be used
to get the appropriate Writer/Stream object.
a. getStream( ) b. getOutputStream( )
c. getBianaryStream( ) d. getWriter( )
31. Which class is used to represent a single line textbox with password character facility?
a. TextField b. TextArea
c. Label d. Checkbox
32. Which kind of driver converts JDBC calls into calls on the Client API for Oracle, Sybase, Informix, IBM
DB2, or other DBMS
a. JDBC ODBC bridge + ODBC Driver b. Native API partly – Java Driver
c. JDBC – Net pure Java Driver d. Native Protocol Pure Java Driver
33. Which method executes an SQL statement that may return multiple results?
a. executeUpdate( ) b. executeQuery( )
c. execute( ) d. noExecute( )
3|Page
a. public static ResultSet executeQuery( ) b. public ResultSet
executeQuery(String q)
c. public void executeQuery(String q) d. public int executeQuery(String q)
39. Clicking the closing button on the upper right corner of a frame generates a (n)-event.
a. ItemEvent b. WindowEvent
c. MouseMotionEvent d. ComponentEvent
40. To set the title to the Frame window ________ method is used.
a. void setTitle(String str) b. void setText(String str)
c. void settitle(String str) d. None of the above
41. Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Frame’s font is set to
12 point Times New Roman, the panel’s font is set 10 points Times New Roman and the Button’s font is
not set. What font will be used to display the Button’s label?
a. 12 point Times New Roman b. 11 point Times New Roman
c. 10 point Times New Roman d. 9 point Times New Roman
4|Page
45. Which method is used to specify before any lines that used the PrintWriter?
a. setPageType( ) b. setContextType( )
c. setContentType( ) d. setResponseType( )
46. Native API converts _________ into the ________ used by DBMS.
a. JDBC API, Network Protocol b. JDBC API, Native API calls
c. JDBC API, use calls d. JDBC API, ODBC API calls
51. Which of the following function is used to find the column count of the particular ResultSet.
a. getMetadata( ) b. metadata( )
c. getColumnCount( ) d. getCount( )
53. The class which encapsulates both the numerical IP address and the domain name for that address is
_____.
a. DatagramPacket b. DatagramSocket
c. InetAddress d. ServerSocket
54. ___________ positions are the components into 5 regions east, west, south, north, center.
a. CardLayout b. BorderLayout
c. GridLayout d. FlowLayout
55. Which of the following method must be overridden in the order to handle KeyEvent.
a. keyPressed(KeyEvent obj) b. KeyReleased(KeyEvent obj)
c. KeyTyped(KeyEvent obj) d. All of these
56. Which of these methods can be used to know the degree of adjustment made by the user?
a. getValue( ) b. getAdjustmentType( )
c. getAdjustmentValue( ) d. getAdjustmentAmount( )
5|Page
a. ComponentEvent b. ContainerEvent
c. ItemEvent d. InputEvent
60. The JDBC-ODBC bridge supports how many concurrent open statements per connection ?
a. 1 b. 0
c. Does not support connection d. None of these
63. The following methods belongs to the life cycle methods of the servlet.
a. init( ) b. service( )
c. destroy( ) d. All of the above
66. In this constructor ServerSocket(int port, int max_queue) what is the default value for max_queue?
a. 100 b. 50
c. 75 d. 80
6|Page
67. The constructor of URL can throw an exception called ______
a. MalformedUrlException b. UrlNotFoundException
c. UrlException d. UrlSourceNotFoundException
70. Which of the following method is used for send SQL statements?
a. Statement b. CallableStatement
c. PreparedStatement d. Both B & C
74. When there is a switching condition like ON or OFF, which control is used of following?
a. Button b. RadioButton
c. ToggleButton d. TextField
7|Page