109
87.8k

220+ Advanced JAVA Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Science in Information Technology (MSc IT) , Master of Science in Computer Science (MSc CS) , Bachelor of Business Administration in Computer Applications (BBA [CA]) , Programming Languages , Master of Science in Software Engineering (MSc SE) .

Chapters

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

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.