0% found this document useful (0 votes)
668 views40 pages

Spring MVC Controller Annotations Quiz

The document contains several code snippets with missing lines that need to be completed to make the code valid. The code snippets are for Spring Boot applications including setting up dependencies in pom.xml, configuring the main application class, implementing REST controllers, and configuring Spring Security. The questions provide options to choose from to fill in the missing lines of code to make the snippets compile.

Uploaded by

Abcd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
668 views40 pages

Spring MVC Controller Annotations Quiz

The document contains several code snippets with missing lines that need to be completed to make the code valid. The code snippets are for Spring Boot applications including setting up dependencies in pom.xml, configuring the main application class, implementing REST controllers, and configuring Spring Security. The questions provide options to choose from to fill in the missing lines of code to make the snippets compile.

Uploaded by

Abcd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Coding Task 1
  • Coding Task 2
  • Coding Task 3
  • Coding Task 4
  • Coding Task 5
  • Coding Task 6
  • Coding Task 7
  • Coding Task 8
  • Coding Task 9
  • Coding Task 10
  • Coding Task 11
  • Coding Task 12
  • Coding Task 13
  • Coding Task 14
  • Coding Task 15
  • Coding Task 16
  • Coding Task 17
  • Coding Task 18
  • Coding Task 19
  • Coding Task 20
  • Coding Task 21
  • Coding Task 22
  • Coding Task 23
  • Coding Task 24
  • Coding Task 26
  • Coding Task 25
  • Coding Task 27
  • Coding Task 28
  • Coding Task 29
  • Coding Task 30

Mcq4

Questions Answer

Refer the incomplete code given below: application propperties ===================


