Pratice Question For Test AJP With Answer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

DEVRAJ PUBLICATIONS

DEPARTMENT OF COMPUTER ENGINEERING

THIRD YEAR (TY)

SCHEME: I SEMESTER: V
NAME OF SUBJECT: ADVANCE JAVA PROGRAMMING
Subject Code: 22517

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

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


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

Q. 3 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
Answer: b

Q. 4 Apache Tomcat is .
(a) Servlet
(b) Java Program
(c) API
(d) Web server capable of running Java programs
Answer: d

Q. 5 What the getSession( ) method with “true” parameter will do?


(a) The session is completed
(b) The session object is passed to another method
DEVRAJ PUBLICATIONS AJP MCQ

(c) Creates new session if, the session does not exist
(d) The session is exist
Answer: c

Q. 6 A JSP page consists of which tags?


(a) HTML tags
(b) JSP tags
(c) Both A & B
(d) None of the above
Answer: c

Q.7 The package contains classes that help in connecting to a database, sending SQL
statem en ts to the database and process the query reque st.
(a) connection.sql
(b) db.sql
(c) pkg.sql
(d) java.sql
Answer: a

Q. 8 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
Answer: d

Q. 9 In JDBC imports all Java classes that are concern with Database connectivity.
(a) javax.sql
(b) java.mysql
(c) java.sql
(d) com.sql
Answer: c

Q. 10 Database programming using Java throws which of the following exception?


(a) SQLException
(b) ClassNotFoundException
(c) None of these
(d) Both of these
Answer: d
Q. 11 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
Answer: a

Q. 12 What is purpose of next( ) method?


(a) to retain the next element in a series.
Page |2 DEVRAJ PUBLICATIONS 9209738826 AJP SEM-5 MCQ
DEVRAJ PUBLICATIONS AJP MCQ

(b) to retain next table.


(c) to retain next record in a series.
(d) None of the above
Answer: c

Q. 13 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
Answer: d

Q. 14 Choose the correct syntax for getConnection( ) method.


(a) public static Connection getConn ection(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 getConn ection(String url, String name) throws SQLException
Answer: c

15. Which class provides stream to read binary data such as image et(c) from the request
object?

A. ServletInputStream c. ServletOutputStream
b. Both a & b d. None Of Above

16. Life cycle of a servlet is managed by


a. Servlet Context c. Servlet Container
b. Supporting protocol d. All
17. Which method is used to retrieve the ResultSet created?
a. executeQuery( ) b) getResultSet( )
c )getResultSetResult d) All Above
18. Event Listeners are
a. Interface c. Adapter Class
b. Event d. Inner Class
19. Focus events are fired
whenever a component the focus
a. Gain c. Gain & Loses
b. Loses d. None Of Above
20. The interface to the database is handle by c) JDBC & ODBC
a. ODBC d) JDBC
b. API
21. ActionEvent Class is used for Which Controll ?
a. Button c. Button , List ,MenuItem
b. MenuItem d. List
22. How many types of driver are used to connect any java application with the database
using JDBC
Page |3 DEVRAJ PUBLICATIONS 9209738826 AJP SEM-5 MCQ
DEVRAJ PUBLICATIONS AJP MCQ

a) 2 c) 4
b) 5 d) 3
23. Which of the following is true about TCP protocol?.
a. is reliable and connection C.is unreliable but connection oriented
oriented D. None of these
B. is reliable and connectionless

24. A server socket can connect to clients?


A. 1 C. 3
B. multiple D. None Of Above

Page |4 DEVRAJ PUBLICATIONS 9209738826 AJP SEM-5 MCQ


DEVRAJ PUBLICATIONS AJP MCQ

25. Connection oriented communication is possible using classes of Java


a. Socket and ServerSocket c. Both of these
b. DatagramSocket and d. None of These
DatagramPacket

26. CheckBox implements following Listener Interface


a. ItemListener b) WindiwListener
c) FrameLstener d) MouseListener
27. ---------method is used to retrieve file name specified in URL.
a) getFile( ) c) getFileUrl( )
b) getUrl( ) d) ActionEvent
28. A is generated when a component is added to or removed
from a container.
a. WindowsEvent c) ContainerEvent
b)MouseMotionEvent d) None of the above
29. Adapter class belongs to the java.awt.event package?
A. True B. False
30. TextField generates----- events?
a. ActionEvent,TextEvent c. Focus Event
b. Both a & b d. None Of Above
31. A socket identifies in network.
a. communication point c) communication end point
b. communication with Server d) All Above
32. IP Stands for ? Edit Delete?
a. Internet Process
b. Internet Protocol
c. To specify a tooltip text for a component
d. To enable or disable user interaction with a component
33. TCP Stands for
a. Transfer Control Protocol
b. Temperory Class Protocol
c. Test Control Protocol
d. Transmission Control Protocol
34. UDP Stands for
a. User Data Protocol
b. User Datagram ProtocolUser Direction Protocol
c) User Duration Protocol

Q. 35 Which from the below use “Middle tier”.


(a) 3 tier
(b) 4 tier
(c) n – tier
(d) all of the above
Answer: d

Q. 36 java.net package consists of interface


(a) ContentHandlerFactory

Page |5 DEVRAJ PUBLICATIONS 9209738826 AJP SEM-5 MCQ


DEVRAJ PUBLICATIONS AJP MCQ

(b) SocketImplFactory
(c) FileNameMa p and URLStreamHandlerFactory
(d) All of the above
Answer: d

Q. 37 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
Answer: d

Q. 38 Select full form of DNS.


(a) Data Network System
(b) Domain Name System
(c) Domain Name Server
(d) Domain Naming Service
Answer: d

Q. 39 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.
Answer: c

Q. 40 Which of these is a bundle of information


passed between machines?
(a) MIME
(b) Cache
(c) Datagram
(d) Socket
Answer: c

Q. 41 Port number for FTP is


(a) 21
(b) 23
(c) 25
(d) 80
Answer: a
Q. 42 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
Answer: c

Q. 43 int getServerPort( ) method


Page |6 DEVRAJ PUBLICATIONS 9209738826 AJP SEM-5 MCQ
DEVRAJ PUBLICATIONS AJP MCQ

(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/req uest was received.
Answer: d

Q. 44 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
Answer: b

Q. 45 The constructor of URL can throw an exception called


(a) MalformedUrlException
(b) UrlNotFoundException
(c) UrlException
(d) UrlSourceNotFoundException
Answer: a

REQUIRED UNIT WISE IMP MCQ FOR ALL SUBJECTS ALL


BRANCH CONTACT US ON 9209738826 / 8097177771 .

Page |7 DEVRAJ PUBLICATIONS 9209738826 AJP SEM-5 MCQ

You might also like