Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam 2V0-72.22 All Questions

View all questions & answers for the 2V0-72.22 exam

Exam 2V0-72.22 topic 1 question 13 discussion

Actual exam question from VMware's 2V0-72.22
Question #: 13
Topic #: 1
[All 2V0-72.22 Questions]

Refer to the exhibit.

Which option is a valid way to retrieve the account id? (Choose the best answer.)

  • A. Add @PathVariable(“id”) String accountId argument to the update() handler method.
  • B. Add @PathVariable long accountId argument to the update() handler method.
  • C. Add @RequestParam long accountId argument to the update() handler method.
  • D. Add @RequestParam(“id”) String accountId argument to the update() handler method.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Azuni
Highly Voted 1 year, 3 months ago
Selected Answer: A
A is the correct answer. Please refer to this: https://www.baeldung.com/spring-pathvariable#specifying-the-request-parameter-name
upvoted 5 times
...
2211094
Most Recent 4 months, 3 weeks ago
Be careful here, to me this question is one of very tricky question. Answer is B and not A because A forces data type conversion from string to Integer/long.
upvoted 1 times
...
IYONISSIO
1 year, 3 months ago
The correct option is B. Add @PathVariable long accountId argument to the update() handler method. The @PathVariable annotation is used to bind a path variable from the request URI to a parameter in the handler method. In this case, the path variable is id, and the type is long. This means that the account id will be passed to the update() handler method as a long value
upvoted 2 times
Azuni
1 year, 3 months ago
The answer is A. B will only be valid if the parameter name matches the path variable in the the URL.
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...