Adv. Java (1)
Adv. Java (1)
Tour2Tech
Page 1 of 38
UNIT - 1
a. Platform dependent
b. Platform Independent
c. Both A & B
d. None of Above
b. heavyweight
c. equal weight
d. None of Above
b. java.io package
c. javax.awt package
d. java.awt package
a. Component
b. List
c. Panel
d. MenuComponent
b. Jlabel
c. JTextField
d. JComboBox
b. WINDOW_CLOSED
c. WINDOW_DEICONIFIED
d. All of Above
a. EventObject
b. EventClass
c. ActionEvent
d. ItemEvent
d. None of Above
b. An event is an object that describes any change by the user and system
b. Item Listener
c. Mouse Listener
d. Component Listener
a. ContainerListener
b. ItemListener
c. ActionListener
d. MouseListener
a. RadioButton
b. JRadioButton
a. JFrame
b. Jwindow
c. Frame
d. SwingFrame
15. State true or false: Swing have more components than AWT.
a. False
b. True
a. None of Above
b. java.awt
c. java.swing
d. javax.swing
a. setText()
b. find()
c. getText()
d. Both a & c
19. Which of following components that do not support any interaction with the user?
a. Button
b. Checkbox
c. Labels
d. List
20. Which abstract class is the super class of all menu related classes?
a. CheckboxMenuItem
b. MenuBar
c. MenuComponent
d. MenuItem
21. Which can be used to represent a checkbox with a textual label that can
appear in a menu?
a. Menu
b. MenuBar
c. CheckboxMenuItem
d. MenuItem
c. Both A & B
d. None of Above
a. Component
b. JComponent
c. Container
d. None of Above
24. How many types of controls does AWT supports these controls are
subclasses of component?
a. 7
b. 5
c. 6
d. 8
d. None of Above
c. Creates the object TextField and initializes it with the value 10.
d. All of Above
27. Which statement creates a Text Area with 10 rows and 20 columns?
a. TextArea text = new TextArea(200);
d. None of Above
a. Choice
b. Checkbox
c. Combobox
d. List
29. State true or False: User can edit information displayed in Label at runtime.
a. False
b. True
30. How many line input takes from user in Text Field in AWT.
a. 1 c. 9
b. 3 d. None of above
UNIT - 2
31. Implement the Listener interface and overrides its methods is required to
perform in event handling
a. True
b. False
32. Which is the container that doesn't contain title bar and MenuBars
but it can have other components like button, textfield etc?
a. Window
b. Frame
c. Container
d. Panel
a. java.applet
b. java.awt
c. java.io
d. javax.swing
b. GetDisplayLanguage()
c. getDisplayLanguage()
d. None
a. Swing
b. AWT
c. Both A & B
37. Swing is not a part of JFC (Java Foundation Classes) that is used to create
GUI application?
a. True
b. False
a. java.awt
b. java.Graphics
c. java.awt.Graphics
39. These two ways are used to create a Frame by creating the object of Frame
class (association) by extending Frame class (inheritance)
a. True
b. False
b. stop() method
c. destroy() method
d. start() method
b. Exception Handling
c. String Handling
b. Other class
c. Anonymous class
b. java.awt.Graphic
c. java.awt.event
45. The ActionListener interface is not used for handling action events?
a. True
b. False
b. JCheckbox
c. JButton
d. All of these
b. False
48. In Graphics class which method is used to draws a rectangle with the
specified width and height?
b. public abstract void drawLine(int x1, int y1, int x2, int y2)
b. Choice
c. Checkbox
d. List
50. Which is used to store data and partial results, as well as to perform
dynamic linking, return values for methods, and dispatch exceptions?
a. Window
b. Pane
c. Container
d. Frame
a. Graphics class
b. Component class
c. Both A & B
a. True
b. False
a. True
b. False
a. Scrollbar,Component,Button
b. Button,Checkbox,Choice
c. Button,List,MenuItem
55. AWT has more powerful components like tables, lists, scroll panes,
color chooser, tabbed pane etc.
a. True
b. False
56. _____ allows java code to run in the JVM to call and be called by native
applications.
a. NIJ
b. JNI
c. FJI
d. JFI
a. False
b. True
58. What are the names of the list layout managers in Java?
a. Pixels
b. Nits
c. Inches
d. Dots
60. What is the name of the Swing class that is used for frames?
a. Window
b. Frame
c. SwingFrame
d. JFrame
UNIT – 3
62. Which of these packages contains all the classes and methods required
for even handling in Java?
a. java.awt.event
b. java.awt
c. java.event
d. java.applet
a. ComponentEvent
b. WindowEvent
c. AdjustmentEvent
d. ActionEvent
a. WindowEvent
b. ActionEvent
c. ComponentEvent
d. AdjustmentEvent
a. ItemEvent
b. ActionEvent
c. EventClass
d. EventObject
66. Which of these methods can be used to determine the type of event?
a. getEventObject()
b. getEvent()
c. getID( )
d. getSource()
a. java.util
b. java.net
c. java.lang
d. java.io
d. All of above
69. Which of these methods are used to register a mouse motion listener?
a. addMouseMotionListner()
b. addMouse()
c. addMouseListener()
d. eventMouseMotionListener()
70. Which of these methods are used to register a keyboard event listener?
a. addKeyListener()
b. eventKeyboardListener()
c. addKistener()
d. KeyListener()
c. An event is an object that describes any change by the user and system
a. ActionEvent
b. KeyEvent
c. WindowEvent
d. AdjustmentEvent
a. ALT_MASK
b. CTRL_MASK
c. SHIFT_MASK
a. ActionEvent
b. KeyEvent
c. WindowEvent
d. AdjustmentEvent
75. 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()
76. Which of these constant value will change when the button at the end of
scroll bar was clicked to increase its value?
a. BLOCK_DECREMENT
b. BLOCK_INCREMENT
c. UNIT_DECREMENT
d. UNIT_INCREMENT
77. Which of these methods can be used to determine the type of adjustment
event?
a. getType()
b. getEventType()
c. getAdjustmentType()
d. getEventObjectType()
78. Which of these methods can be used to know which key is pressed?
a. getKey()
b. getModifier()
c. getActionKey()
d. getActionEvent()
79. Which of these methods can be used to obtain the command name for
invoking ActionEvent object?
a. getCommand()
b. getActionCommand()
c. getActionEvent()
d. getActionEventCommand()
a. ComponentEvent
b. ContainerEvent
c. FocusEvent
d. InputEvent
a. getComponent()
b. getchild()
c. getContainerComponent()
d. getComponentChild()
a. ComponentEvent
b. ContainerEvent
c. FocusEvent
d. InputEvent
83. Which of these methods can be used to know the type of focus change?
a. typeFocus()
b. typeEventFocus()
c. isTemporary()
d. isPermanent()
a. WindowEvent
b. ComponentEvent
c. ItemEvent
d. InputEvent
a. ComponentEvent
b. ContainerEvent
c. ItemEvent
d. InputEvent
a. COMPONENT_HIDDEN
b. COMPONENT_MOVED
c. COMPONENT_RESIZE
87. Which of these methods can be used to obtain the reference to the
container that generated a ContainerEvent?
a. getContainer()
b. getContainerCommand()
c. getActionEvent()
d. getContainerEvent()
a. ComponentEvent
b. ContainerEvent
c. FocusEvent
d. InputEvent
a. WindowEvent
b. ComponentEvent
c. ItemEvent
d. InputEvent
b. WINDOW_CLOSED
c. WINDOW_DEICONIFIED
a. getX( ) b. getXCoordinate()
c. getCoordinateX() d. getPointX()
UNIT – 4
92. Which of these package contains classes and interfaces for networking?
a. java.io
b. java.util
c. java.net
d. java.network
a. TCP/IP
b. DNS
c. Socket
d. Proxy Server
94. How many ports of TCP/IP are reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
a. 8
b. 16
c. 32
d. 64
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
99. URL stands for Uniform Resource Locator and represents a resource
on the World Wide Web, such as a Web page or FTP directory.
a. True
b. False
a. Port
b. Cache
c. Log
d. All of above
101. Which of these class is used for operating on request from the client to
the server?
a. http
b. httpDecoder
c. httpConnection
d. httpd
102. Which of these interface abstractes the output of messages from httpd?
a. LogMessage
b. LogResponse
c. Httpdserver
d. httpdResponse
103. Which class is used to create servers that listen for either local client or
remote client programs?
a. httpServer
b. httpResponse
c. httpRequest
d. ServerSockets
104. The DatagramSocket and DatagramPacket classes are not used for
connection-less socket programming.
a. False
b. True
105. Which method of URL class represents a URL and it has complete set of
methods to manipulate URL in Java?
a. java.net.URLConnection
b. java.net.URL
c. Both A & B
a. DatagramSocket
b. DatagramPacket
c. Both A & B
a. DatagramSocket(int port)
b. DatagramSocket()
a. IPaddress of Server
b. Port number
c. Both A & B
111. The URLConnection class can be used to read and write data to the
specified resource referred by the URL
a. True
b. False
a. Socket
b. IP Address
c. MAC Address
d. Protocol
a. False
b. True
a. True
b. False
115. TCP, FTP, Telnet, SMTP, POP etc. are examples of?
a. Socket
b. Protocol
c. MAC Address
d. IP Address
116. Which of these class is used to create servers that listen for either local
or remote client programs?
a. httpServer
b. ServerSockets
c. MimeHeader
d. HttpResponse
a. http
b. https
c. Mime
d. httpd
118. Which of these methods is used to make raw MIME formatted string?
a. parse()
b. toString()
c. getString()
d. parseString()
a. string()
b. toString()
c. convertString()
d. getString()
120. Which of these class is used for operating on request from the client to
the server?
a. http
b. httpDecoder
c. httpConnection
d. httpd
121. In InetAddress class which method returns the host name of the IP
Address?
122. Which of these methods of httpd class is used to read data from the
stream?
a. getDta()
b. GetResponse()
c. getStream()
d. getRawRequest()
UNIT – 5
a. java.io.date
b. java.sql.date
c. java.util.date
d. java.util.dateTime
a. Slow performance
d. Better performance
a. Slow performance
a. java.sql.TimeStamp
b. java.sql.Time
c. java.io.Time
d. java.io.TimeStamp
a. Statement
b. PreparedStatement
c. CallableStatment
d. CalledStatement
129. Which of the following is used to limit the number of rows returned?
a. getMinRows(int i)
b. setMinRows(int i)
c. getMaxrows(int i)
d. setMaxRows(int i)
130. Which methods returns a stream that simply provides the raw bytes
from the database without any conversion?
a. getUnicodeStream
b. getAsciiStream
c. getCharacterStream
d. getBinaryStream
a. 1
b. 2
c. 3
d. 4
a. Sun
b. Microsoft
c. Google
d. Netscape
133. The intent is for JDBC drivers to implement nonscrollable result sets
using the support provided by the underlying database systems.
a. True
b. False
134. Which method drops all changes made since the previous
commit/rollback?
a. setBatch()
b. deleteBatch()
c. removeBatch()
d. addBatch()
a. rollback()
b. rollforward()
c. deleteTransaction()
d. RemoveTransaction()
a. TRANSACTION_NONE
b. TRANSACTION_READ_COMMITTED
c. TRANSACTION_REPEATABLE_READ
d. TRANSACTION_NONREPEATABLE_READ
a. True
b. False
140. How many Result sets available with the JDBC 2.0 core API?
a. 2
b. 4
c. 3
d. 6
141. Which method is used for retrieving streams of both ASCII and
Unicode characters is new in the JDBC 2.0 core API?
a. getUnicodeStream
b. getAsciiStream
c. getBinaryStream
d. getCharacterStream
142. Which JDBC type represents a "single precision" floating point number
that supports seven digits of mantissa?
a. FLOAT
b. DOUBLE
c. REAL
d. INTEGER
143. The JDBC API has always supported persistent storage of objects
defined in the Java programming language through the methods getObject
and setObject.
a. False
b. True
c. Methods on the ResultSet class for retrieving SQL SELECT results as Java types.
145. The ACID properties does not describes the transaction management
well.
a. False
b. True
146. Which method is used to establish the connection with the specified url
in a Driver Manager class?
a. CONCUR_READ_ONLY
b. CONCUR_UPDATABLE
c. All of the above
d. None of the above
148. Which driver Network connection is indirect that a JDBC client makes to
a middleware process that acts as a bridge to the DBMS server?
b. JDBC-ODBC bridge
c. JDBC-Net
149. JDBC RowSet is the wrapper of ResultSet,It holds tabular data like
ResultSet but it is easy and flexible to use.
a. False
b. True
150. Which kind of driver converts JDBC calls into calls on the client API for
Oracle, Sybase, Informix, IBM DB2, or other DBMS?
a. java.sql.Statement
b. java.sql.PreparedStatement
a. PreparedStatement Interface
b. CallableStatement Interface
153. Drivers that are JDBC Compliant should normally support scrollable
result sets, but they are not required to do so.
a. False
b. True
154. The ResultSet.next method is used to move to the next row of the
ResultSet, making it the current row.
a. True
b. False
UNIT – 6
a. Initialization
b. Constructor function
d. Setup() method
a. True
b. False
157. Which of the following code is used to get an attribute in a HTTP Session
object in servlets?
a. session.getAttribute(String name)
b. session.alterAttribute(String name)
c. session.updateAttribute(String name)
d. session.setAttribute(String name)
158. Which method is used to get three-letter abbreviation for locale’s country
in servlets?
a. Request.getISO3Country()
b. Locale.getISO3Country()
c. Response.getISO3Country()
d. Local.retrieveISO3Country()
a. False
b. True
b. creation time
c. session identifier
a. False
b. True
162. Which class provides stream to read binary data such as image etc. from
the request object?
a. ServletOutputStream
b. ServltInputStream
c. Both A & B
a. False
b. True
a. Socket Communication
b. HTTP Communication
c. RMI Communication
165. Which methods are used to bind the objects on HttpSession instance and
get the objects?
a. getAttribute
b. setAttribute
c. Both A & B
d. None of the above
166. Which type of ServletEngine is a server that includes built-in support for
servlets?
a. Standalone ServletEngine
b. Add-on ServletEngine
c. Embedded ServletEngine
a. HttpServlets
b. Genereic Servlets
168. Which cookie it is valid for single session only and it is removed each
time when the user closes the browser?
a. Non-persistent cookie
b. Persistent cookie
a. False
b. True
170. Web server is used for loading the init() method of servlet .
a. False
b. True
a. True
b. False
172. Which method is used to send the same request and response objects
to another servlet in RequestDispacher ?
a. sendRedirect()
b. forward()
c. Both A & B
173. Which packages represent interfaces and classes for servlet API?
a. javax.servlet.http
b. javax.servlet
c. Both A & B
a. POST
b. GET
c. BOTH A & B
175. Which class can handle any type of request so that it is protocol-
independent?
a. HttpServlet
b. GenericServlet
c. Both A & B
176. Which object is created by the web container at time of deploying the
project?
a. ServletContext
b. ServletConfig
c. Both A & B
178. Which of the following code retrieves the body of the request as binary
data?
a. The destroy() method is called only once at the end of the life cycle of a filter
b. The destroy() method is called after the filter has executed doFilter method
c. The destroy() method is called only once at the begining of the life cycle of a filter
c. Servlets can use the full functionality of the Java class libraries
d. Servlets execute within the address space of web server, platform independent and uses
the functionality of java class libraries
a. servlet container
b. servlet config
c. servlet context
d. servlet filter
a. URL rewriting
b. History
c. Cookies
d. SSL sessions
a. URL rewriting
c. SSL sessions
d. Cookies
a. URL rewriting
c. SSL sessions
d. Cookies
1. All these MCQ Questions are for practice & have taken from your syllabus.
2. Don’t Byheart, understand the concept.
3. Do more and more practice.
4. Read your Textbooks 1st and then practice this MCQ’s.
Motivational Quotes
Don’t Stress.
Do Your Best.