Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

350+ Advance Java Programming MCQ's

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

1. Which of these package contains classes and interfaces for networking?

A. java.io

B. java.util

C. java.net

D. javax.swing

Answer» C. java.net

discuss

2. In the following URL, identify the protocol identifier? https://mcqmate.com:8080/course.php

A. http

B. gtu.ac.in

C. //mcqmate.com:80/course.php

D. 8080

Answer» A. http

discuss

3. Which of the following protocol follows connection less service?

A. TCP

B. TCP/IP

C. UDP

D. HTTP

Answer» C. UDP

discuss
Which of the following statement is NOT true?

4.

A. TCP is a reliable but slow.

B. UDP is not reliable but fast.

C. File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet

D. In HTTP, all communication between two computers are encrypted

Answer» D. In HTTP, all communication between two computers are encrypted

discuss

5. Which of the following statement is TRUE?

A. With stream sockets there is no need to establish any connection and data flows between the processes are as conti

B. Stream sockets are said to provide a connection-less service and UDP protocol is used

C. Datagram sockets are said to provide a connection-oriented service and TCP protocol is used

D. With datagram sockets there is no need to establish any connection and data flows between the processes are as pa

Answer» D. With datagram sockets there is no need to establish any connection and data flows between the processes ar

discuss

6. Which of the following method call is valid to obtain the server's hostname by invoking an applet?

A. getCodeBase().host()

B. getCodeBase().getHost()

C. getCodeBase().hostName()

D. getCodeBase().getHostName()

Answer» B. getCodeBase().getHost()

discuss
7. The server listens for a connection request from a client using which of the following statement?

A. Socket s = new Socket(ServerName, port);

B. Socket s = serverSocket.accept()

C. Socket s = serverSocket.getSocket()

D. Socket s = new Socket(ServerName);

Answer» B. Socket s = serverSocket.accept()

discuss

The client requests a connection to a server using which of the following statement?

8.

A. Socket s = new Socket(ServerName, port);

B. Socket s = serverSocket.accept();

C. Socket s = serverSocket.getSocket();

D. Socket s = new Socket(ServerName);

Answer» A. Socket s = new Socket(ServerName, port);

discuss

9. To connect to a server running on the same machine with the client, which of the following cannotbe used for the

A. “localhost”

B. "127.0.0.1"

C. InetAddress.getLocalHost(),

D. "127.0.0.0"

Answer» D. "127.0.0.0"

discuss
In the socket programming, for an IP address, which can be used to find the host name and IP address of a client/

10.

A. The ServerSocket class

B. The Socket class

C. The InetAddress class

D. The Connection interface

Answer» C. The InetAddress class

discuss

11. To create an InputStream on a socket, say s, which of the following statement is necessary?

A. InputStream in = new InputStream(s);

B. InputStream in = s.getInputStream();

C. InputStream in = s.obtainInputStream();

D. InputStream in = s.getStream();

Answer» B. InputStream in = s.getInputStream();

discuss

12. Which of the following protocols is/are for splitting and sending packets to an address across a network?

A. TCP/IP

B. FTP

C. SMTP

D. UDP

Answer» A. TCP/IP

discuss

13. Which of these is a protocol for breaking and sending packets to an address across a network?

A. TCP/IP

B. DNS
13. Which of these is a protocol for breaking and sending packets to an address across a network?

C. Socket

D. Proxy Server

Answer» A. TCP/IP

discuss

14. Which of these class is used to encapsulate IP address and DNS?

A. DatagramPacket

B. URL

C. InetAddress

D. ContentHandler

Answer» C. InetAddress

discuss

Which of the following type of JDBC driver, is also called Type 2 JDBC driver?

15.

A. JDBC-ODBC Bridge plus ODBC driver

B. Native-API, partly Java driver

C. JDBC-Net, pure Java driver

D. Native-protocol, pure Java driver

Answer» B. Native-API, partly Java driver

discuss

16. Which of the following type of JDBC driver, is also called Type 1 JDBC driver?

A. JDBC-ODBC Bridge plus ODBC driver

B. Native-API, partly Java driver


16. Which of the following type of JDBC driver, is also called Type 1 JDBC driver?

C. JDBC-Net, pure Java driver

D. Native-protocol, pure Java driver

Answer» A. JDBC-ODBC Bridge plus ODBC driver

discuss

17. Which of the following holds data retrieved from a database after you execute an SQL query using Statement obj

A. ResultSet

B. JDBC driver

C. Connection

D. Statement

Answer» A. ResultSet

discuss

18. Which of the following is not a valid type of ResultSet?

A. ResultSet.TYPE_FORWARD_ONLY

B. ResultSet.TYPE_SCROLL_INSENSITIVE

C. ResultSet.TYPE_SCROLL_SENSITIVE

D. ResultSet.TYPE_BACKWARD_ONLY

Answer» D. ResultSet.TYPE_BACKWARD_ONLY

discuss

Which of the following type of JDBC driver, uses database native protocol?

19.

A. JDBC-ODBC Bridge plus ODBC driver

B. Native-API, partly Java driver

C. JDBC-Net, pure Java driver

D. Native-protocol, pure Java driver

Answer» D. Native-protocol, pure Java driver


discuss

20. What is JDBC?

A. JDBC is a java based protocol.

B. JDBC is a standard Java API for database-independent connectivity between the Java programming language and a w

C. JDBC is a specification to tell how to connect to a database.

D. Joint Driver for Basic Connection

Answer» B. JDBC is a standard Java API for database-independent connectivity between the Java programming language a

discuss

21. Which of the following manages a list of database drivers in JDBC?

A. DriverManager

B. JDBC driver

C. Connection

D. Statement

Answer» A. DriverManager

discuss

22. Which of the following type of JDBC driver should be used if your Java application is accessing multiple types of d

A. Type 1

B. Type 2

C. Type 3

D. Type 4

Answer» C. Type 3

discuss

23. Which of the following is correct about JDBC?

A. JDBC architecture decouples an abstraction from its implementation.

B. JDBC follows a bridge design pattern.

C. Both of the above.


23. Which of the following is correct about JDBC?

D. None of the above.

Answer» C. Both of the above.

discuss

24. Which of the following step establishes a connection with a database?

A. Import packages containing the JDBC classes needed for database programming.

B. Register the JDBC driver, so that you can open a communications channel with the database.

C. Open a connection using the DriverManager.getConnection () method.

D. Execute a query using an object of type Statement.

Answer» C. Open a connection using the DriverManager.getConnection () method.

discuss

25. Which of the following is true about JDBC?

A. The JDBC API is an API to access different relational databases.

B. You use it to access relational databases without embedding a dependency on a specific database type in your code

C. JDBC stands for Java DataBase Connectivity.

D. All of the above.

Answer» D. All of the above.

discuss

How many Result sets available with the JDBC 2.0 core API?

26.

A. 2

B. 3

C. 4
How many Result sets available with the JDBC 2.0 core API?

26.

D. 5

Answer» B. 3

discuss

27. Which method is used to establish the connection with the specified url in a Driver Manager class?

A. public static void registerDriver(Driver driver)

B. public static void deregisterDriver(Driver driver)

C. public static Connection getConnection(String url)

D. public static Connection getConnection(String url,String userName,String password)

Answer» C. public static Connection getConnection(String url)

discuss

28. Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridg

A. JDBC-Net

B. JDBC-ODBC bridge

C. Native API as basis

D. Native protocol as basis

Answer» A. JDBC-Net

discuss

29. JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is easy and flexible to use.

A. True

B. False

C. none
29. JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is easy and flexible to use.

D. all

Answer» A. True

discuss

The ResultSet.next method is used to move to the next row of the ResultSet, making it the current row.

30.

A. True

B. False

C. none

D. all

Answer» A. True

discuss

31. Which JDBC product components does the Java software provide?

A. The JDBC driver manager

B. The JDBC driver test suite

C. The JDBC-ODBC bridge

D. All mentioned above

Answer» D. All mentioned above

discuss

32. Which class has traditionally been the backbone of the JDBC architecture?

A. the JDBC driver manager

B. the JDBC driver test suite

C. the JDBC-ODBC bridge

D. All mentioned above

Answer» A. the JDBC driver manager

discuss
33. Which was the first most widely used programming interface for accessing relational databases and it offers the a
databases on all the platforms.?

A. JDBC API

B. ODBC API

C. Both A & B

D. None of the above

Answer» B. ODBC API

discuss

34. JDBC is a Java API that is used to connect and execute query to the database

A. True

B. False

C. none

D. all

Answer» A. True

discuss

35. In the following JDBC drivers which is known as fully java driver?

A. Native-API driver

B. Network Protocol driver

C. Thin driver

D. Both B & C

Answer» D. Both B & C

discuss

36. Which JDBC drivers will run your program?

A. The JDBC-ODBC bridge