Assume other properties are configured
____Line1_____=8080
[Link] ====
<!--Assume other dependencies are configured-->
<dependency>
<groupId>[Link]</groupId>
<artifactId>___ Line2__</artifact><!--Dependency for web application-->
</dependency>
[Link],spring-boot-starter-web,@SpringBootApplication, SpringApplication
....Class =========
__Line3__
......class Application{
public static void main(String [] args){
__Line 4__.run([Link],args);

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


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

Refer the incomplete code given below:


application propperties
===================
Assume other properties are configured
____Line1_____=8080
[Link]
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>[Link]</groupId>
<artifactId>___ Line2__</artifact><!--Dependency for web application-->
[Link],spring-boot-starter-web,@SpringBootApplication, SpringApplication
</dependency>
....Class
=========
__Line3__
......class Application{
public static void main(String [] args){
__Line 4__.run([Link],args);
......Controller,Starter Class is coded appropriately.
... required to deploy the application on port 8080
choose valide option from below to complete the code

1
Mcq4

It is required by jack to fetch eemployee details by salary, such that salary


greater than equal to certain value, and result should be ordered in descending
order ofEmployeeId.
Refer the incomplete code and help jack to complete the requiremen:
[Link]
==============
#Assume other properties are configured properly
#DataBase url
____Line1____= jdbc:mysql://localhost:3306/springbootdb
[Link], spring-boot-starter-
[Link]
data-jpa,repositorydefination,findBySalaryGreater
======
ThanEqualByDescEmployeeId
<!--Assume other dependencies are configured-->
<dependency>
groupId>[Link]</groupId>
<artifactId>___Line2___</artifactid><!--Dependency for DB-->
</depenency>
___Line3___(domainClass=[Link],idClass=[Link])
@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" />
authentication-manager, authentication-provider,user-sevices
<........................................="ROLE_MSD_ADMIN" />
<............................................="ROLE_MSD_DBA" />
<__Line3__>
<__Line2__>
<__Line1__>
....................................................................above code

2
Mcq4

Refer the incomplete code given below:


[Link]
===================
#Assume other properties are configured
#Database url
____Line1_____=[Link]://localhost:3306/springbootdb
[Link]
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>[Link]</groupId>
<artifactId>___ Line2__</artifact><!--Dependency for web application-->
</dependency>
DAO [Link] [Link]-boot-starter
========= data-jpa,@RepositoryDefinition,@Query @pathVariable
__Line3__(domainClass = [Link]=[Link])
@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 4__.run([Link],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
[Link]
.....Application
... Application {
public static void main(String[] args){
[Link]([Link], args);

----------------------------------------------------------------
Error while deployment as primary........................
...[Link];
....
MessageController {
.. String(value = "/sayHi/{message}",
"application/json"},
[Link])
.....ENtity<String>
.....@PathVariable("message") String messageVar) {
responseEntity<String>("Message From
messageVar, [Link]);

3
Mcq4

___Line1____
public class Application {

public static void main(String[] args) {


@SpringBootApplication,[Link]([Link],args)
___Line2____
}

(!)A spring MVC application can have multiple child content


(!!) Child content belongs to DispatcherServlet Both are true
Which of the above statements are true?
Highly cohesive
identify the characteristics of Microservices [choose 2]
Independently deployable
Refer the below incomplete code for a Spring rEST based application
@RequestMapping(value = "/students/updateStudent",
method =___Line1__PUT,
consumes = _____Line2____.APPLICATION_JSON_VALUE)
public _____Line3____<StudentBean>updatedStudent(____Line4____StudentBean student) { RequestMethod,MediaType,ResponseEntity,@RequestBody
StudentBean updateStudent = null;
//code goes here
return new ___Line3____<studentBean>(updateStudent, [Link]);
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
@RequestMapping(value = "/cst/controller/createCst", method = [Link],
return new ResponseEntity<CstBean>(bean1,[Link]);
consumes = MediaType.APPLICATION_JSON_VALUE,
}
produces = MediaType.APPLICATION_JSON_VALUE)
}

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: [Link]
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 and...
@EnableAutoConfiguration
in Springboot

4
Mcq4

In the digital era there are key success factors addressed by mywizard Deveops.
All of the above
Pick the valid success factors.
Refer the code given below for the producer, coded using Spring-REST
@RestController
public class EmployeeController {
//Assume that EmployeeServiceImpl is injected appropriately

@RequestMapping(value=*/emp/controller/addEmp", method=[Link],
consumes=MediaType.APPLICATION_JSON_VALUE,
produces=MediaType.TEXT_HTML_VALUE)
public ResponseEntity<String> addEmployee(@RequestBody EmploBean employee)
{ [Link](REST_SERVICE_URL +
int count=[Link](employee); "addEmp" , employee, [Link]
return new ResponseEntity<String>("Employee added successfully with id:" +count, HttpStatus, CREATED);
}
}

Refer the incomplete code given below:


private static void createEmployee() {
RestTemplate restTemplate =new RestTemplate();
EmployeeBean employee =new EmployeeBean(0, "TestMSD", "Manager", new Date(), 1000.0);
String str=null;

What are the features are possible to be availed through the provisioning of Intelligent using
Highly Scalable, Manual Healing
myWizard DevOps?

package [Link];
@SpringBootApplication
public class Application {
public static void main(String [] args) {
[Link]([Link], args);
}
}

//--------------------------------------------------------------------------
Error while deployment as Primary configuration is not in
package [Link];
@RestController
public class MessageController {
@RequestMapping(value= "/sayHi / {message}",
producer={ "application/json"},
method= [Link])
public ResponseEntity<String>
getEmployeeById(@pathvariable("message") String messageVar) {
return new ResponseEntity<String>("Message From Controller": [Link]);

5
Mcq4

Refer the incomplete code given below


stater class
-----------------
----------------
------Line 1-------
public class Application {
@SpringBootApplication,SpringApplication, @RestController,
public static void main(String[] args) {
@RequestMapping, TEXT_HTML_VALUE
/* code goes here */
}
}
-----Line 2-----
public class EmployeeController {

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"> <intercept-url pattern=*/saveStudent*** access="ROLE_ADMIN"/>
------Line1------ <intercept-url pattern=*/getStudentDetails***
<!---- Other related configuration goes here----> access="ROLE_ADMIN, ROLE_DBA, ROLE_USER"/>
</http>

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


Refer the incomplete code given below
---------Line 1------------
public class EmployeeController {
@Autowired
private EmployeeServiceImpl employeeService:
---------Line 2--------- (value="emp/controller
/getDetails",.method=RequestMethod, GET, produces=MediaType,APPLICATION_JSON_VAL @RestController, @RequestMapping, ResponseEntity
public------------Line 3--------------<List<EmployeeBean>> getEmployeeDetails() {
return ---Line3---- [Link]();
}

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

<http auto-config="false">
Refer the below Requirement to be implented using Spring Security,
<intercept-url pattern="/LoadReport" access="Role_CST_ADMIN" />
1) LoadSave should be accessible to CST_ADMIN, CST_DBA
<intercept-url pattern="/LoadSave" access="Role_CST_ADMIN.Role_CST_DBA" />
2) LoadReport should be accessible to CST_ADMIN only
<! rest code goes here-->
Choose from below valid option to complete the above requirement
</http>

6
Mcq4

<http auto-config="false">
Refer the below requirement to be implemented using spring security. 1) LoadSave should be <intercept-url pattern="/LoadReport" access="hasRole('CST_ADMIN','ADMIN_DBA)" />
accessible by CST_ADMIN,CST_DBA. 2)LoadReport should be accessible to CST_ADMIN only. <intercept-url pattern="/LoadSave" access="hasRole('CST_ADMIN')" />
</http>

Which of the components are connected to myWizard DevOps. All of the above
<dependency>
<groupId>[Link]</groupId>
When maven dependecy is used to create a spring boot web application? <artifactId>spring-boot-starter-web</artifactId>
</dependency>

Refer the incomplete code given below:


@Controller public class EmployeeController{
Assume appropriate DAO injected by using appropriate annotation
__Line1__
public Map<Integer,String> getEmployeeDetails(){
Map<Integer,String> map= new HashLinkedMap<>();
return map;
}
DAO Layer
========= @ModelAttribute,@PersistenceContext,createQuery
@Repository
@Transactional
public class EmployeeDao{
__Line2__
private EntityManager entityManager;
List<EmployeeBean> getEmployeeDetails(){
Query query = entityManager("Select E from Employee E"),
List<EmployeeEntity> entities=[Link]();
return beans;

consider the code given below


@SpringBootApplication //line1
public class Application {
public static void main(String [] args) { @ComponentScan, @Configuration, @EnableAutoConfiguration
[Link]([Link], args);
}
}

choose from below a valid option representing the proper nme of the default properties files in only(1)
springboot (i)[Link] (ii)[Link] (iii)[Link]

7
Mcq4

refer the below incomplted code for a spring Rest based appliction RequestMethod,MediaType,ResponsesEntity,@RequestBody
@RequestMapping(value ="/students/updateStudent",
method=___line1____PUT,
consumes=___line2___APPLICTION_json_value
public____Line3____<StudentBean>updateStudent(_____Line4_____StudentBean student){

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

@Controller
public class CstController {
__________( value = "/registration", method
=_______________________)
public ModelAndView register(@ModelAttribute("empBean")
EmployeeBean employeeBean) {
ModelAndView modelAndView = new ModelAndView();
// 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: @RequestMapping , [Link]
Choose from below a valid option representing the proper name of the default properties i) only (i)
files in SpringBoot
i) [Link]
ii) [Link]
iii) [Link]

8
Mcq4

Refer the code given below [Link]("[Link]


cst/controller/deleteCstBean/1002");
@RestController public class CstController {
@RequestMapping(value = "/rest/controller/deleteCstBean/{id}",
method = [Link] ,
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.
[Link]);
}
}

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
[Link]
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

9
Mcq4

Refer the incomplete code below: @ExceptionHandler(value=[Link]),


@Controller $(ErrorMessage}
public class CstController {
//Assume Request mapping code is written here
public ModelAndView register(@ModelAttribute("custBean")
CustomerBean bean) throws InvalidNameException {
//code goes here...
throw new InvalidNameException();
return modelAndView;
}
____________// LineX
public ModelAndView handleException(InvalidNameException
exception) {
ModelAndView modelAndView = new ModelAndView();
[Link]("DisplayMessage"): //Logical
Name of the view to Navigate in case of error
[Link]("ErrorMessage",exception);
return modelAndView;
}
}

[Link]
========================
<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 [Link] displays the error message when
InvalidNameException is thrown
Refer the incomplete configuration for Spring Security given below: <user-name="cst_dba" password="cst_dba"
<authentication-manager> authorities="ROLE_CST_DBA"/>
<authentication-provider> <user-name="cst_admin" password="cst_admin"
<user-service> authorities="ROLE_CST_ADMIN"/>
<!-- Line1 -->
</user-service>
</authentication-provider>
</authentication-manager>

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

10
Mcq4

Refer the incomplete spring boot code given below: @SpringBootApplication, @RestController , @PathVariable
package [Link];
________________________
public class Application{
public static void main (String args[]){
[Link]([Link],args);
}
}
//---------------------------------------------------------------------------------------------------
package [Link];
___________________________
public class MessageController{
@Requestmapping(value="/sayHi/{message}",
produces={"application/json"},
method=[Link])
public ResponseEntity<String>
getemployeeById(________________("message")string messagevar) {
return new ResponseEntity<String>("Message From
Controller:"+messagevar,[Link]);
}
Choose from below a valid combination of annotations which is equivalent to All 1,2 and 3
@SpringBootApplication

1)@Configuration
2)@EnableAutoConfiguration
3)@ComponentScan

package [Link]; Move the Primary configuration to the root


@SpringBootApplication package "[Link]"
public class Application{
public static void main (String args[]){
[Link]([Link],args);}}
//---------------------------------------------------------------------------------------------------
package [Link];
@RestController
public class MessageController{@Requestmapping(value="/sayHi/{messege}",
produces={"application/json"},
method=[Link])
public ResponseEntity<string>
getemployeebyid(@pathvariable("message")string messagevar){return new
responseEntity<string>("message from controller:"+messagevar,httpstatus,OK);
}

11
Mcq4

Refer the incomplete code given below for a Spring REST based application: @ResponseBody , @RequestBody
@Controller
Public Class CstController{
@RequestMapping(value="/cst/controller/createCst",
method=[Link],
consumes=MediaType.APPLICATION_JSON_VALUE,
produces=MediaType.APPLICATION_JSON_VALUE)
_________________________
public CstBean updateCstMember(_________________ CstBean cstBean)
{
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)

i) URL Extension Based


ii) URL Parameter Based

Choose the most appropiate option


The annotation @RestController is equivalent to _______________ Both 1 & 2
a) annotation @Controller
b) annotation @ResponseBody
c) annotaion @RequestMapping
d) Both 1 & 2
refer the incomplete code given below for spring Security post,[Link],cstSecureLogin,
[Link]
<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>

Configure in Sprig Security <http> element

<.form-login
login page="/___line3______"
username -parameter='uname123'
password-parameter="pwd123"
authentication -failure-

12
Mcq4

//Code to invoke the DAO addEmployee(employeeBean) @controller@Repository@Transectional


}
}
DAO Layer
=======
@Repository
______line3____
pulic class EmployeeDAO{
_____Line4_____
private EntityManager entity manager;

//Assume addEmployee(EmployeeBean employeeBean) is already coded


}
view
=====
<form:form___Line5___="empobj"method="GET"action =""[Link]">
<!--Code goes here to enter the employee details--->
<input type = "submit"value="Register"/>
</[Link]>

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

13
Mcq4

refer the incomplete code given below: @springbootapplication,


.......class @import,contentNegotiationManagerFactoryBean,
------------------ content-negotiation-manager
----line1-----
-------line2-----(locations="classpath;com/accenture/lkm/resources/springservlet-xml')
public class Application{public static void main(String args[]){/*code goes here*/}}
XML configuration file to overrides the ContentNegotiation
=========================================================
<bean id="contentNegotiationManager" class="[Link]-------line3-------"
primary="true">
<!-codegoes here...></bean><[Link]-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

which maven dependency is used to create a spring boot web application <dependency>
<groupid>[Link]</groupid>
<artifactid>spring-boot-starter-web</artifactid>
</dependency>

package [Link]; error while deployment as primary configuration is not in


@SpringBootApplication root packages
public class application{
public ctatic void main (String args[]){
[Link]([Link],args);}}
//---------------------------------------------------------------------------------------------------
package [Link];
@restController
public class messagecontroller{@requestmapping(value="/sayHi/{messege}",
produces={"application/json"},
method=[Link])
public responseEntity<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, @responsebody
other MME type based on configuration?
choose most appropritae options

14
Mcq4

refer thr incomplete spring security configuration given below @use-expressions="false",intercept-url,<form-login/>


<http----level1------>
<----line2-----pattern='/getdetails
process= ROLE_MSD_ADMIN,ROLE_MSD_DBA,ROLE_MSD_USER"/>
----LINE3-----------
http>
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 beanfactorypostprocessors
refer the incomplete code given below @ModelAttribute,@Valid,BindingResult,hasBindErrors,
Controller ReloadableResourceBundleMessage
============
@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--------
EmployeeBean employeebean----------line3-------result){
ModelAndView modelAndView = new ModelAndView();
//your code goes here
return modelAndView;}}
View
=========================
<form form method ="post" modelAttribute+"employeeBean" action ="[Link]">
employee name<[Link] path="name"/><br/> password <form password path="password"/>>br/>
<input type="submt"value="register"> <spring----------line4--------name="employeebeans">
<h3>ALL errors</h3>
<[Link] path=" " cssclass="error"/></spring------------line4--------></[Link]>
configuration file
==============================
<bean><!---assume rest of the configuration is written ---->
<bean id ='messagesource"
class= "[Link]----------line5----------">
<property name ="basename" value="[Link]/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: restTemplate,setErrorHandler, public boolean hasError,
private static void deleteMovie(){ public void handle error
restTemplate resttemplate = new RestTemple();
__Line1__(new ResponceErrorHandler(){
............
...
}

15
Mcq4

starter class @SpringBootApplication,@RestController,


============ @RequestMapping,TEXT_HTML_Value
__line1__
pulic class Application{
public static void main(string[] args)
/*code given here*/
}
controller
=========
__line2__
public class employeeController
{
.....
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 [Link](data);
//Logic goes here....
return new ResponseEntity<List<CstBean>>(list, [Link]);
}
}

Assume application is deployed on port 8090 and following URL is hit to access the application
using a web BROWSER".
URL: [Link]
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:
What are the features to be possible that can be availed through the provisioning of Intellegent 1- Easy to adapt
Automation using MyWizard DevOps 2- Highly Scalable
3- Looks Tremendous Buiness Value
4- Manual Healing

16
Mcq4

Refer the incomplete code given below for Spring Security [Link], cstSecureLogin,uname,pwd

[Link]
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>

Configuration in Spring security's <http> element


1 <form-login
2 login-page="/____Line1_____"
3 login-processing-url="/____Line2______"
4 username-parameter="___Line3_____"
5 password-parameter="___Line4_____"
6 authentication-failure-url="/dispС[Link]?cst_Error=try

Assume dispС[Link] 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

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 = [Link])
public ModelAndView confirmStudentDetails(__Line2___StudentBean studentBean)
//Code to get the studentBean object is written here
ModelAndView modelAndView = new ModelAndView();
modelAndView setViewName("ConfirmStudentDetails");
[Link]("message", "Hi, Welcome" +
[Link]())
retum modelAndView
}
}
Choose from below a valid option, in the order as it appears to complete the above code"

Spring does not store the data in ____ instead stores in ____. requestScope,SpringModel

Choose from below valid option.

17
Mcq4

Code not visible clearly: Choose the best option


1- [Link], @RequesParam("uName") ,
Assume that HTML code exists which submits a POST request [Link] with parameter @RequestParam("pwd")
name: uName and pwd 2- [Link], @Param("uName"),
@Param("pwd")
Choose from below valid option in the order as it appears to complete above code 3- [Link], @RequestMapping("userName"),
@RequestMapping("password")
4- Request [Link], @RequestParam("userName"),
@RequestParam("password")

In Spring Rest, which of the following triggers HttpMessageConverter to convert the Java to JSON, XML, @RequestBody
other MIME type based on configuration?

Choose most appropriate option.


Which of the following statements is/are correct with respect to Spring MVC. Both (1) and (2)
1. A Spring MVC application can have multiple child context.
2. Child context belongs to DispatcherServlet.

Choose the most appropriate option.

18
Mcq4

Jack is new to Spring MVC and wants to display [Link], when ever request for the [Link] is placed. prefix, suffix, setViewName("home"), addObject
Help jack to complete code given below.

Configuration file:
----------------
<!_ Assume other configuration is done properly_>
<bean class="[Link]">
<property name="__Line1__">
<value>/WEB-INF/jspViews/</value>
<property name="__Line2__">
<value>.jsp</value>
</property>
</bean>

Controller
-----------
@Controller
public class LoginController {
@RequestMapping(value="/[Link]", method = [Link])
public ModelAndView getWelcomeMessage() {
ModelAndView mv = new ModelAndView();
mv.__Line3__;
mv.__Line4__("obj","Welcome!! "):
return mv;
}
}

[Link]
----------
<html>
<h2>${obj}</h2>

Continuation...........
Which of the following is used to translate the logical view name to physical view name. ViewResolver
In Spring Rest, which of the following triggers HttpMessageConverter to convert the request data in @RequestBody
JSON to Java Object type?

Choose most appropriate option.

19
Mcq4

Refer the incomplete code given below @Autowired,@ModelAttribute,


Controller @PersistanceContext,Items,$(designations)
============
@Controller
public class EmployeeController {

_______Line1____
private EmployeeDAO employeeDao;
}
DAO Layer
=============
@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.

20
Mcq4

Refer the incomplete code given below: @ModelAttribute, @Valid, BindingResult, hasBindErrors,
Controller ReloadableResourceBundleMessageSource
==========
@Controller
public class EmployeeController {
//Assume method to display the view and do model binding already exists

@RequestMapping(value = "registration", method = [Link])


public ModelAndView register(__Line1_("employeeBean")_Line2_EmployeeBean
employeeBean, _Line3__result) {
ModelAndView modelAndView = new ModelAndView();
//Your code goes here
return modelAndView;
}
}

View
======
<form:form method = "POST" modelAttribute = "employeeBean" action = "[Link]">
Employee Name : <form:input path = "name" /></br>
Password : <form:password path = "password" /></br>
<input type ="submit" value ="Register">
<spring: __Line4__name="employeeBean">
<h3>All Errors</h3>
<form:errors path="*"css Class="error"/>
</spring:__Line4__>
</form:form>

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

Continued..........
Choose from below the beans that are not ingerited from the spring mvc's parent context. All bean are not inherited

21
Mcq4

Refer the incomplete code given below for a Spring REST based Application: @RequestMapping(value="cst/controller/getDetailsin Range/{p1}
method=[Link],
@RestController produces=MediaType.APPLICATION_JSON_VALUE)
public class CstController {

//Line-1
public ResponseEntity<List<CstBean>>
getDetails(@PathVariable("p1")double data)
{
List<CstBean> list = [Link](data);
//Logic goes here....
.
.
.
Assume application is deployed on port 8090 and following URL is hit to access the application
"using a web BROWSER"
URL [Link]
Choose from below a valid option to be placed at "Line-1" to complete the above code so that Json
response is returned in response to the request.
It is required tp secure the Spring MVC based application using the following matrix by using <intercept-url pattern="/saveStudent**" access=ROLE_ADMIN
Spring Security 4.x <intercept-url pattern="/getStudentDetails**" access="ROLE_ADMIN
"/saveStudent**" - should be accessible to ADMIN ROLE_USER" />
.
.
Choose from below a valid option to complete the above code
Refer the below incomplete code for a Spring REST based application RequestMethod, MediaType, ResponseEntity, @RequestBody
@RequestMapping(value="/students/updateStudent",
method=_Line1_.PUT,
consumes=_Line2_.APPLICATION_JSON_VALUE)
.
.
}
Choose from below a valid option, inthe order as it appears, to complete the above code
Refer the incomplete code given below: @RequestMapping, [Link]
@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? both(i)and(ii)

(i) In an application there can be more than one web context


(ii) Web context belongs to whole application

Choose the most appropriate option.


Spring does not store the data in______instead stores in ______ request scope, SpringModel
Choose from below a valid option

22
Mcq4

Which of the following statement(s) is/are CORRECT with respect to Spring MVC? both(i)and(ii)
(i) A Spring MVC application can have multiple child context
(ii) Child context belongs to DispatcherServlet
Choose the most appropriate option.
Which maven dependency is used to create a spring boot web application? <dependency>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
myWizard DevOps is build on which tool? Kubernetes
<--Assume other dependencies are configured--> A)server port,spring-boot-starter-web,@SpringBootApplication
<dependency> C)server port,spring-boot-starter-web,@springbootapp
<groupid>__Line2__</artifactid><!--Dependency for web application-->
</dependency>
starter Class
=======
____Line3____
public class application{
public static void main(string[] args){
/*code goes here*/
}
}
controller
============
____Line4______
public class Eemployeecontroller{
//code goes here
}
The Http verb which is Idempotent ans safe is __________________ Get
What is the correct syntax to generate a drop down box All the above
A valid option representing the proper name of the default properties files in springboot only(i)
(1) application properties (2) [Link] (3)[Link]

Refer the below incompleted code for a spring rest based application RequuestMethod, MediaType, ResponsesEntity,
@RequestMapping(value=”/students/updatestudent” @RequestBody
,method=Line1____put,
consumes=___line2___.APPLICATION_json_value)
Which of the Following statement is/are CORRECT with respect to Spring MVC? only(i)
(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

23
Mcq4

Refer the incomplete code given below for the “spring Form”___<form.form__line1__”[Link]”__
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 BeanPostProcessors and BeanFactoryPostProcessors
Spring does not store the data in____ instead stores in___ choose from below a valid option Request scope, SpringModel
Assumingly we are using Spring's Validation framework. <form:input path="firstName" size="30"/>
In order to display a text field along with its error message(s), <font color="red"><form:errors path="firstName" /\></font>
which of the following options will you use to accomplish this?

A handler method annotated with TRUE


@RequestMapping supports String as its return type.
State True or False
1. TRUE
2. FALSE
Refer to the following statements :- Statement 1 is True and Statement 2 is False
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)Statement 1 is True and Statement 2 is False
2)Statement 2 is True and Statement 1 is False
3)Both the statements are True
4)Both the statements are False
Identify the right syntax to add data to ModelAndView mv = new ModelAndView();
a ModelAndView object and send to the Controller. [Link]("data",new SomeData());
Choose two most appropriate options.
ModelAndView mv = new ModelAndView();
[Link]("data",new SomeData());
new ModelAndView("data",new SomeData());
new ModelAndView(new SomeData(),"data");
The ___________ annotation is used to @ModelAttribute
inject dataobjects before a jsp page loads in order to
ensure that the jsppage has all the data required to
display itself.
Choose the most appropriate option:
@ModelAttribute
@Model
@ModelMap
@ModelData
Assume the below code is written in a Controller class <form:radiobuttons path="country" items="${countryList}" />
1@modelAttribute("countryList");
2public List<string> populateCountry(){
List<string> myList=new ArrayList<string>();
[Link]("India");
[Link]("US");
return myList;
}

