Question 1
Which method of a Servlet is called only once?
service()
doGet()
init()
destroy()
Question 2
Which of the following is an example of a terminal operation in Java Streams?
map()
filter()
collect()
sorted()
Question 3
Which of the following statements about JDBC exception handling is true?
ClassNotFoundException occurs when the SQL query syntax is incorrect
SQLTimeoutException occurs when a query execution exceeds the defined time limit
SQLException is an unchecked exception
JDBC resources cannot be closed automatically using try-with-resources
Question 4
What will ${user.name} output in JSP EL?
Calls getter method of name property in user bean
Directly accesses private field name
Prints ${user.name} as plain text
Throws compilation error
Question 5
Which JSTL core tag is used for iteration?
Question 6
Which is the first phase in JSP lifecycle?
Compilation
Translation
Initialization
Execution
Question 7
Which advantage does PreparedStatement have over Statement?
Easier debugging
Faster compilation
Precompiled SQL and protection against SQL Injection
Returns multiple ResultSets
Question 8
What is the first step to connect Java with a database using JDBC?
Create Statement
Register JDBC Driver
Execute Query
Open ResultSet
Question 9
Which method retrieves a session in Servlets?
request.getSession()
response.getSession()
Session.getCurrent()
request.createSession()
Question 10
Which statement is correct?
doGet sends data in body, doPost in URL
doGet is limited in length, doPost supports large data
Both are same
doPost is idempotent
There are 20 questions to complete.