B. The JDBC driver manager

C. The JDBC driver test suite

D. None of the above


36. Which JDBC drivers will run your program?

Answer» C. The JDBC driver test suite

discuss

What is the reason that a java program cannot directly communicate with an ODBC driver?

37.

A. ODBC written in C# language

B. ODBC written in C language

C. ODBC written in C++ language

D. None of the above

Answer» B. ODBC written in C language

discuss

38. A leading database connectivity vendor, worked together to produce the ____.

A. JDBC-ODBC Bridge

B. JDBC Driver Test Suite

C. Both A & B

D. None of the above

Answer» C. Both A & B

discuss

39. Which driver converts JDBC calls directly into the vendor-specific database protocol?

A. Native - API driver

B. Network Protocol driver

C. Thin driver

D. Both B & C

Answer» C. Thin driver


discuss

40. Which models do the JDBC API support for the database access?

A. Two-tier models

B. Three-tier models

C. Both A & B

D. None of the above

Answer» C. Both A & B

discuss

41. Which of the following JDBC drivers is known as a partially java driver?

A. JDBC-ODBC bridge driver

B. Native-API driver

C. Network Protocol driver

D. Thin driver

Answer» B. Native-API driver

discuss

42. The JDBC API is what allows access to a data source from a Java middle tier

A. True

B. False

C. none

D. all

Answer» A. True

discuss

43. Which driver uses ODBC driver to connect to the database?

A. JDBC-ODBC bridge driver

B. Native - API driver

C. Network Protocol driver


43. Which driver uses ODBC driver to connect to the database?

D. Thin driver

Answer» A. JDBC-ODBC bridge driver

discuss

How many JDBC product components does the Java software provides?

44.

A. 3

B. 2

C. 4

D. 5

Answer» A. 3

discuss

45. How many types of JDBC drivers are available?

A. 3

B. 4

C. 2

D. 5

Answer» B. 4

discuss

46. Which method is used for an SQL statement that is executed frequently?

A. prepareStatement

B. prepareCall

C. createStatement
46. Which method is used for an SQL statement that is executed frequently?

D. None of the above

Answer» A. prepareStatement

discuss

Chapter: Servlet and Overview

47. How is the dynamic interception of requests and responses to transform the information done?

A. servlet container

B. servlet config

C. servlet context

D. servlet filter

Answer» D. servlet filter

discuss

Which type of ServletEngine is a server that includes built-in support for servlets?
48.

A. Add-on ServletEngin

B. Embedded ServletEngine

C. Standalone ServletEngine

D. None of the above

Answer» C. Standalone ServletEngine

discuss

49. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()?

A. Genereic Servlets

B. HttpServlets

C. All of the above

D. None of the above

Answer» B. HttpServlets

discuss
50. Which cookie it is valid for single session only and it is removed each time when the user closes the browser?

A. Persistent cookie

B. Non-persistent cookie

C. All the above

D. None of the above

Answer» B. Non-persistent cookie

51. Sessions is a part of the SessionTracking and it is for maintaining the client state at server side.

A. True

B. False

C. none

D. all

Answer» A. True

discuss

52. When destroy() method of a filter is called?

A. The destroy() method is called only once at the end of the life cycle of a filter

B. The destroy() method is called after the filter has executed doFilter method

C. The destroy() method is called only once at the begining of the life cycle of a filter

D. The destroyer() method is called after the filter has executed

Answer» A. The destroy() method is called only once at the end of the life cycle of a filter

discuss

53. Web server is used for loading the init() method of servlet.

A. True

B. False

C. none

D. all

Answer» A. True

discuss
54. Servlets handle multiple simultaneous requests by using threads.

A. True

B. False

C. none

D. all

Answer» A. True

discuss

Which method is used to send the same request and response objects to another servlet in RequestDispacher ?

55.

A. forward()

B. sendRedirect()

C. Both A & B

D. None of the above

Answer» A. forward()

discuss

56. The sendRedirect() method of HttpServletResponse interface can be used to redirect response to another resourc
html file

A. True

B. False

C. none

D. all

Answer» A. True

discuss

57. Which packages represent interfaces and classes for servlet API?

A. javax.servlet

B. javax.servlet.http
57. Which packages represent interfaces and classes for servlet API?

C. Both A & B

D. None of the above

Answer» C. Both A & B

discuss

58. Which class can handle any type of request so that it is protocol-independent?

A. GenericServlet

B. HttpServle

C. Both A & B

D. None of the above

Answer» A. GenericServlet

discuss

59. Which HTTP Request method is non-idempotent?

A. GET

B. POST

C. Both A & B

D. None of the above

Answer» C. Both A & B

discuss

60. Which object is created by the web container at time of deploying the project?

A. ServletConfig

B. ServletContext

C. Both A & B

D. None of the above

Answer» B. ServletContext

discuss
61. What is the lifecycle of a servlet?

A. Servlet class is loaded

B. Servlet instance is created

C. init,Service,destroy method is invoked

D. All mentioned above

Answer» D. All mentioned above

discuss

Which method in session tracking is used in a bit of information that is sent by a web server to a browser and wh
from that browser?

62.

A. HttpSession

B. URL rewriting

C. Cookies

D. Hidden form fields

Answer» C. Cookies

discuss

63. Which are the examples of Application Server?

A. Apache

B. Tomcat

C. JBoss

D. Weblogic

Answer» C. JBoss

discuss

64. How many techniques are used in Session Tracking?

A. 4
64. How many techniques are used in Session Tracking?

B. 3

C. 2

D. 5

Answer» A. 4

discuss

In HTTP Request method Get request is secured because data is exposed in URL bar
65.

A. True

B. False

C. none

D. all

Answer» B. False

discuss

66. In the following statements identify the disadvantages of CGI?

A. If number of clients increases, it takes more time for sending response

B. For each request, it starts a process and Web server is limited to start processes

C. It uses platform dependent language e.g. C, C++, perl

D. All mentioned above

Answer» D. All mentioned above

discuss

67. Servlet technology is used to create web application

A. True

B. False

C. none

D. all
69. What are functions of Servlet container?

A. Lifecycle management

B. Communication Support

C. Multithreading Support

D. All of the above

Answer» D. All of the above

67. Servlet technology is used to create web application

Answer» A. True

discuss

68. Which method is used to specify before any lines that uses the PintWriter?

A. setPageType()

B. setContextType()

C. setContentType()

D. setResponseType()

Answer» C. setContentType()

discuss

discuss

70. Which object of HttpSession can be used to view and manipulate information about a session?

A. session identifier

B. creation time

C. last accessed time

D. All mentioned above

Answer» D. All mentioned above

discuss

71. Which methods are used to bind the objects on HttpSession instance and get the objects?

A. setAttribute

B. getAttribute

C. Both A & B

D. None of the above


71. Which methods are used to bind the objects on HttpSession instance and get the objects?

Answer» C. Both A & B

discuss

72. Which method take a string not a URL?

A. sendRedirect

B. forward

C. Both

D. None

Answer» A. sendRedirect

discuss

73. Which of the following are interface?


1. ServletContext
2. Servlet
3. GenericServlet
4. HttpServlet

A. 1,2,3,4

B. 1,2

C. 1,2,3

D. 1,4

Answer» B. 1,2

discuss

74. The life cycle of a servlet is managed by

A. servlet context

B. servlet container

C. the supporting protocol (such as http or https)

D. All of the above

Answer» B. servlet container

discuss
75. Which of the following code is used to get an attribute in a HTTP Session object in servlets?

A. session.getAttribute(String name)

B. session.alterAttribute(String name)

C. session.updateAttribute(String name)

D. session.setAttribute(String name)

Answer» A. session.getAttribute(String name)

discuss

What is the difference between servlets and applets? i. Servlets execute on Server; Applets execute on browser ii
has GUI iii. Servlets creates static web pages; Applets creates dynamic web pages iv. Servlets can handle only a sin
handle multiple requests
76.

A. i, ii, iii are correct

B. i, ii are correct

C. i, iii are correct

D. i, ii, iii, iv are correct

Answer» B. i, ii are correct

discuss

77. Which are the session tracking techniques? i. URL rewriting ii. Using session object iii.Using response object iv. Us
cookies vi. Using servlet object

A. i, ii, iii, vi

B. i, ii, iv, v

C. i, vi, iii, v

D. i, ii, iii, v

Answer» B. i, ii, iv, v

discuss

78. A deployment descriptor describes

A. Web component response settings

B. Web component setting


79. The values of <servlet-name> and <servlet-class> in web.xml file

A. must be same

B. must not be same

C. may be same

D. None of the above

Answer» C. may be same

78. A deployment descriptor describes

C. Web component request objects

D. All of the above

Answer» B. Web component setting

discuss

discuss

Chapter: JSP

80. Which one is the correct order of phases in JSP life cycle?

