CSA Visualforce Pages 3 — Questions and Answers
Question 1: Which component renders an input field appropriate for the data type of a Salesforce field?
- <apex:input>
- <apex:inputText>
- <apex:inputField> (Correct answer)
- <apex:inputControl>
Correct answer: <apex:inputField>
<apex:inputField> automatically renders the correct input type based on the field's metadata and data type.
Question 2: What does the 'rendered' attribute do on a Visualforce component?
- Sets the component's CSS style
- Controls whether the component is visible on screen
- Determines if the component is included in the DOM (Correct answer)
- Specifies the order of rendering
Correct answer: Determines if the component is included in the DOM
The rendered attribute (boolean) determines whether the component is included in the page DOM — when false, it is not rendered at all.
Question 3: Which Visualforce tag is used to define an area that can be partially refreshed via AJAX?
- <apex:ajaxPanel>
- <apex:outputPanel> (Correct answer)
- <apex:actionRegion>
- <apex:refreshArea>
Correct answer: <apex:outputPanel>
<apex:outputPanel> with layout="block" can be targeted by reRender attributes for partial page AJAX refreshes.
Question 4: What is the purpose of <apex:actionFunction>?
- Defines a JavaScript function that calls a controller action remotely (Correct answer)
- Creates a button that submits the form
- Displays an action menu
- Invokes a flow from a Visualforce page
Correct answer: Defines a JavaScript function that calls a controller action remotely
<apex:actionFunction> creates a JavaScript function that can invoke a controller method via AJAX from client-side JavaScript.
Question 5: Which attribute on <apex:commandButton> specifies which panel(s) to refresh after the action completes?
- refresh
- reRender (Correct answer)
- update
- target
Correct answer: reRender
The reRender attribute specifies the id(s) of components to refresh via AJAX after the button's action executes.
Question 6: Which Visualforce component allows you to include another Visualforce page within the current page?
- <apex:include> (Correct answer)
- <apex:insert>
- <apex:composition>
- <apex:embed>
Correct answer: <apex:include>
<apex:include> embeds the output of another Visualforce page into the current page at render time.
Question 7: What is the view state size limit for a Visualforce page?
- 64 KB
- 128 KB
- 170 KB (Correct answer)
- 256 KB
Correct answer: 170 KB
Visualforce pages have a maximum view state size of 170 KB, which stores the state of the page between requests.
Which component renders an input field appropriate for the data type of a Salesforce field?