CSA Visualforce Pages 5 — Questions and Answers
Question 1: Which Visualforce component is used to add a tab set with multiple tabs to a page?
- <apex:tabPanel> and <apex:tab> (Correct answer)
- <apex:tabSet> and <apex:tabItem>
- <apex:tabs> and <apex:tabPage>
- <apex:tabbedPanel> and <apex:tabContent>
Correct answer: <apex:tabPanel> and <apex:tab>
<apex:tabPanel> creates a tab container and <apex:tab> defines each individual tab within it.
Question 2: How does a Visualforce controller extension differ from a custom controller?
- Extensions cannot access standard controller actions; custom controllers can
- Extensions augment an existing standard or custom controller; custom controllers replace it entirely (Correct answer)
- Extensions are used only with list views; custom controllers are used with detail pages
- Extensions require an interface; custom controllers do not
Correct answer: Extensions augment an existing standard or custom controller; custom controllers replace it entirely
A controller extension adds functionality to an existing standard or custom controller, while a custom controller completely replaces the standard controller.
Question 3: Which approach should be used to expose a Visualforce page to users WITHOUT a Salesforce license (e.g., portal or site users)?
- Mark the page as 'Public' in page settings
- Enable the page in Sites configuration and grant access to the guest user profile (Correct answer)
- Use the 'Available for Guest Users' checkbox on the page
- Set the page's visibility to 'All Users' in sharing rules
Correct answer: Enable the page in Sites configuration and grant access to the guest user profile
To expose a Visualforce page publicly, it must be enabled under Salesforce Sites and the guest user profile must have access to the page and its controller.
Question 4: What does the <apex:actionPoller> component do?
- Polls an external API at regular intervals
- Periodically calls a controller action and refreshes specified components (Correct answer)
- Monitors database changes and updates the page
- Queues multiple AJAX requests and sends them together
Correct answer: Periodically calls a controller action and refreshes specified components
<apex:actionPoller> automatically invokes a controller action at a specified time interval and can reRender parts of the page with updated data.
Question 5: Which Visualforce expression references the running user's information, such as their name or ID?
- {!$User.Name} (Correct answer)
- {!CurrentUser.Name}
- {!RunningUser.Name}
- {!$Profile.Name}
Correct answer: {!$User.Name}
The $User global variable in Visualforce provides access to the running user's fields, such as {!$User.Name} or {!$User.Id}.
Question 6: What is the effect of setting sidebar="false" on <apex:page>?
- Hides the left navigation sidebar in Salesforce Classic (Correct answer)
- Removes the right-side related list panel
- Disables the collapsible sidebar feature
- Hides the setup sidebar in Lightning Experience
Correct answer: Hides the left navigation sidebar in Salesforce Classic
Setting sidebar="false" on <apex:page> removes the left-side navigation sidebar in Salesforce Classic for that page.
Question 7: Which component is used to display read-only field values using standard Salesforce field formatting?
- <apex:outputText>
- <apex:outputLabel>
- <apex:outputField> (Correct answer)
- <apex:outputData>
Correct answer: <apex:outputField>
<apex:outputField> displays a field value in read-only mode using the standard Salesforce formatting for that field type (e.g., currency, date, picklist).
Which Visualforce component is used to add a tab set with multiple tabs to a page?