Chapter: JSP
101.

Attribute used to handle web flow requests.

A. servlet-mapping
B. servlet-attr
C. servlet-flow
D. servlet-requests
Answer» A. servlet-mapping
102.

To resolve Facelets views we configure:

A. ViewFacelets
B. ViewResolver
C. View-resolver
D. View_Resolver
Answer» B. ViewResolver
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
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
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
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
107.

Component which encloses command button.

A. validateAll
B. validateAllClick
C. validateAllInClick
D. validateAllOnClick
Answer» C. validateAllInClick
Chapter: Hibernate
108.

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

A. Configuration
B. Criteria
C. SessionManagement
D. Session
Answer» C. SessionManagement
109.

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

A. JDBC
B. SessionFactory
C. Session
D. Configuration
Answer» A. JDBC
110.

Is Session a thread-safe object?

A. True
B. False
C. none
D. all
Answer» B. False
111.

SessionFactory is a thread-safe object.

A. True
B. False
C. none
D. all
Answer» A. True
112.

Which of the following methods returns proxy object?

A. loadDatabase()
B. getDatabase()
C. load()
D. get()
Answer» C. load()
113.

Which of the following methods hits database always?

A. load()
B. loadDatabase()
C. getDatabase()
D. get()
Answer» D. get()
114.

Which of the following method is used inside session only?

A. merge()
B. update()
C. end()
D. kill()
Answer» B. update()
115.

The SessionFactory is heavyweight object.

A. False
B. True
C. none
D. all
Answer» B. True
116.

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

A. Attached()
B. Detached()
C. Persistent()
D. Transient()
Answer» A. Attached()
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.
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
119.

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

A. Database independent
B. Easy to write query
C. No need to learn SQL
D. Difficult to implement
Answer» D. Difficult to implement
120.

In which file database table configuration is stored?

A. .dbm
B. .hbm
C. .ora
D. .sql
Answer» B. .hbm
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
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
Answer» C. Dependency injection or Inversion of control
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
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.
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
126.

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

A. Bean Factory
B. ApplicationContext
C. BeanDefenition
D. BeanDefenition
Answer» B. ApplicationContext
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
128.

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

A. name
B. id
C. class
D. constructor-args
Answer» C. class
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
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
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
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
133.

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
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
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
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
137.

Which of the following is used to call stored procedure?

A. statement
B. preparedstatement
C. callablestatment
D. calledstatement
Answer» C. callablestatment
138.

Which of the following is method of JDBC batch process?

A. setbatch()
B. deletebatch()
C. removebatch()
D. addbatch()
Answer» D. addbatch()
139.

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

A. rollback()
B. rollforward()
C. deletetransweraction()
D. removetransweraction()
Answer» A. rollback()
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
Answer» A. jdbc-odbc bridge driver
141.

How many JDBC product components does the Java software provides?

A. 3
B. 2
C. 4
D. 5
Answer» A. 3
142.

How many types of JDBC drivers are available?

A. 3
B. 4
C. 2
D. 5
Answer» B. 4
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
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
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
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
147.

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
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
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
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
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
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
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
154.

The JDBC-ODBC bridge is

A. three tiered
B. multithreaded
C. best for any platform
D. all of the above
Answer» B. multithreaded
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
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
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
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
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
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
161.

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

A. 4
B. 3
C. 5
D. 2
Answer» C. 5
162.

Which method is used to perform DML statements in JDBC?

A. execute()
B. executequery()
C. executeupdate()
D. executeresult()
Answer» C. executeupdate()
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.
164.

TCP,FTP,Telnet,SMTP are example of?

A. socket
B. ip address
C. protocol
D. mac address
Answer» C. protocol
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()
166.

Show some networking terminology given below?

A. all
B. ip address
C. protocol
D. mac address
Answer» A. all
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
168.

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

A. 10
B. 1024
C. 2048
D. 512
Answer» B. 1024
169.

how many bits are in a single IP address?

A. 8
B. 16
C. 32
D. 64
Answer» C. 32
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
171.

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

A. findaddress()
B. getaddress()
C. address()
D. whois()
Answer» B. getaddress()
172.

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

A. port()
B. getport()
C. findport()
D. receivedport()
Answer» A. port()
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
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()
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()
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()
177.

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

A. run()
B. start()
C. runthread()
D. startthread()
Answer» A. run()
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()
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()
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()
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()
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
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()
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
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
186.

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

A. urlnotfound
B. urlsourcenotfound
C. malformedurlexception
D. urlnotfoundexception
Answer» C. malformedurlexception
187.

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

A. host()
B. gethost()
C. gethost()
D. gethost()
Answer» B. gethost()
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()
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
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
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
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
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
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
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
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
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
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
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
200.

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

A. 3
B. 2
C. 4
D. 5
Answer» B. 2
Tags
  • Question and answers in Advanced JAVA,
  • Advanced JAVA multiple choice questions and answers,
  • Advanced JAVA Important MCQs,
  • Solved MCQs for Advanced JAVA,
  • Advanced JAVA MCQs with answers PDF download