AJPprelimssol
AJPprelimssol
1. Positions the components into five regions:east, west, north, south, center
2. Arranges the components as a deck of cards such that only one component is visible at a time
a) BorderLayout b) CardLayout c) GridLayout d) FlowLayout
6. _____________ refers to pure Java Driver that uses a middleware driver to connect to a
database
a. Type-1 Driver b. Type-2 Driver c. Type-3 Driver d. Type-4 Drive
7. Using which classes and interfaces of javax.sql package we can establish and manage
connection with the data source?
a. Only DataSource
b. DataSource and DataManager
c. DataSource and DriverManager
d. Only DriverManager
1
8. Which class is used for this Processing Method processActionEvent( )?
(a) Button,List,MenuItem (b) Button,Checkbox,Choice
(c) Scrollbar,Component,Button (d) None of the above
9. Which of the following method is used to determine the type of adjustment event?
a) getType( ) (b) getEventType( ) (c) getAdjustmentType( ) (d) getEventObjectType( )
12. The classes and interfaces defined in AWT are contained within the package.
a) java.awt.* b) java.sql.* c) java.io.* d) java.int
13. In adapter class ,it is sufficient to include only the methods required to override.
a) True b) false c) sometimes d) Never
14. The getStateChanged() method returns the state change.
a) The mouse pressed or released
b) Selected or deselected
c) A page up or page down
d) The window gain focus
15. Which method is used to establish connection between client and server.
2
17. In the method of servlet connection is created.
a) destroy() b)service() c) init() d) connect()
3
),GetSelectedIndex( ) c)getSelectedItem( ),getSelectedIndex( ) d)getselectedItem(
),getselectedIndex( )
30. Constuctors of scrollbar are
a) Scrollbar( ) ,Scrollbar(int style) ,Scrollbar(int style, int initialValue, int thumbSize)
b) Scrollbar( ), Scrollbar(int style) ,Scrollbar(int style, int initialValue, int thumbSize, int min
c) Scrollbar( ),Scrollbar(int style),Scrollbar(int style, int initialValue, int thumbSize, int max)
d) Scrollbar( ),Scrollbar(int style),Scrollbar(int style, int initialValue, int thumbSize, int
min, int max)
31. Which of the following method Write s and stack the trace for e to the server log?
a) void log(Exception e, String s) b) void log( String s) c) void log() d) None of
these
32. Which of the following method returns an enumeration with the name of servlets in the
same namespace in the server?
a)String getInitParameter(String param) b) Enumeration getInitParameterNames()
( c) Enumeration getServletNames() d) None of these
33. What does byte[ ] getData( ) method do?
a)Returns the byte array of data contained in the datagram b)Returns the port
number. c)Returns data in form of string d)returns length of
data
4
39. Which of the following class provides implementations of the basic life cycle methods for a
servlet.
a)Servlet InputStream Class b) GenericServlet Class
c) ServletException Class d) Servlet OutputStream Class
40. AbstractButton is a superclass for which components?
a) Combo boxes, check boxes, and lists b) push buttons, check boxes, and radio buttons.
c) Text fields, Text areas d)None of the above
41. Which of these events will be generated if we close the applet?
a)ActionEvent b)ItemEvent c)MouseEvent d)WindowEvent
42. Constructors for JTextField
a) JTextField( ) JTextField(int cols) , JTextField(String s, int cols) JTextField(String s)
b)Only JTextField( ) and JTextField(int cols)
c) both
d) none of the above
43. Name the method defined in EventObject class that returns the object generated from the
event.
(a) getEvent( ) (b) getObject( )
(c) getId( ) (d) getSource( )
44. The factory method ______ which takes an IP address and returns an InetAddress object.
a)getByName(String hostName) b)getLocalHost()
c)getAllByName(String hostName) d)getByAddress()
45. This interface lets you execute stored procedures.
a) java.sql.Statement b) java.sql.PreparedStatement
c) java.sql.ResultSet d) java.sql.CallableStatement
46. Which of the following interface enables the servlet to obtain information about their
environment?
a) ServletContext b) ServletConfig
c)ServletRequest d) ServletResponse
47. You can remove all controls by calling method.
a)remove() b)removeFrom()
c)Remove() d)removeAll( )
5
c)JTree(Object obj[]) , JTree(Vector v) , JTree(TreenNode tn)
d)None of these
49. Which of the following is not the method of handling window event?
(a) void windowClosed(WindowEvent we) (b) void windowClosing(WindowEvent we)
(c) void windowAfterClosing(WindowEvent we) (d) All of these
50. Which of the following Instance Method returns true if this object has the same Internet
address as other?
a)boolean isMulticastAddress() b)boolean equals(Object other)
c)String toString() d)byte[] getAddress()
51. Which of the following is/are charecteristics of JDBC
1) Supports a wide level of portability.
2) Provides Java Interfaces that are compatible with Java Applications . These providers
are also responsible for providing the driver services.
3) Provides higher level APIs for application programmers. The JDBC API specification is
used as an interface for the applications and DBMS.
4) (4)The JDBC call to a Java application is made by the SQL Statements. These
statements are resposible for entire communication with the database.
6
57. The scroll bar constants for scroll pane are defined in –
a) Scrollbar class b) ScrollPane class
c) ScrollPaneConstants class d) Component class
58. For the following code select the method that can be used to handle event.
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
59. _______ method Creates a socket connecting the local host to the named host and port.
a)Socket(String hostName, int port) b)Socket(InetAddress ipAddress, int port)
7
c)Both 1 & 2 d)None of the above
60. Determines if the session ID must be encoded in the URL identified as url. If so, returns the
modified version of url. Otherwise, returns url.
a)encodeRedirectURL(String url) b)encodeURL(String url)
c)encode(String url ) d)None of the above
import java.swing.*;
public class JLabelDemo extends JApplet
{
public void init()
{
Container contentPane = getContentPane();
ImageIcon ii = new ImageIcon("france.gif");
JLabel jl = new Jlabel("France", ii, JLabel.CENTER);
contentPane.add(jl);
}
}
8
66. class provides methods to handle HTTP requests and responses
a) HttpServlet b) Cookie
c) HttpSessionEvent d) None of the above
67. What is the Driver Interface used for?
a) To create Database Object that provide and entry point for database connectivity
b) to contains the results of executing an SQL query
c) To create Connection Object that provide an entry point for database connectivity.
d) none
68. A_______ is responsible for determining whether code executing in the Java runtime
environment has permission to perform a security sensitive operation.
a) Permission object b) security object
c) policy object d) all of above
69. How many options can be selected at a time in a JCheckBox?
a) Only one b) It is defined in the program
c) As many as you want d) JCheckBox isn’t a Swing
component
70. Find the error in the following code
import java.io.*;
import javax.servlet.*;
public class HelloServlet extends GenericServlet
{
public void service(ServletRequest request, ServletResponse response) throws
ServletException,IOException
{
response.setContentType(“text/html”);
PrintWriter pw = response.getOutputStream();
pw.println(“ Hello”);
pw.close();
a) import javax.servlet.*;
b) response.setContentType(“text/html”)
c) PrintWriter pw = response.getOutputStream();
d) None of these
71. MVC stands for
9
a) Model-View-Control b) Menu-View-Control
c) Menu-Visual-Control d) Model-View-Controller
10