Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
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 (?) , you can switch to a simple comment.
Switch to a voting comment New
MuzaffarMoiz
Highly Voted 3 years, 1 month ago
Right answer is B and D
upvoted 8 times
...
[Removed]
Highly Voted 3 years, 1 month 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 ago
I think the most appropriate answer is B and D.
upvoted 1 times
...
irina_735
1 year, 2 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, 4 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, 5 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, 1 month 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
Dean5555
2 years, 1 month ago
There are multiple ways to (B) pass the value from page to a controller so it's not *required*
upvoted 1 times
...
RMEZZA
1 year, 9 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
10 months 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
...
...
...
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 ...