24
Mcq4

the _____annotation is used to inject data objects before a jsp page loads in @ModelAttribute
oder to ensure that jsp page has all data required to display itself
the ____ tag in sprng view page will help users view validation related errors <form:errors>
Assumingly we are using Spring's Validation framework. <form:input path="firstName" size="30"/>
In order to display a text field along with its error message(s), <font color="red"><form:errors path="firstName" /\></font>
which of the following options will you use to accomplish this?
the valid implementations of view resolver in spring MVC are: option 1 and 2
in spring mvc the front controller uses handlerMapping implementaton to fgure out which option 1
controller class should process request.
consider the below code: optionA:[Link]
<servlet>
<servlet-name>myadmin
</servlet-name>
<servlet-class>[Link]</servlet-class>
.
.
</servlet>
which spring mvc component maps logical view to actual view. ViewResolver
indentify component of spring mvc all of above
A handler method annotated with TRUE
@RequestMapping supports String as its return type.
State True or False
1. TRUE
2. FALSE
Refer to the following statements :- Statement 1 is True and Statement 2 is False
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)Statement 1 is True and Statement 2 is False
2)Statement 2 is True and Statement 1 is False
3)Both the statements are True
4)Both the statements are False
Identify the right syntax to add data to option 1 and 2
a ModelAndView object and send to the Controller.
Choose two most appropriate options.
ModelAndView mv = new ModelAndView();
[Link]("data",new SomeData());
new ModelAndView("data",new SomeData());
new ModelAndView(new SomeData(),"data");
@ModelAttribute(countrylist") <form:radiobuttons path="country" items="${countryList}" />
public list<string>populatecountry(){
List<String>myList=new ArrayList<String>();
[Link]("india");
[Link]("Us");
return myLst
}

25
Mcq4

Refer the below incomplete code: ResponseEntity,HttpStatus.INTERNAL_SERVER_ERROR,


@RestController [Link]
public class StudentController {
@RequestMapping(value = "/deleteStudentById/{id}", method = [Link],
produces = MediaType.APPLICATION_JSON_VALUE)
public ___Line1___<StudentBean> deleteStudent(@PathVariable("id") int myId) {
if ([Link](myId) == null) {
StudentBean studentBean1= null;
return new ResponseEntity<StudentBean>(studentBean1,___Line2___);
}
StudentBean studentBean2= [Link](myId);
return new ResponseEntity<StudentBean>(studentBean2, ___Line3___);
}
}
Choose from below a valid option, in the order as it appears, so that
it returns the status 200 when employee is deleted successfully
else it return 500, Assume service and DAO alreday implemented
Refer the incomplete code given below to exclude the tomcat embedded container and include jetty exclusions,exclusion,spring-boot-starter-jetty
[Link]
-------
<dependency>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- Excluding Tomcat -->
<___Line1___>
<___Line2___>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</___Line2___>
</___Line1___>
</dependency>
<!-- Including Jetty -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>___Line3___</artifactId>
</dependency>
Choose from below a valid option to complete the above code, in the order as it appears.
Refer the incomplete code given below for Spring MVC controller @Controller, @RequestMapping,value
___Line1___
public class GreetController {
___Line2___( ___Line3___="/home")
public ModelAndView homePage(){
}
}
Choose from below a valid option, in the order as it appears, to complete the above code

26
Mcq4

Refer the below incomplete code of Spring MVC application: @Controller,setViewName,[Link], addObject, ${modelObj}
BackEndController
------------------
___Line1___
public class LoginController {
@RequestMapping(value= "/[Link]", method = [Link])
public ModelAndView getWelcomeMessage() {
ModelAndView mv = new ModelAndView();
mv.___Line2___("___Line3___");
mv.___Line4___("modelObj","Hi, Welcome!!")
return mv;
}
}
[Link]:
----------
<html>
<h2>___Line5___</h2>
</html>
Note: All the jsp pages are present under the web content and no view resolver is configured
to render the jsp's.
Choose from below a valid option, in the order as it appears, so that [Link] is renders
and displays Hi, Welcome!!.
Refer the below security data base schema: securityDataSource,
msd_users ( username (P.K.),password ,enabled); select username,password, enabled
msd_user_roles (user_role_id (P.K.), username (F.K. REFERENCES msd_users (username)),role);
Refer the below incomplete security configuration from msd_users where username=?,
<authentication-manager> select username, role from
<authentication-provider> msd_user_roles where username =?
<jdbc-user-service data-source-ref="___Line1___"
users-by-username-query="___Line2___"
authorities-by-username-query="___Line3___" />
</authentication-provider>
</authentication-manager>
Choose from below a valid option, in the order as it appears
where the queries will retrieve the security credentails from the database schema.
Assume security data source is already made available and resolved in the configuration file
with name "securityDataSource".
Refer below the incomplete spring security configuration use-expressions="false", intercept-url, <formlogin/>
<http ___Line1___>
<___Line2___ pattern="/GetDetails**" access="ROLE_MSD_ADMIN,ROLE_MSD_DBA,ROLE_MSD_USER" />
___Line3____
</http>
Choose from below a valid option, in the order as it appears, to complete the above code

27
Mcq4

Refer the incomplete code given below: @Autowired,@ModelAttribute,


Controller @Valid,BindingResult,
========== @PersistenceContext,hasBindErrors
@Controller
public class EmployeeController {
___Line1___
private EmployeeDAO employeeDAO;
//Assume required annotation already exists
public ModelAndView saveEmployee(___Line2___("employeeBean")___Line3___ EmployeeBean
employeeBean,___Line4___ result) {
//Code to invoke the DAO addEmployee(employeeBean)
}
}
DAO Layer
=========
@Repository
//Assume required annotation already exists
public class EmployeeDAO{
___Line5___
private EntityManager entityManager;
//Assume addEmployee(EmployeeBean employeeBean) is already coded
}
View
====
<form:form modelAttribute="employeeBean" action="[Link]">
<!--Code goes here to enter the employee details-->
<input type="submit" value="Register"/>
<spring:___Line6___ name="employeeBean">
<h3>All Errors</h3>
<form:errors path="*" cssClass="error" />
</spring:___Line6___>
</form:form>
Note : Assume EmployeeBean,EmployeeEntity are coded, and [Link],configuration are configured properly.
Choose from below a valid option to complete the above code, in the order as it appears.

28
Mcq4

Refer the incomplete code given below: [Link],spring-boot-starter-datajpa,


[Link] @RepositoryDefinition,@Param,
================ @PathVariable
#Assume other properties are configured
#Database url
_____Line1____= jdbc:mysql://localhost:3306/springbootdb
[Link]
=======
<!--Assume other dependencies are configured-->
<dependency>
<groupId>[Link]</groupId>
<artifactId>___Line2___</artifactId><!-- Dependency for DB -->
</dependency>
DAO
===
___Line3___(domainClass=[Link],idClass=[Link])
public interface EmployeeDAO{
@Query("select k from EmployeeEntity k where [Link]>=:salary")
List<EmployeeEntity> getAllEmployeesBySalary(___Line4___Double salary);
}
Controller
=======
@RestController
public class EmployeeController {
//Assume required DAO is injected by using appropriate annotation
@RequestMapping(value="getDetailsBySalary/{salary}",method=[Link],
produces=MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeBean>> getEmployeeDetailsBySalary(___Line5_
__("salary")Double salary){
//Code to call [Link](salary) goes here
}
}
Assume the Starter Class is coded appropriately.
Choose from below a valid option to complete the above code, in the order as it appears.
In myWizard DevOps, the following practices are used such as Operational Improvements
1. Continuous Integration
2. Continuous Delivery
3. Process Automation
4. Cloud
These process usage leads with a focus on which of the following improvements?

29
Mcq4

It is required by Jack to fetch employee details, such that salary is greater than [Link],spring-boot-starter-datajpa,
and equal to certain value, and role of employee should be equal to certian value. @RepositoryDefinition,findBySalaryGreaterThanEqualAndRole,
Refer the incomplete code given below and help Jack to complete the requirment: @PathVariable
[Link]
=======================
#Assume other properties are configured properly
#Database url
_____Line1____= jdbc:mysql://localhost:3306/springbootdb
[Link]
=======
<!--Assume other dependencies are configured-->
<dependency>
<groupId>[Link]</groupId>
<artifactId>___Line2___</artifactId><!-- Dependency for DB -->
</dependency>
DAO
===
___Line3___(domainClass=[Link],idClass=[Link])
public interface EmployeeDAO{
List<EmployeeEntity> ___Line4___(Double salary,String role);
}
Controller
==========
@RestController
public class EmployeeController {
//Assume required DAO is injected by using appropriate annotation
@RequestMapping(value="emp/controller/getEmployeeDetailsBySalaryAndRole/{salary}--
{role}",method=[Link],produces=MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeBean>> getEmployeeDetailsBySalaryAndRole(___Line5_
__("salary")Double
salary,___Line4___String role){
//Code to call dao method goes here
}
}
Assume the Starter Class is coded appropriately.
Choose from below a valid option to complete the above code, in the order as it appears.

30
Answer

Refer the incomplete code given below:


application propperties
===================
Assume other properties are configured
____Line1_____=8080
[Link]
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>[Link]</groupId>
<artifactId>___ Line2__</artifact><!--Dependency for web application-->
</dependency> [Link],sprint-boot-starter-web,@Spring........
....Class
=========
__Line3__
......class Application{
public static void main(String [] args){
__Line 4__.run([Link],args);

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


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

Refer the incomplete code given below:


application propperties
===================
Assume other properties are configured
____Line1_____=8080
[Link]
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>[Link]</groupId>
<artifactId>___ Line2__</artifact><!--Dependency for web application-->
</dependency> Need to configure the int param ........
....Class
=========
__Line3__
......class Application{
public static void main(String [] args){
__Line 4__.run([Link],args);

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


... required to deploy the application on port 8080
choose valide option from below to complete the code
It is required by jack to fetch eemployee details by salary, such that salary greater than equal
to certain value, and result should be ordered in descending order ofEmployeeId.
Refer the incomplete code and help jack to complete the requiremen:

[Link]
==============
#Assume other properties are configured properly
#DataBase url
____Line1____= jdbc:mysql://localhost:3306/springbootdb
[Link]
[Link] [Link]-boot-starter-
======
data-jpa,@Repositorydefinition,findBySalary
<!--Assume other dependencies are configured-->
<dependency>
groupId>[Link]</groupId>
<artifactId>___Line2___</artifactid><!--Dependency for DB-->
</depenency>

___Line3___(domainClass=[Link],idClass=[Link])
@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, authentication-provider,user-sevices
<........................................="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_____=[Link]://localhost:3306/springbootdb
[Link]
====
<!--Assume other dependencies are configured-->
<dependenc>
<groupId>[Link]</groupId>
<artifactId>___ Line2__</artifact><!--Dependency for web application-->
</dependency>
DAO [Link] [Link]-boot-starter
========= data-jpa,@RepositoryDefinition,@Query @pathVariable
__Line3__(domainClass = [Link]=[Link])
@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 4__.run([Link],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
[Link]
.....Application
... Application {
public static void main(String[] args){
[Link]([Link], args);

----------------------------------------------------------------
Error while deployment as primary........................
...[Link];
....
MessageController {
.. String(value = "/sayHi/{message}",
"application/json"},
[Link])
.....ENtity<String>
.....@PathVariable("message") String messageVar) {
responseEntity<String>("Message From
messageVar, [Link]);
@SpringBootApplication,SpringApplication.......
(!)A spring MVC application can have multiple child content
(!!) Child content belongs to DispatcherServelet
only(!)
Choose the appropriate option from below

Highly cohesive
identify the characteristics of Microservices [choose 2]
Independently deployable
Refer the below incomplete code for a Spring rEST based application
@RequestMapping(value = "/students/updateStudent",
method =___Line1__PUT,
consumes = _____Line2____.APPLICATION_JSON_VALUE)
public _____Line3____<StudentBean>updatedStudent(____Line4____StudentBean student) { RequestMethod,MediaType,ResponseEntity,@RequestBody
StudentBean updateStudent = null;
//code goes here
return new ___Line3____<studentBean>(updateStudent, [Link]);
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,[Link]);
}
}

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: [Link]
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 and... in Springboot @EnableAutoConfiguration

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

What are the features are possible to be availed through the provisioning of Intelligent using myWizard DevOps? Highly Scalable, Manual Healing
package [Link];
@SpringBootApplication
public class Application {
public static void main(String [] args) {
[Link]([Link], args);
}
}

//--------------------------------------------------------------------------
Error while deployment as Primary configuration is not in
package [Link];
@RestController
public class MessageController {
@RequestMapping(value= "/sayHi / {message}",
producer={ "application/json"},
method= [Link])
public ResponseEntity<String>
getEmployeeById(@pathvariable("message") String messageVar) {
return new ResponseEntity<String>("Message From Controller": [Link]);
Question is blur @SpringBootApplication, @RestController, @RequestMapping, TEXT_HTML_VALUE
Question is repeated
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=*/saveStudent*** access="ROLE_ADMIN"/>
<!---- Other related configuration goes here----> <intercept-url pattern=*/getStudentDetails*** access="ROLE_ADMIN, ROLE_DBA, ROLE_USER"/>
</http>

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:
---------Line 2--------- (value="emp/controller
/getDetails",.method=RequestMethod, GET, produces=MediaType,APPLICATION_JSON_VAL @RestController, @RequestMapping, ResponseEntity
public------------Line 3--------------<List<EmployeeBean>> getEmployeeDetails() {
return [Link]();
}

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">
1) LoadSave should be accessible to CST_ADMIN, CST_DBA <intercept-url pattern="/LoadReport" access="hasRole('CST_ADMIN','ADMIN_DBA)" /> <intercept-
2) LoadReport should be accessible to CST_ADMIN only url pattern="/LoadSave" access="hasRole('CST_ADMIN')" />
Choose from below valid option to complete the above requirement </http>
<http auto-config="false">
Refer the below requirement to be implemented using spring security. 1) LoadSave should be accessible by CST_ADMIN,CST_DBA. 2) <intercept-url pattern="/LoadReport" access="hasRole('CST_ADMIN','ADMIN_DBA)" /> <intercept-
LoadReport should be accessible to CST_ADMIN only. url pattern="/LoadSave" access="hasRole('CST_ADMIN')" />
</http>
Which of the components are connected to myWizard DevOps. All of the above
<dependency>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

@SpringBootApplication,@RestController,@RequestMapping,TEXT_HTML

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 Layer @Repository @Transactional public class EmployeeDao{ private EntityManager entityManager; List<EmployeeBean> @ModelAttribute,@PersistenceContext,createQuery
getEmployeeDetails(){ Query query = entityManager("Select E from Employee E"),List<EmployeeEntity> entities=[Link]();
return beans;

choose from below a valid option representing the proper nme of the default properties files in springboot (i)[Link]
only(1)
(ii)[Link] (iii)[Link]

refer the below incomplted code for a spring Rest based appliction @RequestMapping(value ="/students/updateStudent",
method=___line1____put,
consumes=___line2___APPLICTION_json_value
public____Line3____<StudentBean>updateStudent(_____Line4_____StudentBean student){

} RequestMethod,MediaType,ResponsesEntity,@RequestBody

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

@Controller
public class CstController {
__________( value = "/registration", method
=_______________________)
public ModelAndView register(@ModelAttribute("empBean")
EmployeeBean employeeBean) {
ModelAndView modelAndView = new ModelAndView();
@RequestMapping , [Link]
// 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) [Link]
i) only (i)
ii) [Link]
iii) [Link]
Refer the code given below

@RestController public class CstController {


@RequestMapping(value = "/rest/controller/deleteCstBean/{id}",
method = [Link] ,
produces = MediaTyper.APPLICATION_JSON_VALUE)
public ResponseEntity<CstBean>
deleteCstBean(@PathVariable("id") int myId) {
CstBean cstBean=null'
// Code goes here to initialize the CST bean
[Link]("[Link]
return new ResponseEntity<CstBean>(cstBean.
[Link]);
}
}

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
[Link]
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 {
//Assume Request mapping code is written here
public ModelAndView register(@ModelAttribute("custBean")
CustomerBean bean) throws InvalidNameException {
//code goes here...
throw new InvalidNameException();
return modelAndView;
}
____________// LineX
public ModelAndView handleException(InvalidNameException
exception) {
ModelAndView modelAndView = new ModelAndView();
[Link]("DisplayMessage"): //Logical
Name of the view to Navigate in case of error
[Link]("ErrorMessage",exception);
@ExceptionHandler(value=[Link]),$(ErrorMessage}
return modelAndView;
}
}

[Link]
========================
<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 [Link] 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>
</authentication-provider> <user-name="cst_dba" password="cst_dba" authorities="ROLE_CST_DBA"/>
</authentication-manager> <user-name="cst_admin" password="cst_admin" authorities="ROLE_CST_ADMIN"/>

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 [Link];
________________________
public class Application{
public static void main (String args[]){
[Link]([Link],args);
}
}
//---------------------------------------------------------------------------------------------------
package [Link];
@SpringBootApplication, @RestController , @PathVariable
___________________________
public class MessageController{
@Requestmapping(value="/sayHi/{message}",
produces={"application/json"},
method=[Link])
public ResponseEntity<String>
getemployeeById(________________("message")string messagevar) {
return new ResponseEntity<String>("Message From
Controller:"+messagevar,[Link]);
}
Choose from below a valid combination of annotations which is equivalent to
@SpringBootApplication

1)@Configuration All 1,2 and 3


2)@EnableAutoConfiguration
3)@ComponentScan
package [Link];
@SpringBootApplication
public class Application{
public static void main (String args[]){
[Link]([Link],args);}}
//---------------------------------------------------------------------------------------------------
package [Link];
Move the Primary configuration to the root package "[Link]"
@RestController
public class MessageController{@Requestmapping(value="/sayHi/{messege}",
produces={"application/json"},
method=[Link])
public ResponseEntity<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=[Link],
consumes=MediaType.APPLICATION_JSON_VALUE,
produces=MediaType.APPLICATION_JSON_VALUE)
_________________________
public CstBean updateCstMember(_________________ CstBean cstBean)
@ResponseBody , @RequestBody
{
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 ?

i) URL Extension Based


both (i) and (ii)
ii) URL Parameter Based

Choose the most appropiate option


The annotation @RestController is equivalent to _______________
a) annotation @Controller
b) annotation @ResponseBody Both 1 & 2
c) annotaion @RequestMapping
d) Both 1 & 2
refer the incomplete code given below for spring Security
[Link]
<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,[Link],cstSecureLogin
Configure in Sprig Security <http> element

<.form-login
login page="/___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;

//Assume addEmployee(EmployeeBean employeeBean) is already coded @controller@Repository@Transectional


}
view
=====
<form:form___Line5___="empobj"method="GET"action =""[Link]">
<!--Code goes here to enter the employee details--->
<input type = "submit"value="Register"/>
</[Link]>

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="cst/controller/getdetailsInRange/{p1}",
list<cstBean>list=[Link](data);//logic goes here ..... method = [Link],
return new ResponseEntity<list<csrBean>>(list,[Link]);}} produces = media Type.APPLICATION_JSON_VALUE)
Assume application is deployed on port 8080 and following URL is hit to access the application using a web BROWSER
URL: [Link]
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')
public class Application{public static void main(String args[]){/*code goes here*/}}
@springbootapplication,@importresources,contentNegotiationManagerFactoryBean,content-negotiation-
XML configuration file to overrides the ContentNegotiation
manager
=========================================================
<bean id="contentNegotiationManager" class="[Link]-------line3-------"
primary="true">
<!-codegoes here...></bean><[Link]-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>[Link]</groupid>
which maven dependency is used to create a spring boot web application
<artifactid>spring-boot-starter-web</artifactid>
</dependency>
package [Link];
@SpringBootApplication
public class application{
public ctatic void main (String args[]){
[Link]([Link],args);}}
//---------------------------------------------------------------------------------------------------
package [Link];
error while deployment as primary configuration is not in root packages
@restController
public class messagecontroller{@requestmapping(value="/sayHi/{messege}",
produces={"application/json"},
method=[Link])
public responseEntity<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? @requestbody
choose most appropritae options

refer thr incomplete spring security configuration given below


<http----level1------>
<----line2-----pattern='/getdetails
process= ROLE_MSD_ADMIN,ROLE_MSD_DBA,ROLE_MSD_USER"/> @use-expressions="false",intercept-url,<form-login/>
----LINE3-----------
http>
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 beanfactorypostprocessors
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--------
EmployeeBean employeebean----------line3-------result){
ModelAndView modelAndView = new ModelAndView();
//your code goes here
return modelAndView;}}
View
========================= @ModelAttribute,@Valid,BindingResult,hasBindErrors,ReloadableResourceBundleMessage
<form form method ="post" modelAttribute+"employeeBean" action ="[Link]">
employee name<[Link] path="name"/><br/> password <form password path="password"/>>br/>
<input type="submt"value="register"> <spring----------line4--------name="employeebeans"><h3>ALL errors</h3>
<[Link] path=" " cssclass="error"/></spring------------line4--------></[Link]>
configuration file
==============================
<bean><!---assume rest of the configuration is written ---->
<bean id ='messagesource"
class= "[Link]----------line5----------">
<property name ="basename" value="[Link]/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


