exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 229 discussion

Actual exam question from Salesforce's CRT-450
Question #: 229
Topic #: 1
[All CRT-450 Questions]

Which two statements are true about Getter and Setter methods? (Choose two.)

  • A. Setter methods always have to be declared global.
  • B. Setter methods are required to pass a value from a page to a controller.
  • C. There is no guarantee for the order in which Getter or Setter methods are executed.
  • D. Getter methods can pass a value from a controller to a page.
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
MuzaffarMoiz
Highly Voted 3 years, 2 months ago
Right answer is B and D
upvoted 8 times
...
[Removed]
Highly Voted 3 years, 3 months ago
What's wrong with D? In my opinion should be B and D. There is no guarantee of order between extension and controller related methods and variables
upvoted 5 times
...
SanjeevOnForce
Most Recent 1 year, 2 months ago
I think the most appropriate answer is B and D.
upvoted 1 times
...
irina_735
1 year, 3 months ago
Selected Answer: CD
While a getter method is always required to access values from a controller, it’s not always necessary to include a setter method to pass values into a controller. Visualforce doesn’t define the order in which setter methods are called: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_methods.htm
upvoted 2 times
...
BrucePark
1 year, 5 months ago
According to the dev guide, B doesn't seem correct. It says, "While a getter method is always required to access values from a controller, it’s not always necessary to include a setter method to pass values into a controller." So, setter is not required always.
upvoted 1 times
...
Jhonvf20
1 year, 6 months ago
Selected Answer: CD
While a getter method is always required to access values from a controller, it’s not always necessary to include a setter method to pass values into a controller.
upvoted 3 times
...
Dean5555
2 years, 2 months ago
Selected Answer: CD
It's C and D https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_methods.htm
upvoted 4 times
RMEZZA
1 year, 11 months ago
You could say that alternative B is poorly written... Because it would be possible to interpret that 'a setter needs to pass a value's.... Just like 'passengers need to stay in their seats' or 'passengers are required to stay in their seats' But I could not find any evidence that C is correct
upvoted 1 times
mariamarlenepereira9
11 months, 2 weeks ago
[quoting] "Getting and Setting Data with a Custom Extension or Controller There is no guaranteed order in which Apex methods and variables are processed by a controller extension or custom controller. Therefore, do not allow controller and extension classes to rely on another method being run, call that method directly. This applies specifically to setting variables and accessing data from the database." https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_methods.htm
upvoted 1 times
...
...
Dean5555
2 years, 2 months ago
There are multiple ways to (B) pass the value from page to a controller so it's not *required*
upvoted 1 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 ...