You are on page 1of 6

1.

What happens if the init(ServletConfig config) is overridden and the parent


method is not called ?
a. Code executes perfectly since you have overridden the method
b. You cannot override this method
c. A runtime exception is raised
d. Compilation error is raised
2. 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)

3. What are the functions of Servlet container?

a. Lifecycle management

b. Communication support

c. Multithreading support

d. All of the above

4. Which are the session tracking techniques?


a. URL rewriting
b. Using session object
c. Using cookies
d. All of the above
5. Which one of the following is not ID generating strategy using
@GeneratedValue annotation?
a. Identity
b. Manual
c. Auto
d. Sequence
6. 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

7. Which method is easy for a Java programmer to add a criterion?


a. HQL
b. HCQL
c. SQL
d. None of the Above
8. Which of the following is true about servlets?
a. Servlets execute within the address space of web server

b. Servlets are platform-independent because they are written in java

c. Servlets can use the full functionality of the Java class libraries

d. Servlets execute within the address space of web server, platform independent
and uses the functionality of java class libraries

9. Which of the following statements are correct about the status of the Http response. You can
share the session between threads
a. status of 200 to 299 signifies that the request was successful

b. A status of 300 to 399 are informational messages

c.  A status of 400 to 499 indicates an error in the server

d. A status of 500 to 599 indicates an error in the client

10. Which JDBC driver Type(s) can be used in servlet code?


a. Both Type 1 and Type 2

b. Both Type 1 and Type 3

c. Both Type 3 and Type 4

d. Type 4 only

11. What does hibernate.hbm2ddl.auto create this means?


a. create tables automatically
b. create session object automatically
c. create Session Factory object automatically
d. None
12. Which of the following are interface? 1. ServletContext 2. Servlet 3. GenericServlet 4.
HttpServlet
a. 1,2,3,4
b. 1,2
c. 1,3
d. 2,4
13. JPA implementation is provided by ---?
a. Hibernate
b. Toplink
c. Ibatis
d. All of them
14. The basic Web Services platform is combination of _____ and _______
a. CSS + HTTP
b. XML + HTML
c. XML + HTTP
d. CSS + JAVA
15. 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

16. Web services can be discovered using ________


a. UDDI
b. UIDI
c. UIID
d. None of the Above
17. Which of the following is correct about URI in RESTful web services?
a. Each resource in REST architecture is identified by its URI
b. Purpose of an URI is to locate a resource(s) on the server hosting the
web service
c. Both of the Above
d. None of the above
18. Annotation added as an input parameter to the handler meth
a. PathVariable
b. Path
c. Locale
d. None of the Above
19. RestTemplate class method which performs an HTTP HEAD operation
a. headForHeaders(String, Object…)
b. getForObject(String, Class, Object…)
c. postForLocation(String, Object, Object…)
d. postForObject(String, Object, Class, Object…)
20. Which of the following are most common configuration methods of Hibernate Configuration
a. XML Configuration hibernate.cfg.xml

b. Mapping files and XML Configuration hibernate.cfg.xml

c.  web.config

d.  http.conf

21. Which of the following code retrieves the request header?


a. Header.getHeaderName(headerName)
b. response.getHeader(headerName)()
c. request.getHeader(headerName)
d. None of the above
22. Which element of web.xml is used to specify the error handler in servlets?
a. Error-handler
b. error-page
c. exception-handler
d. none of the above
23. Does server in servlets automatically keep any record of previous client
request?
a. True
b. False
24. The Hibernate XML configuration file name is?
a. hibernate.cfg.xml

b.  hibernate.config.xml

c.  hibernate.cg.xml

d. None

25. How to create a cookie in servlet?


a. Use request.getCookie() method
b. Use response.getCookie() method
c. Response.addCookie() method
d. None of the above
26. Which of the following code is used to set the session timeout in servlets?
a.  response.setMaxInactiveInterval(interval)
b. session.setMaxInactiveInterval(interval)
c.  request.setMaxInactiveInterval(interval)
d. None of the above
27. Which of the following is true about service() method of servlet?
a. The servlet container (i.e. web server) calls the service() method to
handle requests coming from the client.
b. Each time the server receives a request for a servlet, the server
spawns a new thread and calls service.
c. The service() method checks the HTTP request type (GET, POST,
PUT, DELETE, etc.) and calls doGet, doPost, doPut, doDelete, etc.
methods as appropriate.
d. All of the above
28. Which one is the default scope of the beans?
a. Prototype
b. Singleton
c. Session
d. Application.
29. Why use RequestDispatcher to forward a request to another resource, instead
of using a sendRedirect?
a. Redirects are no longer supported in the current servlet API.
b. Redirects are not a cross-platform portable mechanism.
c. The RequestDispatcher does not use the reflection API.
d. The RequestDispatcher does not require a round trip to the client,
and thus is more efficient and allows the server to maintain
request state.
30. Which attribute is used to specify classname of the bean?
a. Name
b. Id
c. Type
d. class
31. pageContext is an implicit object in jsp.
a. True
b. False
32. Abbreviate the term HQL?
a.  Hibernate Queue Language
b. Hibernate Query Language
c. Hipher Query Language
d. None of the above
33. Which of the following is true about SessionFactory object in hibernate?
a. SessionFactory object configures Hibernate for the application using
the supplied configuration file.
b. SessionFactory object allows for a Session object to be instantiated.
c. The SessionFactory is a thread safe object.
d. All of the above.
34. Hibernate is an?
a. Open Source
b. Lightweight
c. ORM
d. All of the above
35. Which of these simplifies an Object Relational Mapping tool?
a. Data creation
b. Data manipulation
c. Data access
d. All mentioned above
36. In Hibernate Which of the following is true about <property> element?
a. The <property> element is used to map a Java class property to a
column in the database table.
b. The name attribute of the element refers to the property in the class.
c. The column attribute of the element refers to the column in the
database table.
d. All of the above.
37. Hibernate framework simplifies the development of java application to interact
with the database
a. True
b. False
38.  Is the following pointcut expression correct?
execution(* ArithmeticCalculator.*(..))

a. Yes

b.  No

39. Session.createSQLQuery creates a new instance of Query for the given SQL
query string.
a. true
b. false
40. Which advice is executed only when joint point returns or throws an exception?
a. @Before
b. @After
c. @AfterReturning
d. @AfterThrowing

You might also like