[Link]
========
<!--Assume other dependencies are configured-->
<parent>
<groupid>[Link]</groupid>
<artifactid>___Line1___</artifactid>
<version>[Link]</version>
</parent>
<dependency>
Starter Class
=============
____Line3_____
public class Application {
public static void main(String[]args) {
____Line4____run{Application,class, args);
refer the incomplete code given below
application properties
=============
#Assume other properties are configured
_____Line1_____=8080

[Link]
========
<!--Assume other dependencies are configured-->
<Dependency> [Link],spring-boot-starter-web,@SpringBootApplication,@RestController
<groupid>[Link]</groupid>
<artifactid>___Line2___</artifactid> [Link], spring-boot-starter-web,@SpringBootApplication,@Controller
<!---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:form___Line5___="empobj"method="GET"action =""[Link]">
<!--Code goes here to enter the employee details--->
<input type = "submit"value="Register"/>
</[Link]>
Refer the incompleted code given below for spring Mvc controller
____Line1____
public class GreetController{
____-Line2___(___line3__="Home")
@Controller , @Requestmapping ,value
public modelandView Homepage(){
}
}
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
[Link]
------------------
<form name="loginform"action="<[Link] 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="/[Link]" view name ="[Link]"/>

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 [Link](data);
//Logic goes here....
return new ResponseEntity<List<CstBean>>(list, [Link]);
}
}

