Class Test-2 AJP QB

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Class Test-2 Question Bank of

AJP
1. 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)
2. Which from the below use ―”Middle tier”.
(a) 3 tier
(b) 4 tier
(c) n – tier
(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 connection oriented
(b) is unreliable but connection oriented

(c) is reliable and connectionless

(d) None of these

5. Which class defines following methods? int getContentLength() long getDate( ) long getExpiration()

(a) URLConnection
(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) static

(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 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
10.Connection oriented communication 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) multiple
12. Microsoft 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 interface of JDBC


System.out.println(rs.getString(3)); API.
(a) Row Set
(b) Statement
(c) Connection
(d) Result Set

19. Which is main component of JDBC API?


(a) Driver Manager
(b) Driver
(c) Connection
(d) All of these

20. How many steps are used to connect java application 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) Native API partly – Java Driver
(c) JDBC – Net pure Java Driver
(d) Native Protocol Pure Java Driver

23. Which method executes an SQL statement that may return multiple results?
(a) executeUpdate( )
(b) executeQuery( )
(c) execute( )
(d) noExecute( )

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)

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

23. An application wants to invalidate the session both programmatically and


declaratively.Select the best match to do this.
(a) httpRequest.getSession( ).end() time_in_minutes
(b) httpRequest.getSession().invalidate() time_in_minutes
(c) httpRequest.getSession( ).close() time_in_minutes
(d) httpRequest.getSession().invalidate()time_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 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

26. is a small piece of information 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 http://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) Supporting protocol (d) All of the above

33. 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( )
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 time?


(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 functionality
(iii) runs only in windows OS
(iv) allows developers to customize any java enabled
server Options:
(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 platform-independent because they are written in java
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 thefunctionality of java class libraries

You might also like