Salesforce Platform Developer I (legacy) — Question 15
What is the requirement for a class to be used as a custom Visualforce controller?
Answer options
- A. Any top-level Apex class that has a constructor that returns a PageReference
- B. Any top-level Apex class that extends a PageReference
- C. Any top-level Apex class that has a default, no-argument constructor
- D. Any top-level Apex class that implements the controller interface
Correct answer: C
Explanation
The correct answer is C because a custom Visualforce controller must have a default constructor to be instantiated by the Visualforce framework. Options A, B, and D are incorrect as they describe requirements that do not apply to the basic definition of a Visualforce controller, which specifically needs the no-argument constructor.