Assume application is deployed on port 8090 and following URL is hit to access the application using a web BROWSER".
URL: [Link]
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
What are the features to be possible that can be availed through the provisioning of Intellegent Automation using 2- Highly Scalable
MyWizard DevOps 3- Looks Tremendous Buiness Value
4- Manual Healing
Refer the incomplete code given below for Spring Security

[Link]
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>

Configuration in Spring security's <http> element


post , [Link], cstSecureLogin
1 <form-login
2 login-page="/____Line1_____"
3 login-processing-url="/____Line2______"
4 username-parameter="___Line3_____"
5 password-parameter="___Line4_____"
6 authentication-failure-url="/dispС[Link]?cst_Error=try

Assume dispС[Link] 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 = [Link])
public ModelAndView confirmStudentDetails(__Line2___StudentBean studentBean)
//Code to get the studentBean object is written here
ModelAndView modelAndView = new ModelAndView();
modelAndView setViewName("ConfirmStudentDetails");
[Link]("message", "Hi, Welcome" +
[Link]())
retum modelAndView
}
}
Choose from below a valid option, in the order as it appears to complete the above code"

not visible
Spring does not store the data in ____ instead stores in ____.
requestScope,SpringModel
Choose from below valid option.
Choose the best option
Code not visible clearly:
1- [Link], @RequesParam("uName") ,@RequestParam("pwd")
2- [Link], @Param("uName"),@Param("pwd")
Assume that HTML code exists which submits a POST request [Link] with parameter name: uName and pwd
3- [Link], @RequestMapping("userName"), @RequestMapping("password")
4- Request [Link], @RequestParam("userName"), @RequestParam("password")
Choose from below valid option in the order as it appears to complete above code

