Assign3 Ajp Merged
Assign3 Ajp Merged
3. Which of these methods can be used to obtain the command name for invoking
ActionEvent object?
a) getCommand() b) getActionCommand() c) getActionEvent()
d) getActionEventCommand()
7. Which of these methods can be used to determine the type of adjustment event?
a) getType() b) getEventType() c) getAdjustmentType() d) getEventObjectType()
8. 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()
3. 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()
4. Which of these methods can be used to get reference to a component that was
removed from a container?
a) getComponent() b) getchild() c) getContainerComponent()
d) getComponentChild()
6. Which of these events is generated when computer gains or losses input focus?
a) ComponentEvent b) ContainerEvent c) FocusEvent d) InputEvent
8. Which of these methods can be used to know the type of focus change?
a) typeFocus() b) typeEventFocus() c) isTemporary() d) isPermanent()
6. Which of these methods is used to obtain the object that generated a WindowEvent?
a) getMethod() b) getWindow() c) getWindowEvent() d) getWindowObject()
Q. 2 Which of this class is used to create servers that listen for either local or remote client
programs?
(a) HttpServer (b) MimeHeader (c) HttpResponse (d) ServerSockets
Q. 8 -------- is a server that is mediator between real web server and client application.
(a) Host (b) H'ITP (c) Proxy (d) Web
Q.14 __ is a protocol for breaking and sending packets to an address across a network?
(a) TCIP b) IP (c) Socket
a) 0 b) 1 c) true d) false
Q. 30 A __ variable is shared by all instances of the class. It exists even before an object is
created.
(a) abstract (b) instance (c) interface (d) static
Q. 35 Which of these transfer protocol must be used so that URL can be accessed by
URLConnectionclass object?
(a) http (b) https (c) URL (d) None of the mentioned
Q. 39 Class which allows us to get real time data about private and protected member of a
class is __ .(a) java.io.security (b) java.GetInformation (c) ReflectPermission (d)
MembersPermission
Q. 40 The packages contain classes and interfaces used for input and output operations of a
program is __ .
(a) java.util (b) java.lang (c) java.io (d) java.file.io
a)sanfoundry b) sanfoundry.com
c) www.sanfoundry.com d) http://www.sanfoundry.com/javamcq
[A] Multithreaded
[B] Singlethreaded
[C] Both of the above
[D] none of the above
[A] JDBC is an API to connect to relational-, object- and XML data sources
[B] JDBC stands for Java DataBase Connectivity
[C] JDBC is an API to access relational databases,
[D] JDBC is an API to bridge the object-relational mismatch between OO programs and
relational databases
Q. 7. is an open source DBMS product that runs on UNIX, Linux and Windows.
[A] MySQL
[B] JSP/SQL
[C] JDBC/SQL
[D] Sun ACCESS
Q. 8 . Which JDBC driver Type(s) can be used in either applet or servlet code?.
[A] Both Type 1 and Type 2
[B] Both Type 1 and Type 3
[C] Both Type 3 and Type 4
[D] Type 4 only
Q.9. Where is metadata stored in MySQL?
[A] In the MySQL database metadata
[B] n the MySQL database metasql
[C] In the MySQL database mysql
[D] None of the above is correct.
Q. 10 . Which of the following methods are needed for loading a database driver in
JDBC?
[A] registerDriver() method
[B] Class.forName()
[C] Both A and B
[D] getConnection()
Q. 11 Which of the following statements is false as far as different type of statements is
concern in JDBC?.
[A] Regular Statement
[B] Prepared Statement
[C] Callable Statement
[D] Interim Statement
Q.12. Which of the following allows non repeatable read in JDBC Connection?
[A] TRANSACTION_READ_UNCOMMITTED
[B] TRANSACTION_READ_COMMITTED
[C] TRANSACTION_SERIALIZABLE
[D] TRANSACTION_REPEATABLE_READ
Q13. The JDBC-ODBC Bridge supports multiple concurrent open statements per
connection?
[A] True
[B] False
Q.14 Which type of Statement can execute parameterized queries?
[A] PreparedStatement
[B] ParameterizedStatement
[C] ParameterizedStatement and CallableStatement
[D] All kinds of Statements
Q15. How can you retrieve information from a ResultSet?
[A] By invoking the method get(..., String type) on the ResultSet, where type is the
database type
[B] By invoking the method get(..., Type type) on the ResultSet, where Type is an object
which represents a database type
[C] By invoking the method getValue(...), and cast the result to the desired Java type.
[D] By invoking the special getter methods on the ResultSet: getString(...),
getBoolean (...), getClob(...)
Q16. How can you execute a stored procedure in the database?
[A] Call method execute() on a CallableStatement object
[B] Call method executeProcedure() on a Statement object
[C] Call method execute() on a StoredProcedure object
[D] Call method run() on a ProcedureCommand object
Q20. For execution of DELETE SQL query in JDBC, method must be used.
A. executeQuery()
B. executeDeleteQuery()
C. executeUpdate()
D. executeDelete()
A - TRANSACTION_NONE
B - TRANSACTION_READ_COMMITTED
C - TRANSACTION_READ_UNCOMMITTED
D - TRANSACTION_WRITE_UNCOMMITTED
Q25 Which JDBC type represents a "single precision" floating point number that
supports seven digits of mantissa?
A. REAL
B. DOUBLE
C. FLOAT
D. INTEGER
Q26.Abbreviate the term UDA?
A. Unified Data Access
B. Universal Data Access
C. Universal Digital Access
D. Uniform Data Access
Q27.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()
Q26 .Which methods returns a stream that simply provides the raw bytes from the
database without any conversion?
A. getCharacterStream
B. getBinaryStream
C. getAsciiStream
D. getUnicodeStream
Q27 Which of the following contains both date and time?
A java.io.date
B java.sql.date
C
java.util.date
D java.util.dateTime
Q28 .Which of the following is used to call stored procedure?
A Statement
B PreparedStatement
C CallableStatment
D CalledStatement
Q29 Which of the following is used to limit the number of rows
returned? A setMaxRows(int i)
B setMinRows(int i)
C getMaxrows(int
i) D
getMinRows(int i)
Q30 .Which of the following is method of JDBC batch process
A setBatch()
B deleteBatch()
Cr emoveBatch()
D addBatch()
Q31. Which method is used to establish the connection with the specified url in a Driver
Manager class?
A. public static void registerDriver(Driver driver)
B. public static void deregisterDriver(Driver driver)
C. public static Connection getConnection(String url)
D. public static Connection getConnection(String url,String userName,String password)
Q32. Which JDBC type represents a 64-bit signed integer value between -
9223372036854775808 and 9223372036854775807?
A. SMALLINT
B. BIGINT
C. TINYINT
D. INTEGER
Q33 .Which model does a Java applet or application talks directly to the data source?
A. Two-tier models
B. Three-tier models
C. Both A & B
D. None of the above
Q34. What is the reason that a java program cannot directly communicate with an
ODBC driver?
A. ODBC written in C# language
B. ODBC written in C language
C. ODBC written in C++ language
D. None of the above
Q35. In the following JDBC drivers which is known as fully java driver?
A. Native-API driver
B. Network Protocol driver
C. Thin driver
D. Both B & C
Subject teacher
nd
Last date of submission is 2 Nov 23
MGM’s POLYTECHNIC
MGM’s campus, N-6, CIDCO, Aurangabad-431003, Tel: +91-240-2482893/2484693, Fax: 2482235
Date :25 October 2023
Assignment No. 5
Q 1 - Which of the following is the correct order of servlet life cycle phase methods?
A - init(), service(), destroy()
B - initialize(), service(), destroy()
C - init(), execute(), destroy()
D - init(), service(), delete()
Q 2 - Which of the following method can be used to get the value of form parameter?
A - request.getParameter()
B - request.getParameterValues()
C - request.getParameterNames()
D - None of the above.
Q 4 - Which of the following code retrieves name and version of the protocol?
A - Header.getProtocol()
B - response.getProtocol()
C - request.getProtocol()
D - None of the above.
Q 5 - Which of the following code indicates whether the response has been committed?
A - response.isCommitted()
B - request.isCommitted()
C - Header.isCommitted()
D - None of the above.
Q 6 - Which of the following code can be used to clear any data that exists in the buffer as well as
the status code and headers?
A - request.reset()
B - response.reset()
C - response.resetBuffer()
D - None of the above.
Q 9 - Which of the following code is used to get session id of a HTTP Session object in
servlets?
A - session.getSessionId()
B - session.getId()
C - session.getActiveId()
D - None of the above.
Q 12 - Which of the following method can be used to get complete list of all parameters in the
current request?
A - request.getParameter()
B -request.getParameterValues() C -
request.getParameterNames()
D - None of the above.
Q14 - Which of the following code retrieves name and version of the protocol?
A - Header.getProtocol()
B - response.getProtocol()
C - request.getProtocol()
D - None of the above.
Q 15 - Which of the following code encodes the specified URL for use in the sendRedirect method?
A - response.encodeRedirectURL(url)
B - request.encodeRedirectURL(url)
C - Header.encodeRedirectURL(url)
D - None of the above.
Q16 - Which of the following code can be used to clear the content of the underlying buffer in the
response without clearing headers or status code.
A - request.reset()
B - response.reset()
C - response.resetBuffer()
D - None of the above.
Q17 - Which of the following code can be used to set the locale of the response?
A - request.setLocale(locale)
B - response.setLocale(locale)
C - header.setLocale(locale)
D - None of the above.
A - This attribute gives exact error message which can be stored and analysed after storing in a
java.lang.String data type.
B - This attribute gives information about exception type which can be stored and analysed after
storing in a java.lang.Class data type.
C - This attribute gives status code which can be stored and analysed after storing in a
java.lang.Integer data type.
D - This attribute gives information about URL calling the servlet and it can be stored and
analysed after storing in a java.lang.String data type.
Q22 - Which of the following method can be used to get the multiple values of a parameter
like checkbox data?
A - request.getParameter()
B - request.getParameterValues()
C - request.getParameterNames()
D - None of the above.
Q 23 - Which of the following code is used to get names of the attributes in servlet?
A - response.getAttributeNames()
B - request.getAttributeNames()
C - Header.getAttributeNames()
D - None of the above.
Q 24 - Which of the following code retrieves any extra path information associated with the URL
the client sent?
A - Header.getPathInfo()
B - response.getPathInfo()
C - request.getPathInfo()
D - None of the above.
Q 25 - Which of the following code encodes the specified URL for use in the sendRedirect method?
A - response.encodeRedirectURL(url)
B - request.encodeRedirectURL(url)
C - Header.encodeRedirectURL(url)
D - None of the above.
Q 26 - Which of the following code can be used to add a header with the given name and integer
value?
A - request.addHeader(name,value)
B - response.addIntHeader(name,value)
C - Header.addDateHeader(name,value)
D - None of the above.
Q27 - Which of the following code can be used to set the character encoding for the body of
the response?
A - response.setCharacterEncoding(charset)
B - request.setCharacterEncoding(charset)
C - header.setCharacterEncoding(charset)
D - None of the above.
Q 29 - Which of the following way can be used to keep track of previous client request?
A - Using cookies.
B - Using hidden form fields.
C - Using URL rewriting.
D - All of the above.
Q 32 - Which of the following code is used to set content type of a page to be serviced using
servlet?
A - response.setContentType()
B - request.setContentType()
C - writer.setContentType()
D - None of the above.
Q 34 - Which of the following code retrieves the character encoding used in the body of this
request?
A - new CharacterEncoding()
B - response.getCharacterEncoding()
C - request.getCharacterEncoding()
D - None of the above.
Subject teacher