2V0-72.22 Practice Test Questions Updated 81 Questions [Q23-Q44]

Share

2V0-72.22 Practice Test Questions Updated 81 Questions

VMware 2V0-72.22 Dumps - Secret To Pass in First Attempt

NEW QUESTION # 23
Refer to the exhibit.

How can a Spring Bean be created from this LegacySingleton class?

  • A. Call LegacySingleton.getInstance() from within a @Bean method and return the instance.
  • B. It is not possible without modifying the LegacySingleton class, the constructor must be public.
  • C. Modify the LegacySingleton class by adding the @Autowired annotation to the instance variable.
  • D. Return an instance of LegacySingleton using the new keyword from a @Bean method.

Answer: A


NEW QUESTION # 24
Which two statements are true concerning constructor injection? (Choose two.)

  • A. Constructor injection is preferred over field injection to support unit testing.
  • B. Constructor injection only allows one value to be injected.
  • C. Construction injection can be used with multiple constructors without @Autowired annotation.
  • D. Field injection is preferred over constructor injection from a unit testing standpoint.
  • E. If there is only one constructor the @Autowired annotation is not required.

Answer: A,D


NEW QUESTION # 25
Which following statements are true about Spring Data? (Choose two.)

  • A. Spring Data is specifically designed for JPA, JDBC, and relational database access only.
  • B. Spring Data works by applying the JPA annotations to data stores such as MongoDB, Neo4j, and Redis.
  • C. Spring Data implementations exist for many data storage types, such as MongoDB, Neo4j, and Redis.
  • D. Spring Data cannot be used together with Spring MVC.
  • E. Spring Data can greatly reduce the amount of "boilerplate" code typically needed for data access.

Answer: A,E


NEW QUESTION # 26
Spring puts each bean instance in a scope. What is the default scope? (Choose the best answer.)

  • A. session
  • B. request
  • C. prototype
  • D. singleton

Answer: D

Explanation:
Spring supports different scopes for bean instances, such as singleton, prototype, request, session, etc. The scope determines how many instances of a bean are created and how they are shared among other components. The default scope is singleton, which means that only one instance of a bean is created per application context and it is shared by all components that depend on it.


NEW QUESTION # 27
Which two options are REST principles? (Choose two.)

  • A. RESTful applications cannot use caching.
  • B. RESTful application use HTTP headers and status codes as a contract with the clients.
  • C. RESTful applications use a stateless architecture.
  • D. RESTful application servers keep track of the client state.
  • E. RESTful applications favor tight coupling between the clients and the servers.

Answer: B,C


NEW QUESTION # 28
Which three types can be used as @Controller method arguments? (Choose three.)

  • A. Principal
  • B. HttpSession
  • C. Locale
  • D. Request
  • E. Session
  • F. Language

Answer: A,B,C

Explanation:
A . Locale
This is true because the Locale argument can be used to resolve the current locale that the client is using, based on the Accept-Language header or a cookie1.
B . Principal
This is true because the Principal argument can be used to access the currently authenticated user, if any1.
F . HttpSession
This is true because the HttpSession argument can be used to access the current session, if any1. Note that this argument is not required and will be null if a session does not exist.


NEW QUESTION # 29
Which three types of objects can be returned form a JdbcTemplate query? (Choose three.)

  • A. Simple types (int, long, String, etc)
  • B. Generic MapS
  • C. User defined types
  • D. Properties
  • E. JSONObject
  • F. XMLObject

Answer: A,B,C

Explanation:
The JdbcTemplate class provides various methods to execute queries and manipulate the query results. Depending on the query and the expected result type, we can choose from the following three types of objects that can be returned from a JdbcTemplate query:
A . Generic Maps
This is true because the JdbcTemplate.queryForList method returns a List of Map objects, where each Map represents a row of the query result. The Map keys are the column names and the Map values are the column values1. For example:
List<Map<String, Object>> results = jdbcTemplate.queryForList("SELECT * FROM EMPLOYEE"); for (Map<String, Object> row : results) { System.out.println(row.get("NAME") + " " + row.get("SALARY")); } B . Simple types (int, long, String, etc) This is true because the JdbcTemplate.queryForObject method can return a single value of a simple type, such as int, long, String, etc. This method is useful for running queries that return a single row and a single column2. For example:
int count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class); System.out.println("Number of employees: " + count); D . User defined types This is true because the JdbcTemplate.query method can return a List of user defined types, such as custom classes or beans. This method takes a RowMapper as an argument, which is an interface that maps each row of the query result to an instance of the user defined type3. For example:
public class Employee { private String name; private int salary; // getters and setters } public class EmployeeRowMapper implements RowMapper<Employee> { @Override public Employee mapRow(ResultSet rs, int rowNum) throws SQLException { Employee employee = new Employee(); employee.setName(rs.getString("NAME")); employee.setSalary(rs.getInt("SALARY")); return employee; } } List<Employee> employees = jdbcTemplate.query("SELECT * FROM EMPLOYEE", new EmployeeRowMapper()); for (Employee employee : employees) { System.out.println(employee.getName() + " " + employee.getSalary()); }


NEW QUESTION # 30
Which two annotations indicate that the transaction for a transactional test method should be committed after the test method has completed? (Choose two.)

