Spring MVC Upwork Test

0
409

We don’t guarantee that all provided answers are correct.

What is Dependency Injection?
Answer

  • It is a design pattern which implements inversion of control application
  • It is the one of the spring module
  • It is a technique to get dependencies of any project
  • It is used to promote tight coupling in code

Choose the options that are implementation of the ApplicationContext.
Answer

  • FileySystemXmlApplicationContext
  • ClassPathxmlApplicationContext
  • WebXmlApplicationContext
  • All of the above

The scope is ___  if a bean is scoped to an HTTP request.
Answer

  • session
  • global.session
  • prototype
  • request

What is the default bean scope in spring Framework?
Answer

  • singleton
  • prototype
  • request
  • session

Which class can be used to call Stored Procedures in Spring?
Answer

  • Jdbc Template
  • SimpleJdbcCall
  • JdbcTemplateCall
  • SPHelper

Which option is not a benefit of the a consistent abstraction for the transaction managment in Spring Framework?
Answer

  • Excellent integration with Spring’s data access abstractions
  • Simpler API for programatic tracsaction management than complex transaction APIs such as JIA
  • Support for declartive transaction management
  • Spring cannot eliminate the creation of the singleton and factory classes

How can you inject java collection in spring?
Answer

  • <list>: This helps in wiring i.e. injection a list of the values, allowing duplicates
  • <set>: This helps in wiring a set of the values but without any duplicates
  • <map>: This can be used to inject a collection of the name-value pairs where name and value can be of the any type
  • All of the above

What are the benefits of IOC?
Answer

  • It is minimizes the amout of code in your application
  • It makes your application esay to test as it doest’t require any the singletons or JNDI lookup
  • Loose coupling is the promoted with minimal effort and least intrusive mechanism
  • IDC containers supports eager instantiation and lazy loading of service
  • ALL of the above

What is Dependency Injection?
Answer

  • Spring module
  • Design pattern
  • IOC Container
  • None of the above

What is the contextclosedEvent event?
Answer

  • This event is published when the Servlet Context is either initialized or refreshed
  • This event is published when the HTTP Request is received
  • This event is published when the HTTP Response is returned
  • This event is published when the Application context is closed using the close() method on the configurable Application Context interface

___________ method returns the propagation behavior. Spring offers all of the transaction propagation option familiar from EJB CHT.
Answer

  • int getIsolationlevel()
  • int getPropagationBehavior()
  • TransactionDefinition.ISOLATION_DEFAULT
  • TransactionDefinition.PROPAGATION_NESTED

You can intercept web request through ____
Answer

  • controller execution
  • hander interceptors
  • controller mechanism
  • All of the above

_____ programing enables continous integration and testtability.
Answer

  • OOP
  • POJO
  • AOP
  • POAV

Choose the reason why the expression $(user.home) can be null despite the use of property Source annotation?
Answer

  • User.home is an environment variable not a property
  • User.home is a system variable not a property
  • Need to use ${sys:user.home}
  • Need to use ${env:user.home}

Which of the following statement is valid for @RequestMapping annotation?
Answer

  • The @RequestMapping annotation maps the request with the method
  • The RequestMappping annotation maps the response with the class
  • The @RequestMapping annotation maps the request with the prototype
  • None of the above

Which of the following viewResolver Class widely used?
Answer

  • org.SpringFramework.web.servlet.view.
    InternalResourceViewResolver
  • java.springframe.webs.servelt.view.
    IinternalResourceViewResolver
  • import.springframework.webs.servlet.view.
    InternalResourceViewResolver
  • com.springframework.class.servlet.view.
    InternalResourceViewResolver

The core _______ module provides the fundamental functionality of the spring framework
Answer

  • Container
  • Class
  • view
  • controller

Weaving is used to create new proxy ______ by applying aspects to target object?
Answer

  • Object
  • Class
  • Instance
  • File

Which of the following is the way provide configuration metadata to Spring?
Answer

  • XML Based configuration file
  • Annotation based configuration
  • java based configuration
  • All of the above

For the following code fragment , the role of the @componet annotation can best be described as?
@Componet
@Scope (“prototype”)
public @interface Scheduledjob {…}
Answer

  • All classes annotated with @Component need to be defined bean in a configuration file to be spring beans
  • All classes annoted with @component are auto detectable by spring container and hence you don’t need to bean in configuration file
  • @Component is equivalent to @Repository
  • @Component is the Equivalent to @controller

Which of the following collection types are supported by Spring?
Answer

  • list, set, map, props
  • list, set, map, tree
  • list, set, tree, props
  • list, set, map, tree, props

Which of the following statements is true about the @Requestmapping annotation?
Note: There may be more than one right answer.
Answer

  • It has a single String paramater
  • It has a String[] paramater
  • It supports ant-style paths
  • It doesn’t support wildcard input

