- Which of the following is true about Spring Framework?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.context.*; 2 import org.springframework.context.support.ClassPathXmlApplicationContext; 3 class EduinqService { 4 public void serve(){ System.out.println("Eduinq Service Running"); } 5 } 6 public class Test { 7 public static void main(String[] args) { 8 ApplicationContext ctx = new ClassPathXmlApplicationContext("eduinq.xml"); 9 EduinqService s = (EduinqService) ctx.getBean("eduinqService"); 10 s.serve(); 11 } 12 } View Answer
Correct answer: A — Eduinq Service Running
- Which of the following is true about IoC (Inversion of Control)?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Dependency Injection types?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.beans.factory.annotation.*; 2 import org.springframework.stereotype.*; 3 @Component 4 class EduinqService { 5 public String getMsg(){ return "Eduinq DI"; } 6 } 7 @Component 8 class Client { 9 @Autowired EduinqService service; 10 public void work(){ System.out.println(service.getMsg()); } 11 } View Answer
Correct answer: A — Eduinq DI
- Which of the following is true about Bean lifecycle methods?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import javax.annotation.*; 2 class EduinqBean { 3 @PostConstruct 4 public void init(){ System.out.println("Eduinq Init"); } 5 @PreDestroy 6 public void destroy(){ System.out.println("Eduinq Destroy"); } 7 } View Answer
Correct answer: A — Eduinq Init then Eduinq Destroy
- Which of the following is true about Bean scopes in Spring?
View Answer
Correct answer: D — All of the above
- Which of the following is true about ApplicationContext vs BeanFactory?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring AOP?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.aspectj.lang.annotation.*; 2 @Aspect 3 class EduinqAspect { 4 @Before("execution(* EduinqService.serve(..))") 5 public void log(){ System.out.println("Eduinq Before Advice"); } 6 } 7 class EduinqService { 8 public void serve(){ System.out.println("Eduinq Service"); } 9 } View Answer
Correct answer: A — Eduinq Before Advice then Eduinq Service
- Which of the following is true about @Component annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Configuration annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Bean annotation?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.context.annotation.*; 2 @Configuration 3 class EduinqConfig { 4 @Bean 5 public String eduinqBean(){ return "Eduinq Bean"; } 6 } 7 public class Test { 8 public static void main(String[] args) { 9 AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(EduinqConfig.class); 10 System.out.println(ctx.getBean("eduinqBean")); 11 } 12 } View Answer
Correct answer: A — Eduinq Bean
- Which of the following is true about @Qualifier annotation?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.beans.factory.annotation.*; 2 import org.springframework.stereotype.*; 3 interface EduinqService { String getMsg(); } 4 @Component("serviceA") 5 class ServiceA implements EduinqService { public String getMsg(){ return "Eduinq A"; } } 6 @Component("serviceB") 7 class ServiceB implements EduinqService { public String getMsg(){ return "Eduinq B"; } } 8 @Component 9 class Client { 10 @Autowired @Qualifier("serviceB") EduinqService service; 11 public void work(){ System.out.println(service.getMsg()); } 12 } View Answer
Correct answer: A — Eduinq B
- Which of the following is true about Spring Profiles?
View Answer
Correct answer: D — All of the above
- Which of the following is true about BeanPostProcessor?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.beans.factory.config.*; 2 class EduinqProcessor implements BeanPostProcessor { 3 public Object postProcessBeforeInitialization(Object bean, String name) { 4 System.out.println("Eduinq Before Init: " + name); 5 return bean; 6 } 7 } View Answer
Correct answer: A — Eduinq Before Init: beanName
- Which of the following is true about AOP advice types?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Pointcut expressions?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.aspectj.lang.annotation.*; 2 @Aspect 3 class EduinqAspect { 4 @After("execution(* EduinqService.serve(..))") 5 public void afterAdvice(){ System.out.println("Eduinq After Advice"); } 6 } 7 class EduinqService { 8 public void serve(){ System.out.println("Eduinq Service"); } 9 } View Answer
Correct answer: A — Eduinq Service then Eduinq After Advice
- Which of the following is true about Around advice?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Transaction Management?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.transaction.annotation.*; 2 class EduinqService { 3 @Transactional 4 public void save(){ System.out.println("Eduinq Transactional Save"); } 5 } View Answer
Correct answer: A — Eduinq Transactional Save
- Which of the following is true about @EnableAspectJAutoProxy?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Events?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Lazy annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Primary annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Expression Language (SpEL)?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring BeanFactoryPostProcessor?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Scope annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Boot vs Spring Framework?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Value annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @PropertySource annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring AOP proxies?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Order annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Bean validation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @RestController annotation?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring MVC DispatcherServlet?
View Answer
Correct answer: D — All of the above
- Which of the following is true about @Transactional propagation types?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring caching?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Scheduling?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 import org.springframework.scheduling.annotation.*; 2 import org.springframework.stereotype.*; 3 @EnableScheduling 4 @Component 5 class EduinqScheduler { 6 @Scheduled(fixedRate = 1000) 7 public void task(){ System.out.println("Eduinq Scheduled Task"); } 8 } View Answer
Correct answer: A — Eduinq Scheduled Task (every second)
- Which of the following is true about Spring Boot auto configuration?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring BeanFactory vs ApplicationContext?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring AOP join points?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring Boot starters?
View Answer
Correct answer: D — All of the above
- Which of the following is true about Spring AOP best practices?
View Answer
Correct answer: D — All of the above