0% found this document useful (0 votes)
26 views21 pages

Ajp MCQS For Practice

Uploaded by

rahul13237
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views21 pages

Ajp MCQS For Practice

Uploaded by

rahul13237
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

AJP MCQS PT-2

CHP-4
Q. 1) UDP stands for ________.
(a)User Data Port
(b)User Datagram Protocol
(c)Used Data Provider
(d)User Data Protocol
Q. 2) Name the class which is used to create a port where the server will
listen.
(a)Server
(b)Socket
(c)ServerSocket
(d)SocketServer
Q. 3) Communication using TCP protocol is _____ and _______.
(a)Connection less, Iterative
(b)Collection less, concurrent
(c)Connection oriented, Iterative
(d)Connection oriented, concurrent
Q. 4) Which of these is a not a factory method of InetAddress class?
(a)static InetAddress getLocalHost( )
(b)static InetAddress getByName(String hostname)
(c)static InetAddress getAllName(String hostname)
(d)static InetAddress[ ] getAllByName(String hostname)
Q. 5) Which from the below use “Middle tier”.
(a)3 tier
(b)4 tier
(c)n – tier
(d)all of the above
Q. 6) java.net package consists of interface
(a)ContentHandlerFactory
(b)SocketImplFactory
(c)FileNameMap and URLStreamHandlerFactory
(d)All of the above

Q. 7) IPv6 uses __________.


(a)4 groups of 8 bits each
(b)4 group of 8 hexa‐decimal digits
(c)8 groups of 4 digits each
(d)8 groups of 4 hexa‐decimal digits each
Q. 8) Select full form of DNS.
(a)Data Network System
(b)Domain Name System
(c)Domain Name Server
(d)Domain Naming Service
Q. 9) What is the use of WriteUTF( ) method?
(a)This method writes a string into underlying output stream.
(b)This method reads a sting from underlying input stream.
(c)This method writes a byte array into underlying output stream.
(d)This method writes a character array into underlying output stream.
Q. 10) Which of these is a bundle of information passed between
machines?
(a) MIME
(b) Cache
(c) Datagram
(d) Socket
Q. 11) Port number for FTP is
(a) 21
(b) 23
(c) 25
(d) 80
Q. 12) 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

Q.13) int getServerPort( ) method _________.


(a)returns the port number on which this request was received.
(b)returns the port name on which the request was received.
(c)returns the server number on which this request was received.
(d)returns the port number on which this response/request was
received.
Q. 14) 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
Q. 15) The constructor of URL can throw an exception called ________.
(a)MalformedUrlException
(b)UrlNotFoundException
(c)UrlException
(d)UrlSourceNotFoundException
Q. 16) Which IP address is multicast IP address?
(a) 192.168.2.32
(b) 235.55.45.2
(c) 12.22.1.2
(d) None of these

Q. 17) Which 5 parameters uniquely identify a connection?


(a)Local IP, Remote IP, Local MAC, Remote MAC and Protocol
(b)Local IP, Local PORT, Remote MAC, Remote PORT and
Protocol
(c)Local MAC, Local PORT, Remote MAC, Remote PORT and Protocol
(d)Local IP, Local PORT, Remote IP, Remote PORT and Protocol
Q. 18) Select the method used to create URL connection.
(a) URL Connection
(b) open Connection
(c) URL
(d) URL Decoder
Q. 19) What value is returned by the readLine( ) method when it reach at
End of File?
(a) EOF
(b) null
(c) 0
(d) END
Q. 20) The class is used to create TCP server.
(a) Server
(b) SocketServer
(c) ServerSocket
(d) Socket

Q. 21) Which method of ServerSocket will wait for a client to initiate


communication and then communication with the client?
(a) wait( )
(b) connect( )
(c) waitForClient( )
(d) WaitForConnect( )

Q. 22) _______ method is used to retrieve file name specified in URL.


(a) getFile( )
(b) getUrl( )
(c) getFileUrl( )
(d) getLocalFile( )
Q. 23) is necessary to implement Datagram.
(a) DatagramPacket
(b) DatagramSocket
(c) Both A & B
(d) None of A & B

Q. 24) Which is the correct syntax for getLocalHost( ) method?


(a)public static InetAddress getLocalHost( ) throws
UnknownHostException
(b)public static IpAddress getLocalHost( ) throws
UnknownHostException
(c)public static String getLocalHost( ) throws UnknownHostException
(d)public static void getLocalHost( ) throws UnknownHostException
Q. 25) Which of these method of DatagramPacket class is used to find
the destination address?
(a) findAddress( )
(b) getAddress( )
(c) address( )
(d) whoIs( )
Q. 26) Connection oriented communication is possible Using classes of
Java.
(a)Socket and ServerSocket
(b)DatagramSocket and DatagramPacket
(c)Both of these
(d)None of these
Q. 27) A server socket can connect to clients.
(a) 1
(b) 2
(c) 10
(d) multiple
Q. 28) Resolver in DNS system maps.
(a)Domain name to IP address
(b)IP address to domain name
(c)Domain name to MAC address
(d)MAC address to IP address
Q. 29 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
CHP-5

Q. 1) 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
Q. 2) Which of the following is not a type of JDBC driver?
(a)100% pure Java Driver
(b)JDBC – net pure Java Driver
(c)JDBC – Native API driver
(d)JDBC – Native pure Java Driver
Q. 3) In JDBC imports all Java classes that are concern with Database
connectivity.
(a) javax.sql
(b) java.mysql
(c) java.sql
(d) com.sql
Q. 4) Database programming using Java throws which of the following
exception?
(a)SQLException
(b)ClassNotFoundException
(c)None of these
(d)Both of these
Q. 5) 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
Q. 6) What is purpose of next( ) method?
(a)to retain the next element in a series.
(b)to retain next table.
(c)to retain next record in a series.
(d)None of the above
Q. 7) 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
Q. 8) Choose the correct syntax for getConnection( ) method.
(a)public static Connection getConnection(String url, String password)
throws SQLException
(b)public static Connection getConnection(String name, String
password) throws SQLException
(c)public static Connection getConnection(String url, String name,
String password) throws SQLException
(d)public static Connection getConnection(String
url, String name) throws SQLException
Q. 9) SQL stands for.
(a)Structured Query Language
(b)Sequential Query Language
(c)Structured Question Language
(d)Sequential Question Language
Q. 10) _____ is a table of data which represents a data from table.
(a) MetaData
(b) ResultSetMetaData
(c) ResultSet
(d) Statement

Q. 11) Public class DriverManager extends ______.


(a) Object
(b) String
(c) Connection
(d) Statement

Q. 12) Which of the following method is supported by Statement


interface?
(a)public boolean execute(String query)
(b)public ResultSet executeQuery(String query)
(c)public int executeUpdate(String query)
(d)All of above
Q. 13) In following statement rs is an object of interface of JDBC API.
System.out.println(rs.getString(3));
(a) RowSet
(b) Statement
(c) Connection
(d) ResultSet
Q. 14) Which is main component of JDBC API?
(a) DriverManager
(b) Driver
(c) Connection
(d) All of these

Q. 15) How many steps are used to connect any java application with the
database using JDBC ?
(a) 5
(b) 4
(c) 3
(d) 6
Q. 16) ODBC minimum SQL grammer contains
(a)Stored procedure
(b)Data, Time and TimeStamp only
(c)create or drop View
(d)Insert, update, delete only

Q. 17) Which class/interface is used for an SQL statement that is


executed frequently?
(a)Statement
(b)CallableStatement
(c)PreparedStatement
(d)None of the above

Q. 18) What does the following code do : smt = con.createStatement( )


(a)A PreparedStatement object is created to send SQL commands to
database.
(b)A Statement object is created to send SQL commands to
database.
(c)A CallableStatement is created to send SQL commands to database.
(d)A Statement object is created to execute parameterized SQL
commands.
Q. 19) 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
Q. 20) Which method executes an SQL statement that may return
multiple results?
(a)executeUpdate( )
(b)executeQuery( )
(c)execute( )
(d)noExecute( )
Q. 21) Identify correct syntax of executeQuery( ) of Statement interface.
(a)public static ResultSet executeQuery( )
(b)public ResultSet executeQuery(String q)
(c)public void executeQuery(String q)
(d)public int executeQuery(String q)
Q. 22) 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
Q. 23) Which of the following function is used to find the column count
of the particular Result Set.
(a) getMetadata( )
(b) metadata( )
(c) getColumnCount( )
(d) getCount( )
Q. 24) 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

Q. 25) Select the correct method to create CallableStatement.


(a)CallableStatement prepareCall(String sql)
(b)CallableStatement prepareCall(String sql, int resultset type, int
resultset_concurrency)
(c)CallableStatement prepareCall(String sql, int resultset_type, int
resultset_concurrency, int resultset_holdability)
(d)All of the above
Q. 26) Microsoft Access data in file format.
(a) .DAT
(b) .MDB
(c) .MSSQL
(d) .OBJ
Q. 27 Which of the following method is used for send SQL statements?
(a) Statement
(b) CallableStatement
(c) PreparedStatement
(d) Both B & C
Q. 28) DELETE statement of an SQL is executed by ________.
(a) execute( )
(b) executeQuery( )
(c) executeUpdate( )
(d) executeDelete( )
Q. 29) The interface to the database is handle by _________.
(a) ODBC
(b) JDBC
(c) JDBC & ODBC
(d) APIs
CHP-6

Q. 1) JSP embeds in.


