Study for the Salesforce Admin Certification Test. Access multiple choice questions and in-depth explanations. Prepare for your exam and boost your Salesforce admin skills!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What is the primary function of a controller in Visualforce pages?

  1. To display images

  2. To retrieve data for display and handle updates

  3. To generate reports

  4. To manage user permissions

The correct answer is: To retrieve data for display and handle updates

The primary function of a controller in Visualforce pages is to retrieve data for display and handle updates. In Salesforce, a controller is a server-side script that acts as an intermediary between the view (Visualforce page) and the model (data). It manages the logic needed to pull data from the database, process any updates made by the user, and ensure that the correct information is displayed on the page. This interaction typically involves querying the database for records, formatting the data for presentation, and handling user input to perform operations like saving or updating records. By using controllers, developers can create dynamic and interactive pages that respond to user interactions, pulling in and manipulating data as needed. The other options do not align with the primary responsibilities of a controller. Displaying images, generating reports, and managing user permissions are not direct functions of the controller in the context of Visualforce; rather, they can be accomplished through other components or systems within the Salesforce ecosystem.