Spring Framework MCQ: Spring Framework Multiple Choice Questions

Spring Framework MCQ with answers and explanations for placement tests and job interviews. These solved Spring Framework MCQs are useful for the campus placement for all freshers including Engineering Students, MCA students, Computer and IT Engineers, etc.

Our Spring Framework MCQ (Spring Framework Multiple Choice Questions and answers ) focuses on various parts of the Spring Framework and its concept. It will be useful for anyone learning Spring Framework Basics, Essentials, and/or Fundamentals. We will regularly update the quiz and most interesting thing is that questions come in a random sequence. So every time you will feel new questions.

There are several Java courses that you may have come across during your search for learning the Java language. Our team of experts has carefully analyzed some Java courses for you. You can check the courses, Trial of some courses is free.

 

Guideline of Spring Framework MCQ:

This Spring Framework MCQ is intended for checking your Spring Framework. It takes 50 minutes to pass the Spring Framework MCQ. If you don’t finish the Spring Framework MCQ within the mentioned time, all the unanswered questions will count as wrong. You can miss the questions by clicking the “Next” button and return to the previous questions by the “Previous” button. Every unanswered question will count as wrong. MCQ on Spring Framework has features of randomization which feel you a new question set at every attempt.

In this Spring Framework MCQ, we have also implemented a feature that not allowed the user to see the next question or finish the Spring Framework quiz without attempting the current Spring Framework MCQ.

1 votes, 5 avg

You have 50 minutes to take the Spring Framework MCQs

Your time has been Over.


Spring Framework MCQ

Spring Framework

Spring Framework MCQ: Spring Framework Multiple Choice Questions and Answers

1 / 40

What is the DispatcherServlet and what is its function?

2 / 40

What does a ViewResolver do?

3 / 40

How are JDK Dynamic proxies and CGLIB proxies used in Spring?

4 / 40

How are Spring Data repositories implemented by Spring at runtime?

5 / 40

How do you inject a dependency into a Spring bean?

6 / 40

What is the function of the @Transactional annotation at the class level?

7 / 40

How are mocking frameworks such as Mockito used with Spring?

8 / 40

Which are valid steps to take to enable JPA in Spring Boot?

9 / 40

How does Spring generate bean names for classes annotated with @Component that do not specify a name?

10 / 40

What is a transaction in the context of Spring Data?

11 / 40

The process of linking aspects with other objects to create an advised object is called

12 / 40

What is the name of the central servlet that dispatches requests to controllers?

13 / 40

How does Spring Data facilitate queries against a datastore?

14 / 40

Which is a valid example of the output from this code (ignoring logging statements) ?

@SpringBootApplication
public class App {
     public static void main(String args[]) {
          SpringApplication.run(App.class, args);
          System.out.println("startup");
     }
}

public class Print implements InitializingBean {
     @Override
     public void afterPropertiesSet() throws Exception {
          System.out.println("init");
     }
}

 

15 / 40

What happens when a class is annotated with the @Controller annotation?

16 / 40

What is a RESTful web service?

17 / 40

What is the purpose of the Spring IoC (Inversion of Control) container?

18 / 40

Which annotation can be used within Spring Security to apply method level security?

19 / 40

What is the result of calling the map controller method using the HTTP request GET localhost:8080/map?foo=foo&bar=bar ?

@RestController
public class SampleController {

     @RequestMapping("/map")
     public String map(@RequestParam("bar") String foo, @RequestParam("foo") String bar) {
          return bar + foo;
     }
}

 

20 / 40

What is the purpose of the @ContextConfiguration annotation in a JUnit Test?

21 / 40

In what order do the @PostConstruct annotated method, the init-method parameter method on beans and the afterPropertiesSet() method execute?

22 / 40

What is component scanning?

23 / 40

How is a resource defined in the context of a REST service?

24 / 40

What is dependency injection?

25 / 40

What value does Spring Boot Actuator provide?

26 / 40

Which println statement would you remove to stop this code throwing a null pointer exception?

@Component
public class Test implements InitializingBean {
     @Autowired
     ApplicationContext context;
     @Autowired
     static SimpleDateFormt formatter;

     @Override
     public void afterPropertiesSet() throws Exception {
          System.out.println(context.containsBean("formatter") + " ");
          System.out.println(context.getBean("formatter").getClass());
          System.out.println(formatter.getClass());
          System.out.println(context.getClass());
     }
}

@Configuration
class TestConfig {
     @Bean
     public SimpleDateFormat formatter() {
          return new SimpleDateFormat();
     }
}

 

27 / 40

What is the root interface for accessing a Spring bean container?

28 / 40

Which property can be used to change the port of a Spring application?

29 / 40

What is the purpose of the @ResponseBody annotation?

30 / 40

Consider the properties file application.properties. How would you load the property my.property?

my.property=Test

1.

@Prop("${my.property}")
private String val;

2.

@GetVal("my.property")
private String val;

3.

@GetProperty("${my.property}")
private String val;

4.

@Value("${my.property}")
private String val;

31 / 40

Which of these is not a valid method on the JoinPoint interface?

32 / 40

What does @SpringBootApplication do?

33 / 40

Modularization of a concern that cuts across multiple classes is known as a(n)___.

34 / 40

What is the delegating filter proxy?

35 / 40

What is Spring Boot autoconfiguration?

36 / 40

What is the purpose of the @RequestBody annotation?

37 / 40

How filters are used in Spring Web?

38 / 40

What is the purpose of the @Lazy annotation and why would you use it?

39 / 40

What is SpEL and how is it used in Spring?

40 / 40

Which of these is a valid Advice annotation?

Your score is

The average score is 0%

0%

Recommended Articles for you: