1. Which of these is a not a factory method of InetAddress class?
(a) sta c InetAddress getLocalHost()
(b) sta c InetAddress getByName(String hostname)
(c) sta c InetAddress getAllName(String hostname)
(d) sta c InetAddress[ ] getAllByName(String
hostname)
2.Which from the below use ―”Middle er”.
(a) 3 er
(b) 4 er
(c) n – er
(d) all of the above
3. java.net package consists of interface
(a)ContentHandlerFactory
(b) SocketImplFactory
(c) FileNameMapandURLStreamHandlerFactor
(d)All of the above
4.Which of the following is true about TCP
protocol?
(a)is reliable and connec on oriented
(b)is unreliable but connec on oriented
(c) is reliable and connec onless
(d) None of these
5. Which class defines following methods? int getContentLength() long getDate( ) long getExpira on()
(a) URLConnec on
(b) Datagram
(c) Client
(d) None of these
6. Name the class which is used to create a port where the server will listen?
(a) Server
(b) Socket
(c) ServerSocket
(d) SocketServer
7. class Permission in java.security package is .
(a) sta c
(b) abstract
(c) final
(d) None of these
8.The class is used to create TCP server.
(a) Server
(b) SocketServer
(c) ServerSocket
(d) Socket
9.Which is the correct syntax for getLocalHost( ) method?
(a) public sta c InetAddress getLocalHost( ) throws UnknownHostExcep on
(b) public sta c IpAddress getLocalHost( ) throws UnknownHostExcep on
(c) public sta c String getLocalHost( ) throws UnknownHostExcep on
(d) public sta c void getLocalHost( ) throws UnknownHostExcep on
10.Connec on oriented communica on is possible using classes of Java.
(a) Socket and ServerSocket
(b) Datagram Socket and Datagram Packet
(c) Both of these
(d) None of these
11. A server socket can connect to clients.
(a) 1 (b) 2 (c) 10 (d) mul ple
12.Microso Access data in file format.
(a) .DAT (b) .MDB (c) .MSSQL (d) .OBJ
13. Which of the following method is used for send SQL statements?
(a) Statement (b) Callable Statement (c) Prepared Statement (d) Both B & C
14. DELETE statement of an SQL is executed by
(a) execute( ) (b) executeQuery() (c) executeUpdate( ) (d) executeDelete( )
15. The interface to the database is handle by
(a) ODBC (b) JDBC (c) JDBC&ODBC (d) APIs
16. Database Metadata are retrieved through
(a) getDatabaseMetadata( ) (b) getMetaData( ) (c) getDBMetaData( ) (d) getDatabaseMeta( )
17. 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
18. In following statement rs is an object of
System.out.println(rs.getString(3));
(a) Row Set
(b) Statement
(c) Connec on
(d) Result Set
19. Which is main component of JDBC API?
(a) Driver Manager
(b) Driver
(c) Connec on
(d) All of these
interface of JDBC
API.
20. How many steps are used to connect java applica on with the database using JDBC?
(a) 5 (b) 4 (c) 3 (d) 6
21. ODBC minimum SQL grammer contains
(a) Stored procedure
(b) Data, Time and TimeStamp only
(c) create or drop View
(d) Insert, update, delete only
22.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) Na ve API partly – Java Driver
(c) JDBC – Net pure Java Driver
(d) Na ve Protocol Pure Java Driver
23. Which method executes an SQL statement that may return mul ple results?
(a) executeUpdate( )
(b) executeQuery( )
(c) execute( )
(d) noExecute( )
21. Iden fy correct syntax of executeQuery( ) of Statement interface.
(a) public sta c ResultSet executeQuery( )
(b) public ResultSet executeQuery(String q)
(c) public void executeQuery(String q)
(d) public int executeQuery(String q)
22. Na ve API converts into the used by DBMS.
(a) JDBC API, Network Protocol
(b) JDBC API, Na ve API calls
(c) JDBC API, use calls
(d) JDBC API, ODBC API calls
23. An applica on wants to invalidate the session both programma cally and
Declara vely.Select the best match to do this.
(a) h pRequest.getSession( ).end() me_in_minutes
(b) h pRequest.getSession().invalidate() me_in_minutes
(c) h pRequest.getSession( ).close() me_in_minutes
(d) h pRequest.getSession().invalidate() me_in_minutes
24. The include( ) method in Request Dispatcher .
(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
25. State true or false for following statements.
(i) JavaBeans slow- down so ware development process.
(ii) Java Servlets do not have built- in mul threaded feature.
(a) false,false
(b) false, true
(c) true,false
(d) true, true
26. is a small piece of informa on that is passed back & forth in HTTP request
&response.
(a)Servlet (b) Applet (c) Cookie (d) Session
27. Which life cycle method is used to process a client‘s request?
a) start( ) (b) init( ) (c)service() (d) destroy( )
28. A user types the URL h p://www.msbte.com/result.php. Which request gets generated?
(a) GETmethod (b) POST method (c)Head method (d) PUT method.
29.ApacheTomcat is .
(a) Servlet
(b) Java Program
(c) API
(d) Webserver capable of running Java programs
30. 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
31. A JSP page consists of which tags?
(a) HTMLtags (b) JSP tags (c) Both A& B (d) None of the above
32. Life cycle of a servlet is managed by
(b) Servlet Context (b) Servlet Container (c) Suppor ng protocol (d) All of the above
33. To send binary output in the response, the following method of H pServlet response
many be used to get the appropriate Writer/Stream object.
(a) getStream()
(b) getOutputStream()
(c) getBianaryStream( )
(d) getWriter( )
34. is the first Phase of Servlet Life cycle.
(a) service()
(b) init()
(c) destroy()
(d) Both B & C
35. How many copies of a JSP page can be in memory at a me?
(c) 1 (b) 2 (c) 3 (d) Unlimited
36. Which method is used to specify before any lines that used the PrintWriter?
(a) setPageType( ) (b) setContextType( ) (c) setContentType( ) (d) setResponseType( )
37. is used to read data from a client request.
(a) ServletResponse (b) ServletRequest (c) Servlet (d) ServletConfig
38. The following methods belongs to the life cycle methods of the servlet.
(a) init( ) (b) service( ) (c) destroy( ) (d) All of the above
39. Java servlet
(i) is a key component of the server side java development.
(ii) is a small pluggable extension to a server that enhances func onality
(iii) runs only in windows OS
(iv) allows developers to customize any java enabled server
Op ons:
(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
40.Which of the following is true about servlets?
A. Servlets execute within the address space of web server
B. Servlets are pla orm-independent because they are wri en in java
C. Servlets can use the full func onality of the Java class libraries
D. Servlets execute within the address space of web server, pla orm independent and uses
thefunc onality of java class libraries