100% found this document useful (2 votes)
13K views

Accenture Dumps

The document provides incomplete code for a Spring Boot application with REST endpoints. It asks to complete the code by choosing valid options to define dependencies, configure properties, implement controllers and services, and add annotations. It also asks questions about Spring Security configuration and features of the myWizard DevOps tool.

Uploaded by

mamidi sudeep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
13K views

Accenture Dumps

The document provides incomplete code for a Spring Boot application with REST endpoints. It asks to complete the code by choosing valid options to define dependencies, configure properties, implement controllers and services, and add annotations. It also asks questions about Spring Security configuration and features of the myWizard DevOps tool.

Uploaded by

mamidi sudeep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Answer

Refer the incomplete code given below:


application propperties
===================
Assume other properties are configured
Line1 =8080
pom.xml
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>org.springframework.boot</groupId>
<artifactId>Line2</artifact><!--Dependency for web application-->
</dependency> server.port,sprint-boot-s
....Class
=========
Line3
......class Application{
public static void main(String [] args){
Line 4.run(Application.class,args);

......Controller,Starter Class is coded appropriately.


... required to deploy the application on port 8080
choose valide option from below to complete the code

Itisrequiredbyjacktofetcheemployeedetailsbysalary,suchthatsalarygreaterthanequal
tocertainvalue,andresultshouldbeorderedindescendingorderofEmployeeId.
Refer the incomplete code and help jack to complete the requiremen:
application.properties
==============
#Assume other properties are configured properly #DataBase url
Line1= jdbc:mysql://localhost:3306/springbootdb pom.xml
======
<!--Assume other dependencies are configured--> spring.datasouce.url,sp
<dependency> groupId>org.springframework.boot</groupId> jpa,@Repositorydefinitio
<artifactId>Line2</artifactid><!--Dependency for DB-->
</depenency>

Line3(domainClass=EmployeeEntity.class,idClass=Integer.class)
@Transactionalsactional
public interface EmployeeDAO
refer the incomplete spring security configuration given below
<!--Assume that the HTTP element is configured properly-->
<Line1>
<Line2>
<Line3>
<. "ROLE_MSD_USER"/> authorisation-manager,
<. ="ROLE_MSD_ADMIN"/>
<. ="ROLE_MSD_DBA"/>
<Line3>
<Line2>
<Line1>
....................................................................above code
Refer the incomplete code given below:
application propperties
===================
#Assume other properties are configured
#Database url
Line1 =jdbc.mysql://localhost:3306/springbootdb
pom.xml
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>org.springframework.boot</groupId>
<artifactId>Line2</artifact><!--Dependency for web application-->
</dependency>
DAO spring.datasouce url,sp
========= data-jpa,@RepositoryD
Line3(domainClass = Employeeentity.class.idClass=integer.class)
@transactional
public interface EmployeedAO{
Line4("select k from EmployeeEntity k where k salary.=?")
List,EmployeeEntity>getAllEmployeesBySalary(Double salary)
......class Application{
public static void main(String [] args){
Line 5.run(Application.class,args);

......Controller,Starter Class is coded appropriately.


... required to deploy the application on port 8080
choose valide option from below to complete the code
.......................................
Given Below
com.accenture.lkm.application
.....Application
... Application {
public static void main(String[] args){
Application.run(Application.class, args);

----------------------------------------------------------------
Error while deployment as prim
...accenture.lkm.web.controller;
....
MessageController {
.. String(value = "/sayHi/{message}",
"application/json"},
RequestMethod.GET)
.....ENtity<String>
.....@PathVariable("message") String messageVar) {
responseEntity<String>("Message From
messageVar, HttpStatus.OK);
@SpringBootApplication,Sprin
(!)A spring MVC application can have multiple child content (!!) Child content Both 1 and 2
belongs to DispatcherServelet
Choose the appropriate option from below

identify the characteristics of Microservices [choose 2]

Highly cohesive Independentl


Refer the below incomplete code for a Spring rEST based application
@RequestMapping(value = "/students/updateStudent",
method =Line1PUT,
consumes= Line2.APPLICATION_JSON_VALUE)
public Line3<StudentBean>updatedStudent(Line4StudentBean student) { RequestMethod,MediaType,R
ody
StudentBean updateStudent = null;
//code goes here
return newLine3<studentBean>(updateStudent, HttpStatus.OK);
Choose from below a valid option , in the order as it appears, to complete the
above code

Which of the following is correct with respect to Spring MVC?


1) Root context belongs to dispatcher servlet. Only (ii)
2) Common configuration is configured in root context and presentation layer
configuration is configured in child context
Refer the incomplete code given below for a Spring REST based application:
@RestController
Public Class CstController{
----------------Line 1---------------
public ResponseEntity<CstBean> CreateCstMember(@RequestBody
CstBean cstBean)
{
CstBean bean1=null;
//Logic goes here
return new ResponseEntity<CstBean>(bean1,Httpstatus.OK); @RequestMapping
}
}
Assume application is deployed on port 8090 and following URL is hit to
access the application using "POST MAN CLIENT" with
POST verb and valid request body with header application/json.
URL: http://localhost:8090/App/cst/controller/createCst
Choose from a valid option to complete above code so that JSON response is
returned in response to request

Which of the following feature(s) is/are included in myWizard DevOps? All of the above

Choose a valid option from below that helps to auto the database correction @EnableAutoConfiguration
and... in Springboot

In the digital era there are key success factors addressed by mywizard All of the above
Deveops. Pick the valid success factors.

What are the features are possible to be availed through the provisioning of Highly Scalable, Manual Heal
Intelligent using myWizard DevOps?
package com.accenture.lkm.application;
@SpringBootApplication
public class Application {
public static void main(String [] args) {
SpringApplication.run(Application.class, args);
}
}
//--------------------------------------------------------------------------
Error while deployment as Pri
package com.accenture.lkm.web.controller;
@RestController
public class MessageController {
@RequestMapping(value= "/sayHi / {message}",
producer={ "application/json"},
method= RequestMethod.GET)
public ResponseEntity<String>
getEmployeeById(@pathvariable("message") String messageVar) {
return new ResponseEntity<String>("Message From Controller":
messageVar.Httpstatus.ok);
Question is blur @SpringBootApplication, @R
Question is repeated @RequestMapping, TEXT_HT
It is required to secure the Spring MVC based application using the following
matrix by using Spring Security 4.x
*/saveStudent*** -should be accessible to ADMIN,
*/getStudentDetails*** -should be accessible to ADMIN, DBA and USER
Refer below the incomplete spring security coniguration
<http use-expression="false">
------Line1------ <intercept-url pattern=*/saveS
<!----Otherrelatedconfigurationgoeshere > <intercept-url pattern=*/getStu
</http> ROLE_DBA, ROLE_USER"/>
Assume ADMIN(ROLE_ADMIN),DBA(ROLE_DBA) and USER(ROLE_USER)
configurated property within the AuthenticationManager tag
Choose from below a valid option to complete the above code
Question is not visible
Question is not visible @Autowired,@Autowired
Refer the incomplete code given below
---------Line 1------------
public class EmployeeController { @Autowired
private EmployeeServiceImpl employeeService:
---------Line2 (value="emp/controller
/getDetails",.method=RequestMethod, GET,
produces=MediaType,APPLICATION_JSON_VAL public------------Line3 @RestController,@RequestM
<List<EmployeeBean>> getEmployeeDetails(){
return employeeServices.getAllEmployees();
}
Choose from below a valid option to complete the above code, in the order as
it appears.
Refer the below Requirement to be implented using Spring Security, <http auto-config="false">
LoadSave should be accessible to CST_ADMIN,CST_DBA <intercept-url pattern="/LoadR
LoadReport should be accessible to CST_ADMINonly access="hasRole('CST_ADMI
Choose from below valid option to complete the above requirement pattern="/LoadSave" access=
</http>
Refer the below requirement to be implemented using spring security. 1) <http auto-config="false">
LoadSave should be accessible by CST_ADMIN,CST_DBA. 2) LoadReport <intercept-url pattern="/LoadR
should be accessible to CST_ADMIN only. access="hasRole('CST_ADMI
pattern="/LoadSave" access=
Which of the components are connected to myWizard DevOps. </http>
All of theabove
<dependency>
<groupId>org.springframewor
<artifactId>spring-boot-starter
</dependency>
@SpringBootApplication,@Re
L

Refer the incomplete code given below: @Controller public class


EmployeeController{ Assume appropriate DAO injected by using appropriate
annotation. public Map<Integer,String> getEmployeeDetails()
{ Map<Integer,String> map= new HashLinkedMap<>(); return map}} DAO @ModelAttribute,@Persistenc
Layer @Repository @Transactional public class EmployeeDao{ private
EntityManager entityManager; List<EmployeeBean> getEmployeeDetails()
{ Query query = entityManager("Select E from Employee
E"),List<EmployeeEntity> entities=query.getResultList(); return beans;
choose from below a valid option representing the proper nme of the default only(1)
properties files in springboot (i)application.properties (ii)web.xml
(iii)appliction.xml
refer the below incomplted code for a spring Rest based appliction
@RequestMapping(value ="/students/updateStudent", method=line1put,
consumes=line2APPLICTION_json_value
publicLine3<StudentBean>updateStudent( Line4 StudentBeanstudent){

} RequestMethod,MediaType,R

a) <http use-expressions='fals
Refer the below Requirement to be imported using Spring Security <intercept-url pattern="/LoadRe
1)LoadSave should be accessible to CST_ADMIN,CST_DBA 2)LoadReport <intercept-url pattern="/LoadS
should be accessible to CST_ADMIN only access="ROLE_CST_ADMIN,R
<!-- Rest Code Goese here -->
Choose form the below valid option to complete the above requirement </http>
Refer the incomplete code given below:

@Controller
public class CstController {
( value = "/registration",method
= )
publicModelAndViewregister(@ModelAttribute("empBean") EmployeeBean
employeeBean){
ModelAndView modelAndView = new ModelAndView(); @RequestMapping,RequestM
// Business logic goes here....
return modelAndView;
}
}

Assume that a view exists that submits the Request for action "/registration"
using Spring form's default request submission method.

Choose from below a valid option in the order as it appears to complete above
code:
Choose from below a valid option representing the proper name of the default
properties files in SpringBoot i) only (i)
application.properties
web.xml
application.xml
Refer the code given below

@RestController public class CstController { @RequestMapping(value =


"/rest/controller/deleteCstBean/{id}",
method = RequestMethod.DELETE ,
produces = MediaTyper.APPLICATION_JSON_VALUE) public
ResponseEntity<CstBean>
deleteCstBean(@PathVariable("id") int myId) { CstBean cstBean=null'
// Code goes here to initialize the CST bean return new
ResponseEntity<CstBean>(cstBean. restTemplate.delete("http://loc
HttpStatus.OK); 02");
}
}

Assume Application is deployed on port number 8089 and is accessible using


the URL: http//localhost:8089/App
Assume the restTemplate is holding the instance to the
org.springframework.web.client.RestTemplate
Choose from below a valid RestTemplate call to invoke the above method
Which one of the HTTP verbs given is not idempotent and not safe. POST
Refer the incomplete code below:
@Controller
public class CstController {
//AssumeRequestmappingcodeiswrittenhere
publicModelAndViewregister(@ModelAttribute("custBean") CustomerBean
bean) throws InvalidNameException{
//code goes here...
throw new InvalidNameException(); return modelAndView;
}
//LineX
public ModelAndView handleException(InvalidNameException exception) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("DisplayMessage"): //Logical
Name of the view to Navigate in case of error
modelAndView.addObject("ErrorMessage",exception); return modelAndView;
} @ExceptionHandler(value=Inv
}

DisplayMessage.jsp
========================
<center>
<h2>Exception Handler Page</h2>
<hr>
Details of Exception:<br/>
<!-- LineY - Code to print exception details-->

</center>

Choose from below a valid option to fill in LineX and LineY in the order as it
appears to complete the above code so that DisplayMessage.jsp displays the
error message when InvalidNameException is thrown
Refer the incomplete configuration for Spring Security given below:
<authentication-manager>
<authentication-provider>
<user-service>
<!-- Line1 -->
</user-service> <user-name="cst_dba" passw
</authentication-provider> <user-name="cst_admin" pas
</authentication-manager> authorities="ROLE_CST_ADM

Assume CST_ADMIN Credentials are :username:cst_admin


password:cst_admin Assume CST_DBA Credentials are :username:cst_dba
password:cst_dba
Choose from below a valid option to complete the above configuration to
configure users using in-memory service
Refer the incomplete spring boot code given below:
package com.accenture.lkm;

public class Application{


public static void main (String args[])
{ SpringApplication.run(Application.class,args);
}
}
//--------------------------------------------------------------------------------------------------- @SpringBootApplication, @R
package com.accenture.lkm.web.controller;

public class MessageController{


@Requestmapping(value="/sayHi/{message}", produces={"application/json"},
method=RequestMethod.GET)
publicResponseEntity<String>
getemployeeById( ("message")stringmessagevar){ return new
ResponseEntity<String>("MessageFrom
Controller:"+messagevar,Httpstatus.OK);
}
Choose from below a valid combination of annotations which is equivalent to
@SpringBootApplication
1)@Configuration 2)@EnableAutoConfiguration 3)@ComponentScan All 1,2 and 3
packagecom.accenture.lkm.application; @SpringBootApplication
publicclassApplication{
public static void main (String args[])
{ SpringApplication.run(Application.class,args);}}
//---------------------------------------------------------------------------------------------------
package com.accenture.lkm.web.controller; @RestController
publicclassMessageController{@Requestmapping(value="/sayHi/{messege}", Move the Primary configuratio
produces={"application/json"},
method=Requestmethod.GET) publicResponseEntity<string>
getemployeebyid(@pathvariable("message")string messagevar){return new
responseEntity<string>("message from
controller:"+messagevar,httpstatus,OK);}
Refer the incomplete code given below for a Spring REST based application:
@Controller
Public Class
CstController{ @RequestMapping(value="/cst/controller/createCst",
method=RequestMethod.POST,
consumes=MediaType.APPLICATION_JSON_VALUE,
produces=MediaType.APPLICATION_JSON_VALUE)

publicCstBeanupdateCstMember( CstBeancstBean) @ResponseBody,@RequestB


{
CstBean bean1=null;
//Logic goes here return bean1;
}
}

Choose from a valid option in order as it appears to complete above code.


Which of the following is/are the valid Content Negotiation strategies in Spring
Boot ?
both (i) and (ii)
URL ExtensionBased
URL ParameterBased

Choose the most appropiate option


Theannotation@RestControllerisequivalentto
annotation@Controller
annotation @ResponseBody Both 1 & 2
annotaion @RequestMapping
Both 1 &2
refer the incomplete code given below for spring Security
CustomsecurityLoginPage.jsp
<form name='loginform' action='<c;url
value='/catsecureLogin,/>'method=Line1> User;<input type=''text' name
='uname123' ><br/>
<input nme="submit" type = "submit" value ="submit" / >
</form>
post,dispCstLogin.html,cstSec

Configure in Sprig Security <http> element

<.form-login
loginpage="/line3 " username-parameter='uname123' password-
parameter="pwd123" authentication-failure-
//Code to invoke the DAO addEmployee(employeeBean)
}
}
DAO Layer
=======
@Repository
line3
pulic class EmployeeDAO{
Line4
private EntityManager entity manager;
@controller@Repository@Tra
//Assume addEmployee(EmployeeBean employeeBean) is already coded
}
view
=====
<form:formLine5="empobj"method="GET"action =""saveEmployee.html">
<!--Code goes here to enter the employee details--->
<input type = "submit"value="Register"/>
</form.form>

refer the incomplete given below for a spring Rest based application:
@restcontroller
public class cstcontroller{ // line -1 public responseEntity<list<cstbean>>
getDetails(@pathvariable(*p1*)double data) @requestmapping(values="cs
{ list<cstBean>list=cstServiceimp1.getcstDetails(data);//logic goes here ..... requestmethod.GET,
return new ResponseEntity<list<csrBean>>(list,httpStatus.OK);}} produces = media Type.APPL
Assume application is deployed on port 8080 and following URL is hit to
access the application using a web BROWSER URL:
http://localhost:8090//app/cst/controller/getDetailsinrange/120
choose from below a valid option to be placed at 'line1' to complete the above
code so that json response to the req.

refer the incomplete code given below:


.......class

----line1-----
-------line2
(locations="classpath;com/accenture/lkm/resources/springservlet-xml') @springbootapplication,@imp
public class Application{public static void main(String args[]){/*code goes ntent-negotiation- manager
here*/}} XML configuration file to overrides the ContentNegotiation
=========================================================
<bean id="contentNegotiationManager"
class="org.springframework.web.accept-------line3 "
primary="true">
<!-codegoeshere...></bean><mvc.annotation-driven---line4
="contentNegotiationManager"/>
assume rest of files are coded appropriately
choose from below a valid option to complete the above code,in order as it
appears
<dependency>
<groupid>org.springframewor
which maven dependency is used to create a spring boot web application <artifactid>spring-boot-starter
</dependency>
packagecom.accenture.lkm.application; @SpringBootApplication
publicclassapplication{
public ctatic void main (String args[]){
springapplication.run(application.class,args);}}
//---------------------------------------------------------------------------------------------------
package com.accenture.lkm.web.controller; @restController
publicclassmessagecontroller{@requestmapping(value="/sayHi/{messege}", error while deployment as prim
produces={"application/json"},
method=requestmethod.GET) publicresponseEntity<string>
getemployeebyid(@pathvariable("message")string messagevar){return new
responseEntity<string>("message from
controller:"+messagevar,httpstatus,OK);}

where is devops heading towards in technology-specific


in spring rest which of the following triggers httpmessageconverter to convert
the java object to json. xml,other MME type based on configuration?
choose most appropritae options
@requestbody
refer thr incomplete spring security configuration given below
<http----level1 >
<----line2 pattern='/getdetails
process= ROLE_MSD_ADMIN,ROLE_MSD_DBA,ROLE_MSD_USER"/>
----LINE3-----------
http> @use-expressions="false",inte
choose from below a valid option, in order as it appears , to complete the
above code

choose from below the beans that are not inherited from the spring MVC's
parent context beanpostprocessors and bean
refer the incomplete code given below Controller
============
@Controller
public class EmployeeController{
//Assume methos to display the view and do model binding already exists
@RequestMapping (value= "registration", method= RequesrMethodPOST)
Public ModelAndView register(--------line1-------{"employeeBean")-----
line2--------
EmployeeBeanemployeebean----------line3 result){
ModelAndView modelAndView = newModelAndView();
//your code goes here return modelAndView;}} View
=========================
<form form method ="post" modelAttribute+"employeeBean" action @ModelAttribute,@Valid,Bind
="registration.htm"> ssage
employee name<form.input path="name"/><br/> password <form password
path="password"/>>br/>
<inputtype="submt"value="register"><spring----------line4
name="employeebeans"><h3>ALLerrors</h3>
<form.error path=""cssclass="error"/></spring------------line4
></form.form>
configuration file
==============================
<bean><!---assumerestoftheconfigurationiswritten>
<bean id ='messagesource"
class="org.springframework.context.support----------line5 ">
<property name ="basename"
value="classpath.com/accenture/lkm/resources/message"/>
<property name "defaultencoding" value="UTF-8"/></bean></beans>
note:assume employeebean is coded and messages properties is already
configured properly. choose from below a valid option to complete the above
code, in the order as it appears

Refer the incomplete code given below pom.xml


========
<!--Assume other dependencies are configured-->
<parent>
<groupid>org.springframework.boot</groupid>
<artifactid>Line1</artifactid>
<version>1.5.2.REALEASE</version>
</parent>
<dependency> Starter Class
=============
Line3
public class Application {
public static void main(String[]args) {
Line4run{Application,class, args);
refer the incomplete code given below application properties
=============
#Assume other properties are configured
Line1 =8080

pom.xml
========
<!--Assume other dependencies are configured-->
<Dependency> server.port,spring-boot-starter
<groupid>org.springframework.boot</groupid> server.port, spring-boot-starte
<artifactid>Line2</artifactid>
<!---Depedency for web application-->

<dependency> Starter Class


=============
Line3
public class Application {
public static void main(String[]args) {
/*Code goes here*/
}
//Code to invoke the DAO addEmployee(employeeBean)
}
}
DAO Layer
=======
@Repository
line3
pulic class EmployeeDAO{
Line4
private EntityManager entity manager;

//Assume addEmployee(EmployeeBean employeeBean) is already coded


}
view
=====
<form:formLine5="empobj"method="GET"action =""saveEmployee.html">
<!--Code goes here to enter the employee details--->
<input type = "submit"value="Register"/>
</form.form>
Refer the incompleted code given below for spring Mvc controller
Line1
public class GreetController{ @Controller , @Requestmapp
-Line2(line3="Home") public modelandViewHomepage(){
}
}
choose from below a valid option , in the order as it appears , to complete the
above code
Rocky has coded the custom spring security login page as shown below
CstSecurityLogin.jsp

<form name="loginform"action="<c.url value =


""/cstValidateSecureLogin"/>"method="POST"> userr;
<input type ="text" name='uname123'><br/> Password;
<input type='password'name='pwd123/><br/>'

<innput type="submit type"=submit"value="submit"


</form>

to display this login page properly he has mapped following entry in the spring
web conent
<mvc;view-controller path="/cstLogin.html" view name ="CstSecurity.Login"/>

choose from elow a valid form -login tag configuration that rocky will place in
the http element of spring security configuration to load the custom secuirty
login page

Refer the incomplete code given below for a Spring REST based Application:

@RestController
public class CstController {

//Line-1
public ResponseEntityslist<CstBean>> getDetails(@PathVariable("p1") double
data)
{
List<CstBeans list - cstService Impl.getCstDetails(data);
//Logic goes here....
return new ResponseEntity<List<CstBean>>(list, HttpStatus.OK);
}
}

Assume application is deployed on port 8090 and following URL is hit to


access the application using a web BROWSER". URL:
http://localhost:8090/App/cst/controller/getDetailsInRange/120
Choose from below a valid option to be placed at "Line-1" to complete the
above code
that Json response is returned in response to the request:
1- Easy to adapt 2-HighlyScal
What are the features to be possible that can be availed through the 3-LooksTremendousBuinessV
provisioning of Intellegent Automation using MyWizard DevOps

Refer the incomplete code given below for Spring Security

CustomSecurityLoginPage.jsp
1 <form name='loginForm' action="<c:url value='cstSecureLogin/' 2
User:<input type='text' name='uname' > <br/>
3 Password:<input type='password' name='pwd" > <br> 4 <input
name="submit" type="submit" value="submit" /> 5 </form>
post , dispCstLogin.html, cstS
Configuration in Spring security's <http> element
<form-login
login-page="/ Line1 "

login-processing-url="/Line2 "
username-parameter="Line3 "
password-parameter="Line4"
authentication-failure-url="/dispСstLogin.html?cst_Error=try

Assume dispСstLogin.html is mapped to display the CustomSecurityLogin


Page jsp us Choose from below a valid option in the order as it appears to
complete the above co

not visible Management APP:


On Page 1 Student will enter details. On clicking submit, details are displayed
on Page2 which is review page On clicking submit on Page 2 requests
submitted to url
/studentsConfirm to pay the Confirmed details on Page 3.
Asume details on Pages are stored in StudentBean object "stuobj"
Refer the incomplete code given below and help Jhon to complete this code:

@Controller
Line1
public class StudentController
//Assume request handlers for the other requests are coded properly
@RequestMapping (value="/studentConfirm", method =
RequestMethod.GET) public ModelAndView
confirmStudentDetails(Line2StudentBean studentBean)
//Code to get the studentBean object is written here ModelAndView
modelAndView = new ModelAndView(); modelAndView
setViewName("ConfirmStudentDetails"); modelAndView.addObject("message",
"Hi, Welcome" + studentBean.getStudentName())
retum modelAndView
}
}
Choose from below a valid option, in the order as it appears to complete the
above code"
not visible
Springdoesnotstorethedatain instead stores in.
requestScope,SpringModel
Choose from below valid option.
Code not visible clearly: Choose the best option
1- RequestMethod.POST, @Re
Assume that HTML code exists which submits a POST request RequestMethod.GET,@Param
validatedLogin.html with parameter name: uName and pwd Choose from 3- RequestMethod.GET, @Re
below valid option in the order as it appears to complete above code @RequestMapping("password
RequestMethod.POST,@Req
In Spring Rest, which of the following triggers HttpMessageConverter to
convert the Java to JSON, XML, other MIME type based on configuration?

Choose most appropriate option.


Which of the following statements is/are correct with respect to Spring MVC. @RequestBody
A Spring MVC application can have multiple childcontext.
Child context belongs toDispatcherServlet.

Choose the most appropriate option. Both (1) and(2)


Jack is new to Spring MVC and wants to display home.jsp, when ever request
for the home.html is placed. Help jack to complete code given below.

Configuration file:

<!_ Assume other configuration is done properly_>


<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
>
<property name="Line1">
<value>/WEB-INF/jspViews/</value>
<property name="Line2">
<value>.jsp</value>
</property>
</bean> Controller
@Controller
public class LoginController {
@RequestMapping(value="/home.html", method = RequestMethod.GET) prefix, suffix, setViewName("h
public ModelAndView getWelcomeMessage() {
ModelAndView mv = new ModelAndView(); mv.Line3;
mv.Line4("obj","Welcome!! "): return mv;
}
}

home.jsp

<html>
<h2>${obj}</h2>

Continuation...........
Alreadyrepeatedquestion
Whichofthefollowingisusedtotranslatethelogicalviewnametophysicalviewname. ViewResolver
Already repeatedquestion
Already repeated question
In Spring Rest, which of the following triggers HttpMessageConverter to
convert the request data in JSON to Java Object type?
@RequestBody
Choose most appropriate option.
Refer the incomplete code given below Controller
============
@Controller
public class EmployeeController {

Line1
private EmployeeDAO employeeDao;
}
DAO Layer @Autowired, @PersistanceCo
=============
@Repository
public class EmployeeDAO {

Line2
private EntityManagerFactory entityManagerFactory;
}
Choose from below a valid option to complete the above code in the order as
it appears.
Refer the incomplete code given below:
Controller
==========
@Controller
public class EmployeeController {
//Assume method to display the view and do model binding already exists

@RequestMapping(value = "registration", method = RequestMethod.POST)


public ModelAndView
register(Line1_("employeeBean")_Line2_EmployeeBean employeeBean,
_Line3result) { ModelAndView modelAndView = new ModelAndView();
//Your code goes here return modelAndView;
}
}
@ModelAttribute, @Valid, Bin
View ReloadableResourceBundleM
======
<form:form method = "POST" modelAttribute = "employeeBean" action =
"registration.html"> Employee Name : <form:input path = "name" /></br>
Password : <form:password path = "password" /></br>
<input type ="submit" value ="Register">
<spring:Line4name="employeeBean">
<h3>All Errors</h3>
<form:errors path="*"css Class="error"/>
</spring:Line4>
</form:form>

Configuration file
===============
<beans>

All bean are not inherited


Continued..........
Choose from below the beans that are not ingerited from the spring mvc's
parent context.
Refer the incomplete code given below for a Spring REST based Application:

@RestController
public class CstController {

//Line-1
public ResponseEntity<List<CstBean>> getDetails(@PathVariable("p1")double data)
{ @
List<CstBean> list = cstServiceImpl.getCstDetails(data); R
//Logic goes here.... p
.
.
.
Assume application is deployed on port 8090 and following URL is hit to access the application
"using a web BROWSER" URL https://.....
Choosefrombelowavalidoptiontobeplacedat"Line-
1"tocompletetheabovecodesothatJsonresponseisreturnedinresponsetothe
It is required tp secure the Spring MVC based application using the following matrix by using
Spring Security 4.x "/saveStudent**" - should be accessible to ADMIN <
. a
. <
Choose from below a valid option to complete the above code a
Refer the below incomplete code for a Spring REST based application
@RequestMapping(value="/students/updateStudent",
method=_Line1_.PUT, consumes=_Line2_.APPLICATION_JSON_VALUE)
.
. R
} @
Choose from below a valid option, inthe order as it appears, to complete the above code
Refer the incomplete code given below: @Controller
public class CstController {
.
.
Assume that a view exists that submits the Request for action "/registration" using Spring
form's default request submission method. Choose from below a valid option in the order as is @
appears to complete above code:
Which of the following statement(s) is/are CORRECT with respect to Spring MVC?

In an application there can be more than one webcontext b


Web context belongs to wholeapplication

Choose the most appropriate option.


Springdoesnotstorethedatain instead storesin r
Choose from below a valid option Repeated Question
Which of the following statement(s) is/are CORRECT with respect to Spring MVC?
A Spring MVC application can have multiple childcontext
ChildcontextbelongstoDispatcherServlet Choose the most appropriateoption. b
Which maven dependency is used to create a spring boot web application?
<
<
<
<
myWizard DevOps is build on which tool? K
<--Assume other dependencies are configured-->
<dependency>
<groupid>Line2</artifactid><!--Dependency for web application-->
</dependency> starter Class
=======
Line3
public class application{
public static void main(string[] args){ A
/*code goes here*/ C
}
}
controller
============
Line4
public class Eemployeecontroller{
//code goes here G
}
TheHttpverbwhichisIdempotentanssafeis
What is the correct syntax to generate a drop down box A
Avalidoptionrepresentingthepropernameofthedefaultpropertiesfilesinspringboot(1)applicationproperti o
es(2)web.xml(3)applicat
Refer the below incompleted code for a spring rest based application R
@RequestMapping(value=”/students/updatestudent”
,method=Line1put,
consumes=line2.APPLICATION_json_value)
Which of the Following statement is/are CORRECT with respect to Spring MVC? B
(1)In an application there can be more than one web context (2) web context belongs to whole
application
refer the incomplete code given below Controller
=========
@controller
John is creating a custom beam validation for spring MVC application.
He created an annotation and a validation class. Which has the actual validation logic .help john to
complete the code
Refer the incomplete code given below for the “spring Form”<form.formline1”validateLogn.html”
Line2”loginBean”>
<table><tr><td><table>Name</table><td>.. assume loginBean the Model Object username

Choose from Below the beans that are not inherited from the springMVC’s parent context B
Springdoesnotstorethedatain instead stores inchoose from below a validoption R
Assumingly we are using Spring's Validation framework.
In order to display a text field along with its error message(s), which <form:input path="firstName
of the following options will you use to accomplish this? path="firstName" /\></font>
A handler method annotated with
@RequestMapping supports String as its return type. State True or
False TRUE
TRUE
FALSE
Refer to the following statements :-
Statement 1 : A Command Class is called a Form Backing Bean.
Statement 2 : This class also returns a ModelAnd View Object.
Choose the most appropriate option:-
1)Statement1isTrueandStatement2isFalse Statement 1 is True and Sta
2)Statement2isTrueandStatement1isFalse 3)Both the statements
are True
4)Both the statements are False
Identify the right syntax to add datat
A Model And View object and send to the Controller. Choose two
most appropriate options.
ModelAndView mv = new ModelAndView();
mv.addObject("data",new SomeData()); ModelAndView mv = new M
new ModelAndView("data",newSomeData());
new ModelAndView(newSomeData(),"data");
The annotation is used to
inject data objects before a jsp page loads in order to ensure that
the jsp page has all the data required to display itself.
Choose the most appropriate option:
@ModelAttribute @Model @ModelMap @ModelData @ModelAttribute
Assume the below code is written in a Controller class
1@modelAttribute("countryList");
2public List<string> populateCountry(){ List<string> myList=new
ArrayList<string>(); myList.add("India");
myList.add("US"); return myList;
}
the annotation is used to inject data objects before a jsp page
load sinoderto ensure that jsp page has all data required to display <form:radiobuttons path="co
itself

@ModelAttribute
the tag in spring view page will help users view validation <form:errors>
related errors <form:inputpath="firstName"
Assumingly we are using Spring's Validation framework. ont> option 1 and2
In order to display a text field along with its error message(s), which
of the following options will you use to accomplish this?
The valid implementations of view resolver in spring MV Care:
in spring mvc the front controller uses handler Mapping option 1
implementation to fgure out which controller class should process
request.
consider the below code:
<servlet>
<servlet-name>myadmin optionA:myadmin-servlet.xm
</servlet-name>
<servlet-
class>org.sprngframework.web.servlet.DispatcherServlet</servlet-
class> ViewResolver
. all of above
.
</servlet>
which spring mvc component maps logical view to actual view. TRUE
indentify component of spring mvc
A handler method annotated with
@RequestMapping supports String as its return type. State True or
False
TRUE
FALSE
Refer to the following statements :- Statement 1 is True and Sta
Statement 1 : A Command Class is called a FormBacking Bean.
Statement 2 : This class also returns a ModelAndView Object.
Choose the most appropriate option:-
1)Statement1isTrueandStatement2isFalse
2)Statement2isTrueandStatement1isFalse
3)Both the statements areTrue
4)Both the statements are False
Identify the right syntax to add datato
A ModelAndView object and send to the Controller. Choose two
most appropriate options.
ModelAndView mv = new ModelAndView(); option 1 and 2
mv.addObject("data",new SomeData());
new ModelAndView("data",new SomeData()); new
ModelAndView(new SomeData(),"data");
@ModelAttribute(countrylist") publiclist<string>populatecountry(){
List<String>myList=new ArrayList<String>(); myList.add("india");
myList.add("Us"); return myLst
} <form:radiobuttons path="co

You might also like