A. Initialization, Cleanup, Compilation, Execution

B. Initialization, Compilation, Cleanup, Execution

C. Compilation, Initialization, Execution, Cleanup

D. Cleanup, Compilation, Initialization, Execution

Answer» C. Compilation, Initialization, Execution, Cleanup

discuss

81. Which technology do we mix our business logic with the presentation logic?

A. Servlet

B. JSP

C. Both A and B

D. None of the above

Answer» A. Servlet

discuss

82. Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current pag

A. The ErrorPage Attribute

B. The IsErrorPage Attribute


82. Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current pag

C. Both A & B

D. None of the above

Answer» A. The ErrorPage Attribute

discuss

83. The ASP and JSP technologies are quite similar in the way they support the creation of Dynamic pages, using HTM
and components for business logic.

A. True

B. False

C. none

D. all

Answer» A. True

discuss

84. Which of the following is an advantage of the statement – Separation of business logic from JSP ?

A. Custom Tags in JSP

B. JSP Standard Tag Library

C. All the above

D. None of the above

Answer» A. Custom Tags in JSP

discuss

85. JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java servlets.

A. True

B. False

C. none

D. all

Answer» A. True

discuss
86. JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface (CGI)

A. True

B. False

C. none

D. all

Answer» A. True

discuss

87. Which is the Microsoft solution for providing dynamic Web content?

A. ASP

B. JSP

C. Both A and B

D. None of the above

Answer» A. ASP

discuss

88. Which tag is used to execute java source code in JSP?

A. Declaration Tag

B. Scriptlet tag

C. Expression tag

D. None of the above

Answer» B. Scriptlet tag

discuss

89. A JSP page consists of which tags?

A. HTML tags

B. JSP tags

C. Both A & B

D. None of the above

Answer» C. Both A & B

discuss
90. Which packages does a JSP API consist of?

A. javax.servlet.jsp

B. java.servlet

C. javax.servlet.jsp.tagext

D. Both A & C

Answer» D. Both A & C

discuss

91. Which of the scripting of JSP not putting content into service method of the converted servlet?

A. Declarations

B. Scriptlets

C. Expressions

D. None of the above

Answer» C. Expressions

92. The difference between Servlets and JSP is the …………….

A. translation

B. compilation

C. syntax

D. Both A and B

Answer» C. syntax

93. Which of the following are the valid scopes in JSP?

A. request, page, session, application

B. request, page, session, global

C. response, page, session, application

D. request, page, context, application


93. Which of the following are the valid scopes in JSP?

Answer» A. request, page, session, application

94. JSP includes a mechanism for defining …………………………. or custom tags.

A. static attributes

B. local attributes

C. dynamic attributes

D. global attributes

Answer» C. dynamic attributes

95. Why DB connections are not written directly in JSPs?

A. Response is slow

B. Not a standard J2EE architecture

C. Load Balancing is not possible

D. Both B and C

Answer» D. Both B and C

96. Which is not a directive?

A. include

B. page

C. export

D. taglib

Answer» C. export

97. Which http method send by browser that asks the server to get the page only?

A. get
97. Which http method send by browser that asks the server to get the page only?

B. option

C. put

D. post

98. Which tag should be used to pass information from JSP to included JSP?

A. Using <%jsp:page> tag

B. Using <%jsp:param> tag

C. Using <%jsp:import> tag

D. Using <%jsp:useBean> tag

Answer» B. Using <%jsp:param> tag

99. _jspService() method of HttpJspPage class should not be overridden.

A. True

B. False

C. none

D. all

Answer» A. True

100. Which is not a directive?

A. include

B. page

C.
export

D. useBean

Answer» C. export

101. Attribute used to handle web flow requests.

A. servlet-mapping
99. _jspService() method of HttpJspPage class should not be overridden.

B. servlet-attr

C. servlet-flow

D. servlet-requests

Answer» A. servlet-mapping

discuss

102. To resolve Facelets views we configure:

A. ViewFacelets

B. ViewResolver

C. View-resolver

D. View_Resolver

Answer» B. ViewResolver

discuss

103. File extension of a view state’s name which is by default loaded by facelet page.

A. .xml

B. .hbm.xml

C. .xhtml

D. none of the mentioned

Answer» C. .xhtml

discuss

104. Navigation in traditional JSF applications is handled by:

A. linking directly linking to a resource

B. commandLink

C. invoking an action

D. all of the mentioned

Answer» D. all of the mentioned

discuss
105. For cross field validation or some sort of barrier to ensure state before you start a flow, we use.

A. FacesContext

B. FaceletContext

C. FacesResolver

D. All of the mentioned

Answer» A. FacesContext

discuss

106. Component which additionally provides a pop-up date picker control for its enclosed input field.

A. clientDateValidator

B. clientValidator

C. dateValidator

D. validator

Answer» A. clientDateValidator

discuss

107. Component which encloses command button.

A. validateAll

B. validateAllClick

C. validateAllInClick

D. validateAllOnClick

Answer» C. validateAllInClick

discuss

Chapter: Hibernate

108. Which of the following is not a core interface of Hibernate?

A. Configuration

B. Criteria

C. SessionManagement
108. Which of the following is not a core interface of Hibernate?

D. Session

Answer» C. SessionManagement

discuss

109. Which of the following is not a core component of Hibernate?

A. JDBC

B. SessionFactory

C. Session

D. Configuration

Answer» A. JDBC

discuss

110. Is Session a thread-safe object?

A. True

B. False

C. none

D. all

Answer» B. False

discuss

111. SessionFactory is a thread-safe object.

A. True

B. False

C. none

D. all

Answer» A. True

discuss
112. Which of the following methods returns proxy object?

A. loadDatabase()

B. getDatabase()

C. load()

D. get()

Answer» C. load()

discuss

113. Which of the following methods hits database always?

A. load()

B. loadDatabase()

C. getDatabase()

D. get()

Answer» D. get()

discuss

114. Which of the following method is used inside session only?

A. merge()

B. update()

C. end()

D. kill()

Answer» B. update()

discuss

115. The SessionFactory is heavyweight object.

A. False

B. True

C. none

D. all
115. The SessionFactory is heavyweight object.

Answer» B. True

discuss

116. Which of the following is not a state of object in Hibernate?

A. Attached()

B. Detached()

C. Persistent()

D. Transient()

Answer» A. Attached()

discuss

117. Which of the following is true about HQL?

A. HQL takes java objects in the same way as SQL takes tables.

B. HQL is a Object Oriented Query language

C. HQL is database independent.

D. All of the above.

Answer» D. All of the above.

discuss

118. Which of the following is not an inheritance mapping strategies?

A. Table per hierarchy

B. Table per concrete class

C. Table per subclass

D. Table per class

Answer» D. Table per class

discuss

119. Which of the following is not an advantage of using Hibernate Query Language?

A. Database independent
119. Which of the following is not an advantage of using Hibernate Query Language?

B. Easy to write query

C. No need to learn SQL

D. Difficult to implement

Answer» D. Difficult to implement

discuss

120. In which file database table configuration is stored?

A. .dbm

B. .hbm

C. .ora

D. .sql

Answer» B. .hbm

discuss

121. Which of the following is not an advantage of Hibernate Criteria API?

A. Allows to use aggregate functions

B. Cannot order the result set

C. Allows to fetch only selected columns of result

D. Can add conditions while fetching results

Answer» B. Cannot order the result set

discuss

Chapter: Spring

122. What is the basic concept of Spring?

A. Factory pattern

B. Singleton pattern

C. Dependency injection or Inversion of control

D. Abstract factory pattern


122. What is the basic concept of Spring?

Answer» C. Dependency injection or Inversion of control

discuss

123. Which spring module provides the capability of DI or IOC?

A. Spring web

B. Core container

C. AOP

D. Data access

Answer» B. Core container

discuss

124. What are beans in the concept of Spring or what are spring beans?

A. Controller classes

B. Service classes

C. Repository

D. Any class that is managed by the container.

Answer» D. Any class that is managed by the container.

discuss

125. How does spring achieve DI or IOC?

A. Service locator pattern

B. Factory pattern

C. Abstract factory pattern

D. Singleton pattern

Answer» A. Service locator pattern

discuss

126. Which interface in spring is responsible for Instantiating and managing the so called Spring beans?

A. Bean Factory
126. Which interface in spring is responsible for Instantiating and managing the so called Spring beans?

B. ApplicationContext

C. BeanDefenition

D. BeanDefenition

Answer» B. ApplicationContext

discuss

127. Beans can be created by which of the following properties?

A. Scope

B. Property

C. Class

D. It’s own constructor

Answer» D. It’s own constructor

discuss

128. Which attribute is used to specify class name of the bean?

A. name

B. id

C. class

D. constructor-args

Answer» C. class

discuss

129. Which of the following method can be used to used to instantiate a method?