(a) Servlet, HTML
(b) HTML, Java
(c) HTML, Servlet
(d) Java, HTML
Q. 2) Which of the following is the default HttpRequest method?
(a) doGet( )
(b) doPost( )
(c) doTrace( )
(d) doPut( )
Q. 3) Which are true about tag libraries in web application?
(a)packaged in the /WEB‐INF directory or sub‐ directory of the WAR
file
(b)If a tag is implemented as a tag file and packaged in /WEB‐INF/tags/
or a sub‐ directory, a TLD will be generated automatically by the web
container, though, you can provide one if you wish.
(c)packaged in the /META‐INF/ directory or sub‐ directory of a tag
library packaged in a jar.
(d)All of the above.
Q. 4) Name the http method used to send resources to the server.
(a) FTP method
(b) PUT method
(c) WRITE method
(d) COPY method

Q. 5) Identify the proper syntax of doGet( ).


(a)void doGet(HttpResponse res,HttpRequest req) throws IOException,
ServletException
(b)void doGet(HttpRequest req,HttpResponse res) throws
IOException, ServletException
(c)void doGet(HttpResponse res) throws IOException, ServletException
(d)void doGet(HttpRequest req) throws IOException, ServletException
Q. 6) Given an HttpServletRequest request and HttpServletResponse
response instances. Which sets a cookie “username” with the value “joe”
in a servlet
(a)request.addCookie(new Cookie(“username” , “joe));
(b)response.addCookie(new Cookie(“username” , “joe”))
(c)request.addCookie(“username” , “joe);
(d)request.addCookie(“username” , “joe);
Q. 7) 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>
Q. 8) An application wants to invalidate the session both
programmatically and declaratively. Select the best match to do this.
(a)httpRequest.getSession( ).end( )
<session‐config><session‐timeout‐interval>
time_in_minutes </session‐timeout‐interval>
</session‐config>
(b)httpRequest.getSession( ).invalidate( )
<session‐config><session‐timeout>
time_in_minutes </session‐timeout>
</session‐config>
(c)httpRequest.getSession( ).close( )
<session‐config><session‐timeout>
time_in_minutes </session‐timeout>
</session‐config>
(d)httpRequest.getSession( ).invalidate( )
<session‐config> <session‐duration>
time_in_minutes </session‐duration>
</session‐config>

Q. 9) The include( ) method in RequestDispatcher.


(a)sends a request to another resource like servlet, JSP or html.
(b)includes resources of file like servlet, JSP or html.
(c)appends the request and response objects to the current servlet.
(d)None of these
Q. 10) State true or false for following statements.
(i)JavaBeans slow‐down software development process.
(ii)Java Servlets do not have built‐in multithreaded feature.
(a) false, false
(b) false, true
(c) true, false
(d) true, true

Q. 11) ___ is a small piece of information that is passed back & forth in
HTTP request & response.
(a) Servlet
(b) Applet
(c) Cookie
(d) Session

Q. 12) Which life cycle method is used to process a client’s request?


(a) start( )
(b) init( )
(c) service( )
(d) destroy( )

Q. 13) 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
Q. 14) Apache Tomcat is.
(a)Servlet
(b)Java Program
(c)API
(d)Web server capable of running Java programs
Q. 15) 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
Q. 16) A JSP page consists of which tags?
(a) HTML tags
(b) JSP tags
(c) Both A & B
(d) None of the above

Q. 17) Life cycle of a servlet is managed by


(a) Servlet Context
(b) Servlet Container
(c) Supporting protocol
(d) All of the above

Q. 18) 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( )

Q. 19) _____ is the first Phase of Servlet Life cycle.


(a) service( )
(b) init( )
(c) destroy( )
(d) Both B & C

Q. 20) How many copies of a JSP page can be in memory at a time?


(a) 1
(b) 2
(c) 3
(d) Unlimited
Q. 21) Which method is used to specify before any lines that used the
PrintWriter?
(a)setPageType( )
(b)setContextType( )
(c)setContentType( )
(d)setResponseType( )

Q. 22) is used to read data from a client request.


(a) ServletResponse
(b) ServletRequest
(c) Servlet
(d) ServletConfig

Q. 23) The following methods belongs to the life cycle methods of the
servlet.
(a) init( )
(b) service( )
(c) destroy( )
(d) All of the above

Q. 24) Java servlet


(i)is a key component of the server side java development.
(ii)is a small pluggable extension to a server that enhances functionality
(iii)runs only in windows OS
(iv)allows developers to customize any java enabled server
(a)i, ii and iii are true
(b)i,iii and iv are true
(c)ii,iii and iv are true
(d)i,ii and iv are true
Q. 25) Servlet lifecycle has states.
(a) Two
(b) Three
(c) Four
(d) Five

Q. 26) JSP life cycle includes number of phases.


(a) Two
(b) Three
(c) Four
(d) Five
Q. 27) How to send data in get method?
(a)using GET method in request
(b)using Requesting URL
(c)using Response URL
(d)using URL

You might also like