In Spring Rest, which of the following triggers HttpMessageConverter to convert the Java to JSON, XML,
other MIME type based on configuration?
@RequestBody
Choose most appropriate option.
Which of the following statements is/are correct with respect to Spring MVC.
1. A Spring MVC application can have multiple child context.
2. Child context belongs to DispatcherServlet. Both (1) and (2)

Choose the most appropriate option.


Jack is new to Spring MVC and wants to display [Link], when ever request for the [Link] is placed.
Help jack to complete code given below.

Configuration file:
----------------
<!_ Assume other configuration is done properly_>
<bean class="[Link]">
<property name="__Line1__">
<value>/WEB-INF/jspViews/</value>
<property name="__Line2__">
<value>.jsp</value>
</property>
</bean>

Controller
-----------
@Controller
prefix, suffix, setViewName("home"), addObject
public class LoginController {
@RequestMapping(value="/[Link]", method = [Link])
public ModelAndView getWelcomeMessage() {
ModelAndView mv = new ModelAndView();
mv.__Line3__;
mv.__Line4__("obj","Welcome!! "):
return mv;
}
}

[Link]
----------
<html>
<h2>${obj}</h2>

Continuation...........
Already repeated question
Which of the following is used to translate the logical view name to physical view name. ViewResolver
Already repeated question
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;
}
@Autowired, @PersistanceContext
DAO Layer
=============
@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 = [Link])