A. static factory method

B. default-init method

C. destroy method

D. lazy-init method

Answer» A. static factory method

discuss
130. Which attribute is used to specify static factory-method?

A. factory-method

B. default-init method

C. destroy method

D. lazy-init method

Answer» A. factory-method

discuss

131. Purpose of Static Factory Method?

A. Static method to create an object

B. Initialize bean

C. All of the mentioned

D. None of the mentioned

Answer» A. Static method to create an object

discuss

More MCQs

132. Which of the following contains both date and time?

A. java.io.date

B. java.sql.date

C. java.util.date

D. java.util.datetime

Answer» D. java.util.datetime

discuss

133. Which of the following is advantage of using JDBC connection pool?

A. slow performance

B. using more memory

C. using less memory


133. Which of the following is advantage of using JDBC connection pool?

D. better performance

Answer» D. better performance

discuss

134. Which of the following is advantage of using PreparedStatement in Java?

A. slow performance

B. encourages sql injection

C. prevents sql injection

D. more memory usage

Answer» C. prevents sql injection

discuss

135. Which one of the following contains date information?

A. java.sql.timestamp

B. java.sql.time

C. java.io.time

D. java.io.timestamp

Answer» A. java.sql.timestamp

discuss

136. What does setAutoCommit(false) do?

A. commits transweraction after each query

B. explicitly commits transweraction

C. does not commit transweraction automatically after each query

D. never commits transweraction

Answer» C. does not commit transweraction automatically after each query

discuss
137. Which of the following is used to call stored procedure?

A. statement

B. preparedstatement

C. callablestatment

D. calledstatement

Answer» C. callablestatment

discuss

138. Which of the following is method of JDBC batch process?

A. setbatch()

B. deletebatch()

C. removebatch()

D. addbatch()

Answer» D. addbatch()

discuss

139. Which of the following is used to rollback a JDBC trAnsweraction?

A. rollback()

B. rollforward()

C. deletetransweraction()

D. removetransweraction()

Answer» A. rollback()

discuss

140. Which driver uses ODBC driver to connect to the database?

A. jdbc-odbc bridge driver

B. native - api driver

C. network protocol driver

D. thin driver
140. Which driver uses ODBC driver to connect to the database?

Answer» A. jdbc-odbc bridge driver

discuss

141. How many JDBC product components does the Java software provides?

A. 3

B. 2

C. 4

D. 5

Answer» A. 3

discuss

142. How many types of JDBC drivers are available?

A. 3

B. 4

C. 2

D. 5

Answer» B. 4

discuss

143. Which result set generally does not show changes to the underlying database
that are made while it is open. The membership, order, and column values of
rows are typically fixed when the result set is created?

A. type_forward_only

B. type_scroll_insensitive

C. type_scroll_sensitive

D. all mentioned above

Answer» B. type_scroll_insensitive

discuss
144. Which method is used for an SQL statement that is executed frequently?

A. prepare statement

B. prepare call

C. create statement

D. none of the above

Answer» A. prepare statement

discuss

145. What is used to execute parameterized query?

A. statement interface

B. preparedstatement interface

C. resultset interface

D. none of the above

Answer» B. preparedstatement interface

discuss

146. Which JDBC product components does the Java software provide?

A. the jdbc driver manager

B. the jdbc driver test suite

C. the jdbc-odbc bridge

D. all mentioned above

Answer» D. all mentioned above

discuss

147. JDBC stands for?

A. java database connectivity

B. java database concept

C. java database communications

D. none of the above


147. JDBC stands for?

Answer» A. java database connectivity

discuss

148. Which of the following allows non repeatable read in JDBC Connection?

A. transweraction_read_uncommitted

B. transweraction_read_committed

C. transweraction_serializable

D. transweraction_repeatable_read

Answer» D. transweraction_repeatable_read

discuss

149. Which of the following statements is false as far as different type of statements is concern in JDBC?

A. regular statement

B. prepared statement

C. callable statement

D. interim statement

Answer» D. interim statement

discuss

150. Which of the following methods are needed for loading a database driver in JDBC?

A. registerdriver() method

B. class.forname()

C. both a and b

D. getconnection()

Answer» C. both a and b

151. Which of the following is false as far as type 4 driver is concern?

A. type 4 driver is “native protocol, pure java” driver

B. type 4 drivers are 100% java compatible


150. Which of the following methods are needed for loading a database driver in JDBC?

C. type 4 drivers uses socket class to connect to the database

D. type 4 drivers can not be used with netscape

Answer» D. type 4 drivers can not be used with netscape

discuss

152. Which driver is efficient and always preferable for using JDBC applications?

A. type – 4

B. type – 1

C. type – 3

D. type – 2

Answer» A. type – 4

discuss

153. JDBC facilitates to store the java objects by using which of the methods of
PreparedStatement
setObject () 2. setBlob() 3. setClob()

A. 1, 2

B. 1,2,3

C. 1,3

D. 2,3

Answer» B. 1,2,3

discuss

154. The JDBC-ODBC bridge is

A. three tiered

B. multithreaded

C. best for any platform

D. all of the above

Answer» B. multithreaded

discuss
155. All raw data types (including binary documents or images) should be read and uploaded to the database
as an array of

A. byte

B. int

C. boolean

D. char

Answer» A. byte

discuss

156. The class javA)sql.Timestamp has its super class as

A. java)sql.time

B. java)util.date

C. java)util.time

D. none of the above

Answer» B. java)util.date

discuss

157. BLOB, CLOB, ARRAY and REF type columns can be updated in

A. jdbc 1.0

B. jdbc 4.0

C. jdbc 2.0

D. jdbc 3.0

Answer» D. jdbc 3.0

discuss

158. Which of the following methods finds the maximum number of connections that a specific driver can
obtain?

A. database.getmaxconnections

B. connection.getmaxconnections

C. databasemetadata)getmaxconnections
158. Which of the following methods finds the maximum number of connections that a specific driver can
obtain?

D. resultsetmetadata)getmaxconnections

Answer» C. databasemetadata)getmaxconnections

discuss

159. When the message “No Suitable Driver” occurs?

A. when the driver is not registered by class.forname() method

B. when the user name, password and the database does not match

C. when the jdbc database url passed is not constructed properly

D. when the type 4 driver is used

Answer» C. when the jdbc database url passed is not constructed properly

discuss

160. Which driver is called as thin-driver in JDBC?

A. type-4 driver

B. type-1 driver

C. type-3 driver

D. type-2 driver

Answer» A. type-4 driver

discuss

161. How many trAnsweraction isolation levels are defined in javA)sql.Connection interface?

A. 4

B. 3

C. 5

D. 2

Answer» C. 5

discuss
162. Which method is used to perform DML statements in JDBC?

A. execute()

B. executequery()

C. executeupdate()

D. executeresult()

Answer» C. executeupdate()

discuss

163. What is the disadvantage of Type-4 Native-Protocol Driver?

A. at client side, a separate driver is needed for each database.

B. type-4 driver is entirely written in java

C. the driver converts jdbc calls into vendor-specific database protocol

D. it does not support to read mysql data)

Answer» A. at client side, a separate driver is needed for each database.

discuss

164. TCP,FTP,Telnet,SMTP are example of?

A. socket

B. ip address

C. protocol

D. mac address

Answer» C. protocol

discuss

165. In Inetaddress class which method returns the host name of IP address?

A. public string gethostname()

B. public string gethostaddress()

C. public string inetaddress getlocalhost()

D. none
165. In Inetaddress class which method returns the host name of IP address?

Answer» A. public string gethostname()

discuss

166. Show some networking terminology given below?

A. all

B. ip address

C. protocol

D. mac address

Answer» A. all

discuss

167. Which classes are used for connection less socket programming?

A. datagram socket

B. datagram packet

C. both a and b

D. none

Answer» C. both a and b

discuss

168. how many ports TCP/IP are reserved for specific protocol?

A. 10

B. 1024

C. 2048

D. 512

Answer» B. 1024

discuss

169. how many bits are in a single IP address?

A. 8
169. how many bits are in a single IP address?

B. 16

C. 32

D. 64

Answer» C. 32

discuss

170. Which of these class is used to encapsulate IP address and DNS?

A. datagram packet

B. url

C. inetaddress

D. contenthandler

Answer» C. inetaddress

discuss

171. Which of these is return type of getAddress method of DatagramPacket class?

A. findaddress()

B. getaddress()

C. address()

D. whois()

Answer» B. getaddress()

discuss

172. Which of these method of DatagramPacket is used to find port number?

A. port()

B. getport()

C. findport()

D. receivedport()

Answer» A. port()

discuss
173. Which of these class is necessary to implement datagrams?

A. datagrampacket

B. datagramsocket

C. all of the mentioned

D. none of the mentioned

Answer» C. all of the mentioned