  • A. @Sql(alwaysCommit=true)
  • B. @Commit
  • C. @Transactional(commit=true)
  • D. @Rollback(false)
  • E. @SqlMergeMode(false)

Answer: B,D


NEW QUESTION # 31
Which two statements describe Spring JdbcTemplate? (Choose two.)

  • A. The JdbcTemplate generates SQL statements.
  • B. The JdbcTemplate can only perform update but not insert to the database.
  • C. The JdbcTemplate provides the ability to work with result sets.
  • D. The JdbcTemplate provides methods for query execution.
  • E. All JdbcTemplate methods throw SQLException which you are required to handle.

Answer: A,C


NEW QUESTION # 32
Which two statements are correct regarding Spring Boot auto-configuration? (Choose two.)

  • A. Auto-configuration uses @Conditional annotations to constrain when it should apply.
  • B. Auto-configuration is applied before user-defined beans have been registered.
  • C. Auto-configuration could apply when a bean is present but not when a bean is missing.
  • D. Auto-configuration is applied by processing candidates listed in META-INF/spring.factories.
  • E. Auto-configuration could apply when a bean is missing but not when a bean is present.

Answer: A,D


NEW QUESTION # 33
Which two options will inject the value of the daily.limit system property? (Choose two.)

  • A. @Value("#{systemProperties['daily.limit']}")
  • B. @Value("#{daily.limit}")
  • C. @Value("#{systemProperties.daily.limit}")
  • D. @Value("$(daily.limit)")
  • E. @Value("$(systemProperties.daily.limit)")

Answer: A,E


NEW QUESTION # 34
Which statement defines a pointcut? (Choose the best answer.)

  • A. A module that encapsulated advices.
  • B. An expression that selects one or more join points.
  • C. Code to be executed at each selected join point.
  • D. A point in the execution of a program such as a method call or field assignment.

Answer: B


NEW QUESTION # 35
Which two statements are true regarding Spring and Spring Boot Testing? (Choose two.)

  • A. @SpringBootTest or @SpringJUnitConfig can be used for creating an ApplicationContext.
  • B. Integration and slice testing are both supported.
  • C. EasyMock is supported out of the box.
  • D. The spring-test dependency provides annotations such as @Mock and @MockBean.
  • E. Mockito spy is not supported in Spring Boot testing by default.

Answer: D,E


NEW QUESTION # 36
Refer to the exhibit.

The above code shows a conditional @Bean method for the creation of a JdbcTemplate bean. Which two statements correctly describe the code behavior? (Choose two.)

  • A. A JdbcTemplate bean will be created when a bean named dataSource has already been created.
  • B. The @Bean annotation should be removed.
  • C. A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
  • D. @ConditionalOnBean(name= "dataSource") should be replaced with @ConditionalOnBean (DataSource.class) for greater flexibility.
  • E. @ConditionalOnBean(name= "dataSource") should be replaced with
    @ConditionalOnMissingBean (DataSource.class) for greater flexibility.

Answer: A,D

Explanation:
The @Bean annotation is used to declare a method that returns an object that should be registered as a bean in the application context. The @ConditionalOnBean annotation is used to specify a condition for the bean creation based on the presence or absence of other beans in the application context. The name attribute of this annotation can be used to specify the bean name or names that must be present or absent for the condition to match. However, this approach is less flexible than using the value or type attribute, which can specify the bean class or classes that must be present or absent for the condition to match. Therefore, it is recommended to use @ConditionalOnBean(DataSource.class) instead of @ConditionalOnBean(name= "dataSource") for greater flexibility.
The JdbcTemplate class is a Spring class that simplifies the use of JDBC and helps to avoid common errors. It executes core JDBC workflow, leaving application code to provide SQL and extract results. To create a JdbcTemplate object, we need to pass a DataSource object as a constructor argument. The DataSource interface is a Java interface that represents a factory of connection objects. In this code, the jdbcTemplate() method takes a DataSource object as a parameter and returns a new JdbcTemplate object. This method is annotated with @Bean and @ConditionalOnBean(name= "dataSource"), which means that it will only create a JdbcTemplate bean when there is already a bean named dataSource in the application context.


NEW QUESTION # 37
Which two are required to use transactions in Spring? (Choose two.)