public ModelAndView register(__Line1_("employeeBean")_Line2_EmployeeBean employeeBean, _Line3__result) {
ModelAndView modelAndView = new ModelAndView();
//Your code goes here
return modelAndView;
}
}

View
====== @ModelAttribute, @Valid, BindingResult, hasBindErrors, ReloadableResourceBundleMessageSource
<form:form method = "POST" modelAttribute = "employeeBean" action = "[Link]">
Employee Name : <form:input path = "name" /></br>
Password : <form:password path = "password" /></br>
<input type ="submit" value ="Register">
<spring: __Line4__name="employeeBean">
<h3>All Errors</h3>
<form:errors path="*"css Class="error"/>
</spring:__Line4__>
</form:form>

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

Continued..........
Choose from below the beans that are not ingerited from the spring mvc's parent context. All bean are not inherited
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) @RequestMapping(value="cst/controller/getDetailsin Range/{p1}
{ method=[Link],
List<CstBean> list = [Link](data); produces=MediaType.APPLICATION_JSON_VALUE)
//Logic goes here....
.
.
.
Assume application is deployed on port 8090 and following URL is hit to access the application "using a web BROWSER"
URL [Link]
Choose from below a valid option to be placed at "Line-1" to complete the above code so that Json response is returned in response to the request.
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 <intercept-url pattern="/saveStudent**" access=ROLE_ADMIN
. <intercept-url pattern="/getStudentDetails**" access="ROLE_ADMIN
. ROLE_USER" />
Choose from below a valid option to complete the above code
Refer the below incomplete code for a Spring REST based application
@RequestMapping(value="/students/updateStudent",
method=_Line1_.PUT,
consumes=_Line2_.APPLICATION_JSON_VALUE)
RequestMethod, MediaType, ResponseEntity, @RequestBody
.
.
}
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 {
. @RequestMapping, [Link]
.
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?

(i) In an application there can be more than one web context


both(i)and(ii)
(ii) Web context belongs to whole application

Choose the most appropriate option.


Spring does not store the data in______instead stores in ______
request scope, SpringModel
Choose from below a valid option
Repeated Question
Which of the following statement(s) is/are CORRECT with respect to Spring MVC?
(i) A Spring MVC application can have multiple child context
both(i)and(ii)
(ii) Child context belongs to DispatcherServlet
Choose the most appropriate option.
<dependency>
<groupId>[Link]</groupId>
Which maven dependency is used to create a spring boot web application?
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
myWizard DevOps is build on which tool? Kubernetes
<--Assume other dependencies are configured-->
<dependency>
<groupid>__Line2__</artifactid><!--Dependency for web application-->
</dependency>
starter Class
=======
____Line3____
public class application{
A)server port,spring-boot-starter-web,@SpringBootApplication
public static void main(string[] args){
/*code goes here*/
C)server port,spring-boot-starter-web,@springbootapp
}
}
controller
============
____Line4______
public class Eemployeecontroller{
//code goes here
}
The Http verb which is Idempotent ans safe is __________________ Get
What is the correct syntax to generate a drop down box All the above
A valid option representing the proper name of the default properties files in springboot (1) application properties (2) [Link] (3)[Link]
only(i)