discuss

174. Which of these method of DatagramPacket is used to find the port number?

A. port()

B. getport()

C. findport()

D. recieveport()

Answer» A. port()

discuss

175. Which of these method of DatagramPacket is used to obtain the byte array of data contained in a
datagram?

A. getdata()

B. getbytes()

C. getarray()

D. recievebytes()

Answer» A. getdata()

discuss

176. Which of these method of DatagramPacket is used to find the length of byte array?

A. getnumber()

B. length()

C. length()

D. getlength()
176. Which of these method of DatagramPacket is used to find the length of byte array?

Answer» D. getlength()

discuss

177. Which of these method is used to start a server thread?

A. run()

B. start()

C. runthread()

D. startthread()

Answer» A. run()

discuss

178. Which of these method is called when http daemon is acting like a normal web server?

A. handle()

B. handleget()

C. handleget()

D. handleget()

Answer» C. handleget()

discuss

179. Which of these methods of httpd class is used to read data from the stream?

A. getdta()

B. getresponse()

C. getstream()

D. getrawrequest()

Answer» D. getrawrequest()

discuss

180. Which of these method of httpd class is used to get report on each hit to HTTP server?

A. log()
180. Which of these method of httpd class is used to get report on each hit to HTTP server?

B. logentry()

C. loghttpd()

D. logresponse()

Answer» B. logentry()

discuss

181. Which of these method is used to find a URL from the cache of httpd?

A. findfromcache()

B. findfromcache()

C. servefromcache()

D. getfromcache()

Answer» C. servefromcache()

discuss

182. Which of these variables stores the number of hits that are successfully served out of cache?

A. hits

B. hitstocache

C. hits_to_cache

D. hits.to.cache

Answer» D. hits.to.cache

discuss

183. Which of these method of httpd class is used to write UrlCacheEntry object into local disk?

A. writediskcache()

B. writetodisk()

C. writecache()

D. writediskentry()

Answer» A. writediskcache()

discuss
184. Which of these is an instance variable of class httpd?

A. port

B. cache

C. log

D. all of the mentioned

Answer» D. all of the mentioned

discuss

185. Which of these is an instance variable of httpd that is a Hashtable?

A. port

B. cache

C. log

D. stopflag

Answer» C. log

discuss

186. Which of these exception is thrown by URL class’s constructors?

A. urlnotfound

B. urlsourcenotfound

C. malformedurlexception

D. urlnotfoundexception

Answer» C. malformedurlexception

discuss

187. Which of these methods is used to know host of an URL?

A. host()

B. gethost()

C. gethost()

D. gethost()
187. Which of these methods is used to know host of an URL?

Answer» B. gethost()

discuss

188. Which of these methods is used to know the full URL of an URL object?

A. fullhost()

B. gethost()

C. externalform()

D. toexternalform()

Answer» D. toexternalform()

discuss

189. Which of these class is used to access actual bits or content information of a URL?

A. url

B. urldecoder

C. urlconnection

D. all of the mentioned

Answer» D. all of the mentioned

discuss

190. Which object of HttpSession can be used to view and manipulate information about a session?

A. session identifier

B. creation time

C. last accessed time

D. all mentioned above

Answer» D. all mentioned above

discuss

191. Which of these ways used to communicate from an applet to servlet?

A. rmi communication
191. Which of these ways used to communicate from an applet to servlet?

B. http communication

C. socket communication

D. all mentioned above

Answer» D. all mentioned above

discuss

192. Which methods are used to bind the objects on HttpSession instance andget the objects?

A. setattribute

B. getattribute

C. both a & b

D. none of the above

Answer» C. both a & b

discuss

193. Which type of ServletEngine is a server that includes built-in support for servlets?

A. add-on servletengine

B. embedded servletengine

C. standalone servletengine

D. none of the above

Answer» C. standalone servletengine

discuss

194. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()?

A. genereic servlets

B. httpservlets

C. all of the above

D. none of the above

Answer» B. httpservlets

discuss
195. Which cookie it is valid for single session only and it is removed each time when the user closes the
browser?

A. persistent cookie

B. non-persistent cookie

C. all the above

D. none of the above

Answer» B. non-persistent cookie

discuss

196. Which action tags are used in JSP for developing web application with Java Bean?

A. jsp:usebean

B. jsp:setproperty

C. jsp:getproperty

D. both b & c

Answer» D. both b & c

discuss

197. Which technology do we mix our business logic with the presentation logic?

A. servlet

B. jsp

C. both a & b

D. none of the above

Answer» A. servlet

discuss

198. Which tag is used to execute java source code in JSP?

A. declaration tag

B. scriptlet tag

C. expression tag

D. none of the above


198. Which tag is used to execute java source code in JSP?

Answer» B. scriptlet tag

discuss

Which JSP Action tags is used to include the content of another resource,it May be jsp, html or servlet?

199.

A. jsp:include

B. jsp:forward

C. jsp:plugin

D. jsp:papam

Answer» A. jsp:include

151. Which of the following is false as far as type 4 driver is concern?

A. type 4 driver is “native protocol, pure java” driver

B. type 4 drivers are 100% java compatible

C. type 4 drivers uses socket class to connect to the database

D. type 4 drivers can not be used with netscape

Answer» D. type 4 drivers can not be used with netscape

discuss

152. Which driver is efficient and always preferable for using JDBC applications?

A. type – 4

B. type – 1

C. type – 3

D. type – 2

Answer» A. type – 4

discuss
153. JDBC facilitates to store the java objects by using which of the methods of
PreparedStatement
setObject () 2. setBlob() 3. setClob()

A. 1, 2

B. 1,2,3

C. 1,3

D. 2,3

Answer» B. 1,2,3

discuss

154. The JDBC-ODBC bridge is

A. three tiered

B. multithreaded

C. best for any platform

D. all of the above

Answer» B. multithreaded

discuss

155. All raw data types (including binary documents or images) should be read and uploaded to the database
as an array of

A. byte

B. int

C. boolean

D. char

Answer» A. byte

discuss
156. The class javA)sql.Timestamp has its super class as

A. java)sql.time

B. java)util.date

C. java)util.time

D. none of the above

Answer» B. java)util.date

discuss

157. BLOB, CLOB, ARRAY and REF type columns can be updated in

A. jdbc 1.0

B. jdbc 4.0

C. jdbc 2.0

D. jdbc 3.0

Answer» D. jdbc 3.0

discuss

158. Which of the following methods finds the maximum number of connections that a specific driver can
obtain?

A. database.getmaxconnections

B. connection.getmaxconnections

C. databasemetadata)getmaxconnections

D. resultsetmetadata)getmaxconnections

Answer» C. databasemetadata)getmaxconnections

discuss

159. When the message “No Suitable Driver” occurs?

A. when the driver is not registered by class.forname() method

B. when the user name, password and the database does not match

C. when the jdbc database url passed is not constructed properly

D. when the type 4 driver is used

Answer» C. when the jdbc database url passed is not constructed properly

discuss
160. Which driver is called as thin-driver in JDBC?

A. type-4 driver

B. type-1 driver

C. type-3 driver

D. type-2 driver

Answer» A. type-4 driver

discuss

161. How many trAnsweraction isolation levels are defined in javA)sql.Connection interface?

A. 4

B. 3

C. 5

D. 2

Answer» C. 5

discuss

162. Which method is used to perform DML statements in JDBC?

A. execute()

B. executequery()

C. executeupdate()

D. executeresult()

Answer» C. executeupdate()

discuss
163. What is the disadvantage of Type-4 Native-Protocol Driver?

A. at client side, a separate driver is needed for each database.

B. type-4 driver is entirely written in java

C. the driver converts jdbc calls into vendor-specific database protocol

D. it does not support to read mysql data)

Answer» A. at client side, a separate driver is needed for each database.

discuss

164. TCP,FTP,Telnet,SMTP are example of?

A. socket

B. ip address

C. protocol

D. mac address

Answer» C. protocol

discuss

165. In Inetaddress class which method returns the host name of IP address?

A. public string gethostname()

B. public string gethostaddress()

C. public string inetaddress getlocalhost()

D. none

Answer» A. public string gethostname()

discuss

166. Show some networking terminology given below?

A. all

B. ip address

C. protocol

D. mac address

Answer» A. all

discuss
167. Which classes are used for connection less socket programming?

A. datagram socket

B. datagram packet

C. both a and b

D. none

Answer» C. both a and b

discuss

168. how many ports TCP/IP are reserved for specific protocol?

A. 10

B. 1024

C. 2048

D. 512

Answer» B. 1024

discuss

169. how many bits are in a single IP address?

A. 8

B. 16

C. 32

D. 64

Answer» C. 32

discuss

170. Which of these class is used to encapsulate IP address and DNS?

A. datagram packet

B. url

C. inetaddress

D. contenthandler