What is the modules of the data Access/integration layer?
Answer

  • JDBC, ORM, EJB, JMS, Transaction
  • JDBC, ORM, OXM, EJB, Transaction
  • JDBC, ORM, OXM, EJB, JHS
  • JDBC, ORM, OXM, JMS, Transaction

What are the modules of the the core container?
Answer

  • core, Bean, Context, Web-MVC
  • Bean, Context, Web-MVC, Aop
  • Bean, context, Web-MVC, SpEL
  • Bore, Bean, Context, SpEL

Which of the following are called initialization methods
Answer

  • custom configrued init method
  • methods annotated with @postCconstruct
  • afterPropertiesSet as defined by InitializingBean
  • All of the above

Which interceptor property will allow you to configure them?
Answer

  • <bean id-“handlerMapping” class=”org.springframework
    .web.servlet.annotation
    .RequestMappingHandlerMapping”>
    <property name =”interceptor”>
    <list>
    <ref bean =”yourCustomHandlerInterceptor”/>
    </list>
    </property>
    </bean>
  • <bean id=”handlerMapping”
    class=”org.springframe.web.servlet.method
    .annotation.RequestMapping”>
    <property name =”interceptor”>
    <list>
    <ref bean =”yourCustomHandlerInterceptor”/>
    </list>
    </property>
    </bean>
  • <bean id =”handlerMapping”
    class=”org.springframework.web.servlet.
    method.annotation.
    RequestMappingHandlerMapping”>
    <property name =”interceptor”>
    </list>
    </property>
    <bean>
  • All of the above

Which of the following is the most efficient way to serialize an Enum to JSON with Jackson 2.1?
Answer

  • Annotate the Enum with @JsonFormat
    (shape=jsonFormat.Shape.OBJECT)
  • Use the jackson objectMapper
  • Use jackson’s @JsonSerialize annotation with a custom serilaizer
  • Use a custom mapper by extending jackson’s ObjectMapper

Which one of the following is the default Bean Scope of Spring?
Answer

  • request
  • singleton
  • session
  • global-session

For the following java configuration,Explain why the cross Request forgery protection is not correctly configured?
@EnablewebSecurity
public class websecurityconfig extend websecurityconfigurerAdapter {
@override
protected void configure(HttepSecurity http) throws Exception {
http.csrf().disable();
} }
Answer

  • Need to include the @Configrution annotation in the class definition
  • CSRF protection is client side process
  • CSRF protection is a token based system
  • you need to specifically include a url base path

Which of the following best describes the web module?
Answer

  • The web module enables the creation of a web application without XML. The web.xml file needs to be configured for using the web module
  • the web module enables the creation of the android application without XML. The web.xml file needs to be configured for using the web module
  • The web module enables the creation of a php application without XML. The web.xml files needs to be configured for using the web module
  • None of the above

The target ________ is free to center on its major concern using the _______ concepts.
NOTE: There may be more than one right answer.
Answer

  • Class
  • Method
  • AOP
  • Lifecycle

Scopes of spring bean are ______, __________ ,request, session and global session.
NOTE: There may be more than one right answer
Answer

  • Singleton
  • WebSocket
  • Prototype
  • Scopes

The Spel module provides a powerful expression _______  for querying and manipulation of an object.
Answer

  • Language
  • SDK
  • Class
  • Tool

What are the different types of the Autowire?
Answer

  • byName
  • byType
  • constructor
  • autodetect
  • All of the above

What is the difference between the @Repository and the @controller annotation in Spring?
Answer

  • “@Repository”, is used as a stereotype for the persistence layer while “@controller”
    is used as a stereotype for the presentation layer
  • “@Repository”, is used as a stereotype for the presentation layer while “@controller”
    is used as a stereotype for the persistence layer
  • “@Repository”, is used as a stereotype for the service layer while “@controller”, is used as a generic stereotype for any spring-managed component
  • “@Controller” is used as a stereotype for the service layer while “@Repository”, used as a generic stereotype for the Spring-managed component

Which of the following are AOP implementation?
NOTE: There may be more then one right answer.
Answer

  • Spring AOP
  • Apache AspectsB
  • JBoss AOP
  • All of the above

The IOC container gets information from the ______ file.
Answer

  • XML
  • PHP
  • Class
  • WebSocket

Which is the best explanation as to why this java configuration fails to correctly override / add a resource handler?
@Configuration
@ComponentScan(“…..”)
@EnableTransactionManagment
public class ApplicationContextConfig { // code}
Answer

  • public class ApplicationContextConfig nedds to extend Spring’s webconfigurerAdapter
  • @EnableTransactionManagement is the only for JPA configuration
  • @EnableTransactionManagement restricts the classpath scan for Spring data annotation only
  • You need to remove the @ComponentScan annotation

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.