  • A. A class must be annotated with @Service and @Transaction.
  • B. Write a Spring AOP advice to implement transactional behavior.
  • C. Annotate a class, an interface, or individual methods requiring a transaction with the @Transactional annotation.
  • D. Add @EnableTransactionManagement to a Java configuration class.
  • E. A class requiring a transaction must implement the TransactionInterceptor interface.

Answer: C,D

Explanation:
Transactions are units of work that ensure data consistency and integrity by enforcing atomicity, consistency, isolation, and durability (ACID) properties. Spring provides an abstraction layer for transaction management that supports various transaction APIs such as JDBC, JPA, Hibernate, etc. To use transactions in Spring, we need to do two things:
Enable transaction management by adding @EnableTransactionManagement annotation to a Java configuration class or tx:annotation-driven/ element to an XML configuration file.
Declare transactional boundaries by annotating a class, an interface, or individual methods with the @Transactional annotation. This annotation indicates that the execution of the annotated element should be wrapped in a transaction.


NEW QUESTION # 38
Which option is true about use of mocks in a Spring Boot web slice test? (Choose the best answer.)

  • A. Mocks cannot be used in a Spring Boot web slice test.
  • B. Mocking a Spring Bean requires annotating it with @MockBean annotation.
  • C. If a Spring Bean already exists in the web slice test spring context, it cannot be mocked.
  • D. Mocking a Spring Bean requires annotating it with @Mock annotation.

Answer: B


NEW QUESTION # 39
Which strategy is correct for configuring Spring Security to intercept particular URLs? (Choose the best answer.)

  • A. The URLs can be specified via configuration (using authorizeRequests () and request matchers), with the least specific rule first and the most specific last.
  • B. The URLs are specified in a special properties file, used by Spring Security.
  • C. The URLs can be specified via configuration (using authorizeRequests () and request matchers), with the most specific rule first and the least specific last.
  • D. Spring Security can obtain URLs from Spring MVC controllers, the Spring Security configuration just needs a reference to the controller to be protected.

Answer: C


NEW QUESTION # 40
Refer to the exhibit.

Which statement is true? (Choose the best answer.)

  • A. An implementation of this repository can be automatically generated by Spring Data JPA.
  • B. CustomerRepository should be a class, not an interface.
  • C. A class that implements CustomerRepository must be implemented and declared as a Spring Bean.
  • D. JPA annotations are required on the Customer class to successfully use Spring Data JDBC.

Answer: A


NEW QUESTION # 41
Which two statements are true regarding a Spring Boot-based Spring MVC application? (Choose two.)

  • A. The default port of the embedded servlet container is 8088.
  • B. Spring MVC starts up an in-memory database by default.
  • C. Jetty is the default servlet container.
  • D. Spring Boot starts up an embedded servlet container by default.
  • E. The default embedded servlet container can be replaced with Undertow.

Answer: C,D


NEW QUESTION # 42
Which two statements about pointcut expressions are true? (Choose two.)

  • A. A pointcut expression cannot specify the type of parameters.
  • B. A pointcut expression will throw an exception if no methods are matched.
  • C. A pointcut expression can include operators such as the following: && (and), || (or), ! (not).
  • D. A pointcut expression can be used to select join points which have been annotated with a specific annotation.
  • E. A pointcut expression cannot have a wildcard for a method name.

Answer: C,D


NEW QUESTION # 43
Which statements is true?

  • A. @BeforeAll annotation can only be used on non-static methods.
  • B. Methods annotated with @AfterEach will run only once before any tests in a class are executed.
  • C. @AfterEach annotation must be used on a cleanup method when @BeforeEach is used.
  • D. Methods annotated with @BeforeAll will run only once before any tests in a class are executed.

Answer: D


NEW QUESTION # 44
......

VMware 2V0-72.22 Exam Dumps [2025] Practice Valid Exam Dumps Question: https://www.prepawaytest.com/VMware/2V0-72.22-practice-exam-dumps.html

2V0-72.22 Dumps - Grab Out For [NEW-2025] VMware Exam: https://drive.google.com/open?id=14wb_E6mOkdYPnB8kPNc7STwS9_lg7k-o

Contact Us

If you have any question please leave me your email address, we will reply and send email to you in 12 hours.

Our Working Time: ( GMT 0:00-15:00 )
From Monday to Saturday

Support: Contact now