Answer» C. inetaddress

discuss
171. Which of these is return type of getAddress method of DatagramPacket class?

A. findaddress()

B. getaddress()

C. address()

D. whois()

Answer» B. getaddress()

discuss

172. Which of these method of DatagramPacket is used to find port number?

A. port()

B. getport()

C. findport()

D. receivedport()

Answer» A. port()

discuss

173. Which of these class is necessary to implement datagrams?

A. datagrampacket

B. datagramsocket

C. all of the mentioned

D. none of the mentioned

Answer» C. all of the mentioned

discuss
174. Which of these method of DatagramPacket is used to find the port number?

A. port()

B. getport()

C. findport()

D. recieveport()

Answer» A. port()

discuss

175. Which of these method of DatagramPacket is used to obtain the byte array of data contained in a
datagram?

A. getdata()

B. getbytes()

C. getarray()

D. recievebytes()

Answer» A. getdata()

discuss

176. Which of these method of DatagramPacket is used to find the length of byte array?

A. getnumber()

B. length()

C. length()

D. getlength()

Answer» D. getlength()

discuss

177. Which of these method is used to start a server thread?

A. run()

B. start()

C. runthread()

D. startthread()

Answer» A. run()

discuss
178. Which of these method is called when http daemon is acting like a normal web server?

A. handle()

B. handleget()

C. handleget()

D. handleget()

Answer» C. handleget()

discuss

179. Which of these methods of httpd class is used to read data from the stream?

A. getdta()

B. getresponse()

C. getstream()

D. getrawrequest()

Answer» D. getrawrequest()

discuss

180. Which of these method of httpd class is used to get report on each hit to HTTP server?

A. log()

B. logentry()

C. loghttpd()

D. logresponse()

Answer» B. logentry()

discuss

181. Which of these method is used to find a URL from the cache of httpd?

A. findfromcache()

B. findfromcache()

C. servefromcache()

D. getfromcache()

Answer» C. servefromcache()

discuss
182. Which of these variables stores the number of hits that are successfully served out of cache?

A. hits

B. hitstocache

C. hits_to_cache

D. hits.to.cache

Answer» D. hits.to.cache

discuss

183. Which of these method of httpd class is used to write UrlCacheEntry object into local disk?

A. writediskcache()

B. writetodisk()

C. writecache()

D. writediskentry()

Answer» A. writediskcache()

discuss

184. Which of these is an instance variable of class httpd?

A. port

B. cache

C. log

D. all of the mentioned

Answer» D. all of the mentioned

discuss
185. Which of these is an instance variable of httpd that is a Hashtable?

A. port

B. cache

C. log

D. stopflag

Answer» C. log

discuss

186. Which of these exception is thrown by URL class’s constructors?

A. urlnotfound

B. urlsourcenotfound

C. malformedurlexception

D. urlnotfoundexception

Answer» C. malformedurlexception

discuss

187. Which of these methods is used to know host of an URL?

A. host()

B. gethost()

C. gethost()

D. gethost()

Answer» B. gethost()

discuss

188. Which of these methods is used to know the full URL of an URL object?

A. fullhost()

B. gethost()

C. externalform()

D. toexternalform()

Answer» D. toexternalform()

discuss
189. Which of these class is used to access actual bits or content information of a URL?

A. url

B. urldecoder

C. urlconnection

D. all of the mentioned

Answer» D. all of the mentioned

discuss

190. Which object of HttpSession can be used to view and manipulate information about a session?

A. session identifier

B. creation time

C. last accessed time

D. all mentioned above

Answer» D. all mentioned above

discuss

191. Which of these ways used to communicate from an applet to servlet?

A. rmi communication

B. http communication

C. socket communication

D. all mentioned above

Answer» D. all mentioned above

discuss

192. Which methods are used to bind the objects on HttpSession instance andget the objects?

A. setattribute

B. getattribute

C. both a & b

D. none of the above

Answer» C. both a & b

discuss
193. Which type of ServletEngine is a server that includes built-in support for servlets?

A. add-on servletengine

B. embedded servletengine

C. standalone servletengine

D. none of the above

Answer» C. standalone servletengine

discuss

194. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()?

A. genereic servlets

B. httpservlets

C. all of the above

D. none of the above

Answer» B. httpservlets

discuss

195. Which cookie it is valid for single session only and it is removed each time when the user closes the
browser?

A. persistent cookie

B. non-persistent cookie

C. all the above

D. none of the above

Answer» B. non-persistent cookie

discuss
196. Which action tags are used in JSP for developing web application with Java Bean?

A. jsp:usebean

B. jsp:setproperty

C. jsp:getproperty

D. both b & c

Answer» D. both b & c

discuss

197. Which technology do we mix our business logic with the presentation logic?

A. servlet

B. jsp

C. both a & b

D. none of the above

Answer» A. servlet

discuss

198. Which tag is used to execute java source code in JSP?

A. declaration tag

B. scriptlet tag

C. expression tag

D. none of the above

Answer» B. scriptlet tag

discuss

199. Which JSP Action tags is used to include the content of another resource,it May be jsp, html or servlet?

A. jsp:include

B. jsp:forward

C. jsp:plugin

D. jsp:papam

Answer» A. jsp:include

discuss
201. In JSP page directive which attribute defines theMIME(Multipurpose Internet Mail Extension) type of the
HTTP response?

A. import

B. content type

C. extends

D. info

Answer» B. content type

discuss

202. A JSP page consists of which tags?

A. html tags

B. jsp tags

C. both a & b

D. none of the above

Answer» C. both a & b

discuss

203. What alternatives exist to embedding Java code directly within the HTML markup of your JSP page?

A. moving the code into your session manager.

B. moving the code into scriptlets.

C. moving the code into javabeans and servlets.

D. moving the code into a transaction manager.

Answer» C. moving the code into javabeans and servlets.

discuss

204. What type of scriptlet code is better-suited to being factored forward into a servlet?

A. code that deals with logic that is common across requests.

B. code that deals with logic that is vendor specific)

C. code that deals with logic that relates to database access.

D. code that deals with logic that relates to client scope.

Answer» A. code that deals with logic that is common across requests.

discuss
205. URL encoding is the method of replacing all the spaces and other extra characters into their corresponding
_______ Characters?

A. hex

B. binary

C. octal

D. decimal

Answer» A. hex

discuss

206. Which of the scripting of JSP not putting content into service method of the converted servlet?

A. declarations

B. scriptlets

C. expressions

D. none of the above

Answer» A. declarations

discuss

207. What requires less resources?

A. thread

B. process

C. thread and process

D. neither thread nor process

Answer» A. thread

discuss
208. What does not prevent JVM from terminating?

A. process

B. daemon thread

C. user thread

D. jvm thread

Answer» B. daemon thread

discuss

209. What decides thread priority?

A. process

B. process scheduler

C. thread

D. thread scheduler

Answer» D. thread scheduler

discuss

210. What should not be done to avoid deadlock?

A. avoid using multiple threads

B. avoid hold several locks at once

C. execute foreign code while holding a lock

D. use interruptible locks

Answer» C. execute foreign code while holding a lock

discuss

211. What is true about threading?

A. run() method calls start() method and runs the code

B. run() method creates new thread

C. run() method can be called directly without start() method being called

D. start() method creates new thread and calls code written in run() method

Answer» D. start() method creates new thread and calls code written in run() method

discuss
212. Which of the following is a correct constructor for thread?

A. thread(runnable a, string str)

B. thread(int priority)

C. thread(runnable a, int priority)

D. thread(runnable a, threadgroup t)

Answer» A. thread(runnable a, string str)

discuss

213. Which of the following will ensure the thread will be in running state?

A. yield()

B. notify()

C. wait()

D. thread.killthread()

Answer» C. wait()

discuss

214. Which of these are types of multitasking?

A. process based

B. thread based

C. process and thread based

D. none of the mentioned

Answer» C. process and thread based

discuss

215 What will happen if two thread of the same priority are called to be processed simultaneously?

A. anyone will be executed first lexographically


215 What will happen if two thread of the same priority are called to be processed simultaneously?

B. both of them will be executed simultaneously

C. none of them will be executed

D. it is dependent on the operating system

Answer» D. it is dependent on the operating system

discuss

216. In a RMI Client Program, what are the exceptions which might have to handled?

A. remoteexception

B. notboundexception

C. malformedurlexception

D. all mentioned above

Answer» D. all mentioned above

discuss

217. Which is a one-way communication only between the client and the server and it
is not a reliable and there is no confirmation regarding reaching the message to
the destination?

A. tcp/ip

B. udp

C. both a & b

D. none of the above

Answer» B. udp

discuss

218. An RMI Server is responsible for,

A. creating an instance of the remote object


218. An RMI Server is responsible for,

B. exporting the remote object

C. binding the instance of the remote object to the rmi registry

