Java Enterprise Architecture Quiz - Patterns, Spring, and Servlets

Test your knowledge of software architecture concepts including design patterns, Spring framework, Java Servlets, and build tools

20 Questions Published

Questions

Question 1 True/False

Attributes bound into session are available to any other servlet that belong to the same ServletContext?

  1. True
  2. False
Question 2 Multiple Choice (Single Answer)

Given req is an HttpServletRequest, which snippet creates a session if one doesn't exist?

  1. req.getSession(false);
  2. req.getSession(true);
  3. both the above
  4. none of the above
Question 3 Multiple Choice (Single Answer)

Which statements about ServletContext initialization parameters are not true?

  1. They should be used for data that changes rarely.
  2. They can be accessed using ServletContext.getInitParameter()
  3. They can be accessed using ServletContext.getParameter()
  4. They should be used for data that is applicable to an entire web application.
Question 4 Multiple Choice (Single Answer)

Which of the following methods are declared in ServletRequest?

  1. getMethod()
  2. getHeader()
  3. getCookies()
  4. getInputStream()
Question 5 Multiple Choice (Single Answer)

In the init(ServletConfig) method of Servlet life cycle, what method can be used to access the ServletConfig object ?

  1. getServletInfo()
  2. getInitParameters()
  3. getServletConfig()
  4. None
Question 6 Multiple Choice (Single Answer)

When do you use Spring in testing?

  1. Stress Testing
  2. Regression Testing
  3. Integration Testing
  4. None
Question 7 Multiple Choice (Single Answer)

Find the scope from the below list which is not defined in the Spring?

  1. singleton
  2. Prototype
  3. request
  4. response
Question 8 Multiple Choice (Single Answer)

Spring's bootstrap object that loads all the high-level (entry-point) objects that are required by your application. What we call this mechanism?

  1. Application scope
  2. Application Integration
  3. Application Context
  4. None
Question 9 Multiple Choice (Single Answer)

A Java class encapsulating one or more advices is called as ?

  1. A pointcut
  2. a join Point
  3. an Aspect
  4. None
Question 10 Multiple Choice (Single Answer)

Spring does not support one of the below dependency injection.?

  1. Constructor Injection
  2. Setter Injection
  3. interface Injection
  4. None
Question 11 Multiple Choice (Single Answer)

What are the types of the transaction management Spring supports?

  1. Programmatic transaction management.
  2. Declarative transaction management.
  3. Both 1 and 2
  4. None of the above
Question 12 Multiple Choice (Single Answer)

Which Tag in Ant will Invoke the build Process?

  1. Target
  2. Deploy
  3. Compile
  4. copy
Question 13 Multiple Choice (Single Answer)

How many targets can we create in the build.xml?

  1. 1
  2. 10
  3. 5
  4. Any number of targets
Question 14 True/False

we can re-name the build.xml ?

  1. True
  2. False
Question 15 Multiple Choice (Single Answer)

which of the following tags to declare a variable in ant build script?

  1. property
  2. file
  3. variable
  4. declare
Question 16 Multiple Choice (Single Answer)

Root tag in Ant script?

  1. Project
  2. Root
  3. Directory
  4. folder
Question 17 Multiple Choice (Single Answer)

which tag used to display messages in the ant console ?

  1. print
  2. out
  3. write
  4. echo
Question 18 Multiple Choice (Single Answer)

which property in Target will invoke pre-targets?

  1. depends
  2. include
  3. pre-target
  4. none of the above
Question 19 Multiple Choice (Single Answer)

What is a Decorator pattern?

  1. decouple an abstraction from its implementation so that the two can vary independently
  2. One class takes in another class, both of which extend the same abstract class, and adds functionality.
  3. Assembles group of objects with same signature
  4. One class controls the creation of and access to objects in another class.
Question 20 Multiple Choice (Single Answer)

What is a Façade pattern?

  1. The reusable and variable parts of a class are broken into two classes to save resources
  2. One class controls the creation of and access to objects in another class.
  3. One class takes in another class, both of which extend the same abstract class, and adds functionality.
  4. One class has a method that performs a complex process calling several other classes.