Refer the below incompleted code for a spring rest based application @RequestMapping(value=”/students/updatestudent” RequuestMethod, MediaType, ResponsesEntity, @RequestBody
,method=Line1____put,
consumes=___line2___.APPLICATION_json_value)
Which of the Following statement is/are CORRECT with respect to Spring MVC? Both(1) and (2)
(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.form__line1__”[Link]”__
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 BeanPostProcessors and BeanFactoryPostProcessors
Spring does not store the data in____ instead stores in___ choose from below a valid option Request scope, SpringModel
Assumingly we are using Spring's Validation framework.
In order to display a text field along with its error message(s), <form:input path="firstName" size="30"/><font color="red"><form:errors path="firstName" /\></font>
which of the following options will you use to accomplish this?

A handler method annotated with


@RequestMapping supports String as its return type.
State True or False TRUE
1. TRUE
2. FALSE
Refer to the following statements :-
Statement 1 : A Command Class is called a FormBacking
Bean.
Statement 2 : This class also returns a ModelAndView
Object.
Statement 1 is True and Statement 2 is False
Choose the most appropriate option:-
1)Statement 1 is True and Statement 2 is False
2)Statement 2 is True and Statement 1 is False
3)Both the statements are True
4)Both the statements are False
Identify the right syntax to add data to
a ModelAndView object and send to the Controller.
Choose two most appropriate options.
ModelAndView mv = new ModelAndView();
ModelAndView mv = new ModelAndView();
[Link]("data",new SomeData());
[Link]("data",new SomeData());
new ModelAndView("data",new SomeData());
new ModelAndView(new SomeData(),"data");
The ___________ annotation is used to
inject dataobjects before a jsp page loads in order to
ensure that the jsppage has all the data required to
display itself.
Choose the most appropriate option: @ModelAttribute
@ModelAttribute
@Model
@ModelMap
@ModelData
Assume the below code is written in a Controller class
1@modelAttribute("countryList");
2public List<string> populateCountry(){
List<string> myList=new ArrayList<string>();
<form:radiobuttons path="country" items="${countryList}" />
[Link]("India");
[Link]("US");
return myList;
}
the _____annotation is used to inject data objects before a jsp page loads in
@ModelAttribute
oder to ensure that jsp page has all data required to display itself
the ____ tag in sprng view page will help users view validation related errors <form:errors>
Assumingly we are using Spring's Validation framework.
In order to display a text field along with its error message(s), <form:input path="firstName" size="30"/><font color="red"><form:errors path="firstName" /\></font>
which of the following options will you use to accomplish this?
the valid implementations of view resolver in spring MVC are: option 1 and 2
in spring mvc the front controller uses handlerMapping implementaton to fgure out which
option 1
controller class should process request.
consider the below code:
<servlet>
<servlet-name>myadmin
</servlet-name>
optionA:[Link]
<servlet-class>[Link]</servlet-class>
.
.
</servlet>
which spring mvc component maps logical view to actual view. ViewResolver
indentify component of spring mvc all of above
A handler method annotated with
@RequestMapping supports String as its return type.
State True or False TRUE
1. TRUE
2. FALSE
Refer to the following statements :-
Statement 1 : A Command Class is called a FormBacking
Bean.
Statement 2 : This class also returns a ModelAndView
Object.
Statement 1 is True and Statement 2 is False
Choose the most appropriate option:-
1)Statement 1 is True and Statement 2 is False
2)Statement 2 is True and Statement 1 is False
3)Both the statements are True
4)Both the statements are False
Identify the right syntax to add data to
a ModelAndView object and send to the Controller.
Choose two most appropriate options.
ModelAndView mv = new ModelAndView(); option 1 and 2
[Link]("data",new SomeData());
new ModelAndView("data",new SomeData());
new ModelAndView(new SomeData(),"data");
@ModelAttribute(countrylist")
public list<string>populatecountry(){
List<String>myList=new ArrayList<String>();
[Link]("india"); <form:radiobuttons path="country" items="${countryList}" />
[Link]("Us");
return myLst
}

Common questions

Powered by AI

Overriding the HttpMessageConverter in Spring MVC applications allows customizing how HTTP requests are converted to Java objects and vice versa. This is particularly beneficial when multiple data formats need to be supported, such as XML or JSON, improving the application's adaptability to different client requests and responses .

The @ModelAttribute annotation in Spring MVC is used for populating data into models before executing a request handler method, ensuring the JSP page has the required data to display properly. It helps in binding form data to beans as well as exposing command objects to the web view .

The @Repository annotation in Spring DAO layers is used to indicate that a particular class provides the mechanism for storage, retrieval, search, update, and delete operation on objects. It is critical for exception translation in data access logic, allowing Spring to catch specific framework exceptions and subsequently rethrow them as one of Spring's unifying unchecked exceptions .

The ResponseEntity class is significant in Spring RESTful web services because it allows developers to manipulate the HTTP status code, headers, and body of the response. This enhances the ability to convey the state of request processing and any associated messages, leading to more intuitive and flexible REST API development .

In Spring Security, the <form-login> element in the configuration snippet is used to define the custom login page's URI that users should access to log in. It specifies URLs for login process submission and the page to be displayed post-authentication failure, providing a customized secure login mechanism .

The valid Content Negotiation strategies in Spring Boot mentioned in the document are URL Extension Based and URL Parameter Based .

Spring Boot uses 'application.properties' as the default properties file, which houses configuration settings critical to the application's setup and behavior, allowing for customization without changing code .

In Spring Boot, the annotation @RestController is equivalent to combining @Controller and @ResponseBody. This means that it simplifies creating RESTful web services by not requiring separate annotation for response body handling .

The Maven dependency needed for creating a Spring Boot web application is <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>. This dependency includes essential components like Spring MVC and an embedded Tomcat server, enabling easy setup of web applications .

The Content Negotiation Manager Bean in Spring applications is responsible for supporting multiple representations of resources. It allows the application to determine the media type according to the client's request, which might be based on path extensions or request parameters, enhancing flexibility in resource handling .

Mcq4
1
Questions
Answer
Refer the incomplete code given below: application propperties ===================
 Assume other prop
Mcq4
2
It is required by jack to fetch eemployee details by salary, such that salary 
greater than equal to certain value, an
Mcq4
3
Refer the incomplete code given below:
application.propperties
===================
#Assume other properties are config
Mcq4
4
___Line1____
public class Application {
public static void main(String[] args) {
___Line2____
}
@SpringBootApplication
Mcq4
5
In the digital era there are key success factors addressed by mywizard Deveops. 
Pick the valid success factors.
All o
Mcq4
6
Refer the incomplete code given below
stater class
-----------------
----------------
------Line 1-------
public class
Mcq4
7
Refer the below requirement to be implemented using spring security. 1) LoadSave should be 
accessible by CST_ADMIN,CS
Mcq4
8
refer the below incomplted code for a spring Rest based appliction 
@RequestMapping(value ="/students/updateStudent",
Mcq4
9
Refer the code given below
@RestController public class CstController {
        @RequestMapping(value = "/rest/control
Mcq4
10
Refer the incomplete code below:
@Controller
public class CstController {
        //Assume Request mapping code is wr

You might also like