D. all mentioned above

Answer» D. all mentioned above

discuss

219. In RMI Distributed object applications need to do?

A. locate remote objects

B. communicate with remote objects

C. load class definitions for objects that are passed around

D. all mentioned above

Answer» D. all mentioned above

discuss

220. In RMI applications which program obtains a remote reference to one or more remote objects on a server
and then invokes methods on them?

A. server

B. client

C. both a & b

D. none of the above

Answer» B. client

discuss

221. Which package is used for Remote Method Invocation (RMI)?

A. java.lang.rmi

B. java.lang.reflect

C. java.applet

D. java.rmi

Answer» D. java.rmi
Java supports RMI, RMI Stands for?
222.

A. random method invocation

B. remote memory interface

C. remote method invocation

D. random method invocation

Answer» C. remote method invocation

discuss

discuss

223. Which is built on the top of socket programming?

A. ejb

B. rmi

C. both a & b

D. none of the above

Answer» B. rmi

discuss

224. Which of the following contains both date and time?

A. java.io.date

B. java.sql.date

C. java.util.date

D. java.util.datetime

Answer» D. java.util.datetime

discuss

225. Which of the following is advantage of using JDBC connection pool?

A. slow performance

B. using more memory

C. using less memory

D. better performance

Answer» D. better performance

discuss
226. Which of the following is advantage of using PreparedStatement in Java?

A. slow performance

B. encourages sql injection

C. prevents sql injection

D. more memory usage

Answer» C. prevents sql injection

discuss

227. Which one of the following contains date information?

A. java.sql.timestamp

B. java.sql.time

C. java.io.time

D. java.io.timestamp

Answer» A. java.sql.timestamp

discuss

228. What does setAutoCommit(false) do?

A. commits transweraction after each query

B. explicitly commits transweraction

C. does not commit transweraction automatically after each query

D. never commits transweraction

Answer» C. does not commit transweraction automatically after each query

discuss
Which of the following is used to call stored procedure?
229.

A. statement

B. preparedstatement

C. callablestatment

D. calledstatement

Answer» C. callablestatment

discuss

230. Which of the following is method of JDBC batch process?

A. setbatch()

B. deletebatch()

C. removebatch()

D. addbatch()

Answer» D. addbatch()

discuss

231. Which of the following is used to rollback a JDBC trAnsweraction?

A. rollback()

B. rollforward()

C. deletetransweraction()

D. removetransweraction()

Answer» A. rollback()

discuss

232. Which driver uses ODBC driver to connect to the database?

A. jdbc-odbc bridge driver

B. native - api driver

C. network protocol driver

D. thin driver

Answer» A. jdbc-odbc bridge driver

discuss
233. How many JDBC product components does the Java software provides?

A. 3

B. 2

C. 4

D. 5

Answer» A. 3

discuss

234. How many types of JDBC drivers are available?

A. 3

B. 4

C. 2

D. 5

Answer» B. 4

discuss

. Which result set generally does not show changes to the underlying database
that are made while it is open. The membership, order, and column values of
rows are typically fixed when the result set is created?

A. type_forward_only

B. type_scroll_insensitive

C. type_scroll_sensitive

D. all mentioned above

Answer» B. type_scroll_insensitive

discuss
Which method is used for an SQL statement that is executed frequently?

A. prepare statement

B. prepare call

C. create statement

D. none of the above

Answer» A. prepare statement

discuss

What is used to execute parameterized query?

A. statement interface

B. preparedstatement interface

C. resultset interface

D. none of the above

Answer» B. preparedstatement interface

discuss

Which JDBC product components does the Java software provide?

A. the jdbc driver manager

B. the jdbc driver test suite

C. the jdbc-odbc bridge

D. all mentioned above

Answer» D. all mentioned above

discuss

JDBC stands for?

A. java database connectivity

B. java database concept

C. java database communications

D. none of the above

Answer» A. java database connectivity

discuss
Which of the following allows non repeatable read in JDBC Connection?

A. transweraction_read_uncommitted

B. transweraction_read_committed

C. transweraction_serializable

D. transweraction_repeatable_read

Answer» D. transweraction_repeatable_read

discuss

. Which of the following statements is false as far as different type of statements is concern in JDBC?

A. regular statement

B. prepared statement

C. callable statement

D. interim statement

Answer» D. interim statement

discuss

Which of the following methods are needed for loading a database driver in JDBC?

A. registerdriver() method

B. class.forname()

C. both a and b

D. getconnection()

Answer» C. both a and b

discuss
Which of the following is false as far as type 4 driver is concern?

A. type 4 driver is “native protocol, pure java” driver

B. type 4 drivers are 100% java compatible

C. type 4 drivers uses socket class to connect to the database

D. type 4 drivers can not be used with netscape

Answer» D. type 4 drivers can not be used with netscape

discuss

Which driver is efficient and always preferable for using JDBC applications?

A. type – 4

B. type – 1

C. type – 3

D. type – 2

Answer» A. type – 4

discuss

JDBC facilitates to store the java objects by using which of the methods of
PreparedStatement
setObject () 2. setBlob() 3. setClob()

A. 1, 2

B. 1,2,3

C. 1,3

D. 2,3

Answer» B. 1,2,3

discuss

The JDBC-ODBC bridge is

A. three tiered

B. multithreaded

C. best for any platform

D. all of the above

Answer» B. multithreaded

discuss
All raw data types (including binary documents or images) should be read and uploaded to the database
as an array of

A. byte

B. int

C. boolean

D. char

Answer» A. byte

discuss

The class javA)sql.Timestamp has its super class as

A. java)sql.time

B. java)util.date

C. java)util.time

D. none of the above

Answer» B. java)util.date

discuss

BLOB, CLOB, ARRAY and REF type columns can be updated in

A. jdbc 1.0

B. jdbc 4.0

C. jdbc 2.0

D. jdbc 3.0

Answer» D. jdbc 3.0

discuss
Which of the following methods finds the maximum number of connections that a specific driver can
obtain?

A. database.getmaxconnections

B. connection.getmaxconnections

C. databasemetadata)getmaxconnections

D. resultsetmetadata)getmaxconnections

Answer» C. databasemetadata)getmaxconnections

discuss

When the message “No Suitable Driver” occurs?

A. when the driver is not registered by class.forname() method

B. when the user name, password and the database does not match

C. when the jdbc database url passed is not constructed properly

D. when the type 4 driver is used

Answer» C. when the jdbc database url passed is not constructed properly

discuss

Which driver is called as thin-driver in JDBC?

A. type-4 driver

B. type-1 driver

C. type-3 driver

D. type-2 driver

Answer» A. type-4 driver

discuss

How many trAnsweraction isolation levels are defined in javA)sql.Connection interface?

A. 4

B. 3

C. 5

D. 2

Answer» C. 5

discuss
Which method is used to perform DML statements in JDBC?

A. execute()

B. executequery()

C. executeupdate()

D. executeresult()

Answer» C. executeupdate()

discuss

What is the disadvantage of Type-4 Native-Protocol Driver?

A. at client side, a separate driver is needed for each database.

B. type-4 driver is entirely written in java

C. the driver converts jdbc calls into vendor-specific database protocol

D. it does not support to read mysql data)

Answer» A. at client side, a separate driver is needed for each database.

discuss

TCP,FTP,Telnet,SMTP are example of?

A. socket

B. ip address

C. protocol

D. mac address

Answer» C. protocol

discuss
In Inetaddress class which method returns the host name of IP address?

A. public string gethostname()

B. public string gethostaddress()

C. public string inetaddress getlocalhost()

D. none

Answer» A. public string gethostname()

discuss

. Show some networking terminology given below?

A. all

B. ip address

C. protocol

D. mac address

Answer» A. all

discuss

Which classes are used for connection less socket programming?

A. datagram socket

B. datagram packet

C. both a and b

D. none

Answer» C. both a and b

discuss

how many ports TCP/IP are reserved for specific protocol?

A. 10

B. 1024

C. 2048

D. 512

Answer» B. 1024

discuss
how many bits are in a single IP address?

A. 8

B. 16

C. 32

D. 64

Answer» C. 32

discuss

Which of these class is used to encapsulate IP address and DNS?

A. datagram packet

B. url

C. inetaddress

D. contenthandler

Answer» C. inetaddress

discuss

Which of these is return type of getAddress method of DatagramPacket class?

A. findaddress()

B. getaddress()

C. address()

D. whois()

Answer» B. getaddress()

discuss
Which of these method of DatagramPacket is used to find port number?

A. port()

B. getport()

C. findport()

D. receivedport()

Answer» A. port()

discuss

Which of these class is necessary to implement datagrams?

A. datagrampacket

B. datagramsocket

C. all of the mentioned

D. none of the mentioned

Answer» C. all of the mentioned

discuss

Which of these method of DatagramPacket is used to find the port number?

A. port()

B. getport()

C. findport()

D. recieveport()

Answer» A. port()

discuss

Which of these method of DatagramPacket is used to obtain the byte array of data contained in a
datagram?

A. getdata()

B. getbytes()

C. getarray()

D. recievebytes()

Answer» A. getdata()

discuss
Which of these method of DatagramPacket is used to find the length of byte array?

A. getnumber()

B. length()

C. length()

D. getlength()

Answer» D. getlength()

discuss

Which of these method is used to start a server thread?

A. run()

B. start()

C. runthread()

D. startthread()

Answer» A. run()

discuss

Which of these method is called when http daemon is acting like a normal web server?

A. handle()

B. handleget()

C. handleget()

D. handleget()

Answer» C. handleget()

discuss
Which of these methods of httpd class is used to read data from the stream?

A. getdta()

B. getresponse()

C. getstream()

D. getrawrequest()

Answer» D. getrawrequest()

discuss

Which of these method of httpd class is used to get report on each hit to HTTP server?

A. log()

B. logentry()

C. loghttpd()

D. logresponse()

Answer» B. logentry()

discuss

Which of these method is used to find a URL from the cache of httpd?

A. findfromcache()

B. findfromcache()

C. servefromcache()

D. getfromcache()

Answer» C. servefromcache()

Which of these variables stores the number of hits that are successfully served out of cache?

A. hits

B. hitstocache

C. hits_to_cache

D. hits.to.cache

Answer» D. hits.to.cache

discuss
Which of these method of httpd class is used to write UrlCacheEntry object into local disk?

A. writediskcache()

B. writetodisk()

C. writecache()

D. writediskentry()

Answer» A. writediskcache()

discuss

Which of these is an instance variable of class httpd?

A. port

B. cache

C. log

D. all of the mentioned

Answer» D. all of the mentioned

Which of these is an instance variable of httpd that is a Hashtable?

A. port

B. cache

C. log

D. stopflag

Answer» C. log

discuss
Which of these exception is thrown by URL class’s constructors?

A. urlnotfound

B. urlsourcenotfound

C. malformedurlexception

D. urlnotfoundexception

Answer» C. malformedurlexception

discuss

Which of these methods is used to know host of an URL?

A. host()

B. gethost()

C. gethost()

D. gethost()

Answer» B. gethost()

discuss

. Which of these methods is used to know the full URL of an URL object?

A. fullhost()

B. gethost()

C. externalform()

D. toexternalform()

Answer» D. toexternalform()

discuss

Which of these class is used to access actual bits or content information of a URL?

A. url

B. urldecoder

C. urlconnection

D. all of the mentioned

Answer» D. all of the mentioned

discuss
. Which object of HttpSession can be used to view and manipulate information about a session?

A. session identifier

B. creation time

C. last accessed time

D. all mentioned above

Answer» D. all mentioned above

discuss

Which of these ways used to communicate from an applet to servlet?

A. rmi communication

B. http communication

C. socket communication

D. all mentioned above

Answer» D. all mentioned above

discuss

Which methods are used to bind the objects on HttpSession instance andget the objects?

A. setattribute

B. getattribute

C. both a & b

D. none of the above

Answer» C. both a & b

discuss
Which type of ServletEngine is a server that includes built-in support for servlets?

A. add-on servletengine

B. embedded servletengine

C. standalone servletengine

D. none of the above

Answer» C. standalone servletengine

discuss

What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()?

A. genereic servlets

B. httpservlets

C. all of the above

D. none of the above

Answer» B. httpservlets

discuss

Which cookie it is valid for single session only and it is removed each time when the user closes the
browser?

A. persistent cookie

B. non-persistent cookie

C. all the above

D. none of the above

Answer» B. non-persistent cookie

discuss

Which action tags are used in JSP for developing web application with Java Bean?

A. jsp:usebean

B. jsp:setproperty

C. jsp:getproperty

D. both b & c

Answer» D. both b & c


Which technology do we mix our business logic with the presentation logic?

A. servlet

B. jsp

C. both a & b

D. none of the above

Answer» A. servlet

discuss

Which tag is used to execute java source code in JSP?

A. declaration tag

B. scriptlet tag

C. expression tag

D. none of the above

Answer» B. scriptlet tag

discuss

. Which JSP Action tags is used to include the content of another resource,it May be jsp, html or servlet?

A. jsp:include

B. jsp:forward

C. jsp:plugin

D. jsp:papam

Answer» A. jsp:include

discuss
In JSP how many ways are there to perform exception handling?

A. 3

B. 2

C. 4

D. 5

Answer» B. 2

discuss

In JSP page directive which attribute defines theMIME(Multipurpose Internet Mail Extension) type of the
HTTP response?

A. import

B. content type

C. extends

D. info

Answer» B. content type

discuss

A JSP page consists of which tags?

A. html tags

B. jsp tags

C. both a & b

D. none of the above

Answer» C. both a & b

discuss

What alternatives exist to embedding Java code directly within the HTML markup of your JSP page?

A. moving the code into your session manager.

B. moving the code into scriptlets.

C. moving the code into javabeans and servlets.

D. moving the code into a transaction manager.

Answer» C. moving the code into javabeans and servlets.

discuss
What type of scriptlet code is better-suited to being factored forward into a servlet?

A. code that deals with logic that is common across requests.

B. code that deals with logic that is vendor specific)

C. code that deals with logic that relates to database access.

D. code that deals with logic that relates to client scope.

Answer» A. code that deals with logic that is common across requests.

discuss

URL encoding is the method of replacing all the spaces and other extra characters into their corresponding
_______ Characters?

A. hex

B. binary

C. octal

D. decimal

Answer» A. hex

discuss

Which of the scripting of JSP not putting content into service method of the converted servlet?

A. declarations

B. scriptlets

C. expressions

D. none of the above

Answer» A. declarations

discuss

What requires less resources?

A. thread

B. process

C. thread and process

D. neither thread nor process

Answer» A. thread
What does not prevent JVM from terminating?

A. process

B. daemon thread

C. user thread

D. jvm thread

Answer» B. daemon thread

discuss

What decides thread priority?

A. process

B. process scheduler

C. thread

D. thread scheduler

Answer» D. thread scheduler

discuss

What should not be done to avoid deadlock?

A. avoid using multiple threads

B. avoid hold several locks at once

C. execute foreign code while holding a lock

D. use interruptible locks

Answer» C. execute foreign code while holding a lock

discuss
What is true about threading?

A. run() method calls start() method and runs the code

B. run() method creates new thread

C. run() method can be called directly without start() method being called

D. start() method creates new thread and calls code written in run() method

Answer» D. start() method creates new thread and calls code written in run() method

discuss

Which of the following is a correct constructor for thread?

A. thread(runnable a, string str)

B. thread(int priority)

C. thread(runnable a, int priority)

D. thread(runnable a, threadgroup t)

Answer» A. thread(runnable a, string str)

discuss

Which of the following will ensure the thread will be in running state?

A. yield()

B. notify()

C. wait()

D. thread.killthread()

Answer» C. wait()

discuss

Which of these are types of multitasking?

A. process based

B. thread based

C. process and thread based

D. none of the mentioned

Answer» C. process and thread based

discuss
What will happen if two thread of the same priority are called to be processed simultaneously?

A. anyone will be executed first lexographically

B. both of them will be executed simultaneously

C. none of them will be executed

D. it is dependent on the operating system

Answer» D. it is dependent on the operating system

discuss

In a RMI Client Program, what are the exceptions which might have to handled?

A. remoteexception

B. notboundexception

C. malformedurlexception

D. all mentioned above

Answer» D. all mentioned above

discuss

Which is a one-way communication only between the client and the server and it
is not a reliable and there is no confirmation regarding reaching the message to
the destination?

A. tcp/ip

B. udp

C. both a & b

D. none of the above

Answer» B. udp

discuss
An RMI Server is responsible for,

A. creating an instance of the remote object

B. exporting the remote object

C. binding the instance of the remote object to the rmi registry

D. all mentioned above

Answer» D. all mentioned above

discuss

In RMI Distributed object applications need to do?

A. locate remote objects

B. communicate with remote objects

C. load class definitions for objects that are passed around

D. all mentioned above

Answer» D. all mentioned above

discuss

In RMI applications which program obtains a remote reference to one or more remote objects on a server
and then invokes methods on them?

A. server

B. client

C. both a & b

D. none of the above

Answer» B. client

discuss

Which package is used for Remote Method Invocation (RMI)?

A. java.lang.rmi

B. java.lang.reflect

C. java.applet

D. java.rmi

Answer» D. java.rmi

discuss
. Java supports RMI, RMI Stands for?

A. random method invocation

B. remote memory interface

C. remote method invocation

D. random method invocation

Answer» C. remote method invocation

You might also like