Visualforce interview questions usually test more than tag names. A Salesforce developer is expected to understand where Visualforce is still used, how controllers work, how data binding happens, how View State affects performance, and how a Visualforce page behaves in Lightning Experience.
As part of Salesforce Interview questions, this page lists practical Visualforce interview questions with direct answers. Use it to revise concepts, prepare short spoken answers, and identify the topics that need hands-on practice before an interview.

Visualforce is the Markup Language (Tag based language) similar to HTML and XML which was developed by Salesforce.com. It contains tags and controllers where tags are also called as Components. Visualforce uses XML like syntax to create front-end design pages and it uses Apex as the backend to implement business logic.
For new Salesforce custom UI development, interviewers may also compare Visualforce with Lightning Web Components. A safe answer is that Visualforce is still used in many existing Salesforce orgs and supported platform areas, while Lightning Web Components are the preferred approach for most new custom UI work.
Salesforce Visualforce Interview Questions and Answers
What is Visualforce in Salesforce?
Visualforce is a framework used to build custom user interfaces on the Salesforce platform. A Visualforce page is written with Visualforce markup, HTML, CSS, JavaScript, and Salesforce components inside an <apex:page> tag. The page can use a standard controller, a custom Apex controller, or a controller extension for data access and business logic.
<apex:page standardController="Account">
<apex:pageBlock title="Account Details">
<apex:outputField value="{!Account.Name}" />
</apex:pageBlock>
</apex:page>
Is Visualforce still used in Salesforce interviews?
Yes. Visualforce is still asked in Salesforce interviews, especially for roles that support existing Salesforce implementations, Salesforce Classic pages, custom buttons, email templates, PDF rendering, managed packages, and older Service Cloud or community customizations. For new UI work, you should also be ready to explain when Lightning Web Components are a better option.
Different Force.com User Interface Technologies?
- Page layouts and Lightning App Builder: UI is configured declaratively and is suitable for standard record pages, home pages, and app pages.
- Visualforce: UI is written by the developer using Visualforce markup and Apex controllers. It gives fine control over page structure and server-side behavior.
- Lightning Components and Lightning Web Components: Component-based UI technologies used for modern Salesforce experiences.
Where can a Visualforce page be used in Salesforce?
Salesforce developers can use Visualforce pages for custom tabs, standard button overrides, custom buttons or links, embedded page sections, dashboard components, Visualforce email templates, PDF pages, and pages exposed through Experience Cloud or older Salesforce mobile use cases, depending on org configuration and supported features.
What are the main benefits of Visualforce?
Visualforce gives developers page-level control, access to Apex business logic, support for standard and custom controllers, reusable custom components, server-side rendering, PDF rendering through renderAs="pdf", and integration with HTML, CSS, and JavaScript. It is also important for maintaining older Salesforce applications.
What are the two primary parts of a Visualforce page?
A Visualforce page has two primary parts: Visualforce markup and a controller. The markup defines the user interface. The controller controls data access, user actions, navigation, and business logic.
How to write a comment on the Visualforce page?
Visualforce markup can use normal HTML-style comments. The correct syntax is:
<!-- This is a Visualforce comment -->
A common interview mistake is to write <! this is a comment>, which is not the normal Visualforce or HTML comment format.
Different Visualforce controllers explain them in brief?
Visualforce controllers are commonly discussed in three groups:
- Standard controller: Provided by Salesforce for standard and custom objects. It gives access to built-in actions such as save, edit, delete, cancel, and view.
- Custom controller: An Apex class written by a developer when the page needs fully custom logic or data that is not handled by a standard controller.
- Controller extension: An Apex class that extends a standard or custom controller. It is used when you want to keep standard behavior and add or override selected actions.
What is a standard controller in Visualforce?
A standard controller is a built-in controller for an sObject such as Account, Contact, Case, or a custom object. It provides default record operations and makes it easy to display, edit, and save one record without writing a complete Apex controller.
<apex:page standardController="Contact">
<apex:form>
<apex:pageBlock title="Edit Contact">
<apex:inputField value="{!Contact.LastName}" />
<apex:commandButton action="{!save}" value="Save" />
</apex:pageBlock>
</apex:form>
</apex:page>
What is a custom controller in Visualforce?
A custom controller is an Apex class that controls a Visualforce page without relying on the standard controller for an object. Use it when the page needs custom queries, custom navigation, multiple objects, external callouts, or business logic that does not map cleanly to a single record.
public with sharing class AccountListController {
public List<Account> accounts { get; private set; }
public AccountListController() {
accounts = [
SELECT Id, Name
FROM Account
ORDER BY Name
LIMIT 10
];
}
}
What is a controller extension in Visualforce?
A controller extension is an Apex class that adds behavior to an existing standard or custom controller. It has a constructor that accepts the controller instance. In interviews, explain that an extension is useful when you want the standard controller’s default save, edit, and data behavior, plus extra custom methods.
public with sharing class AccountExtension {
private ApexPages.StandardController controller;
public AccountExtension(ApexPages.StandardController controller) {
this.controller = controller;
}
public PageReference saveAndReturn() {
controller.save();
return new PageReference('/001/o');
}
}
What is the difference between controller and extension in Visualforce?
A controller is the main class or standard object controller used by the page. A page can have one main controller. An extension adds extra behavior to that controller and cannot be used alone without a controller. A common answer is: use a custom controller for fully custom behavior; use an extension when you want to keep standard controller behavior and add custom logic.
Explain expressions and data binding in Visualforce?
In Visualforce, dynamic values are added using expression syntax such as {!Account.Name}. These expressions bind page components to controller properties, object fields, action methods, global variables, and formulas. When the page is rendered or submitted, Visualforce evaluates these expressions and connects the UI with Salesforce data or Apex logic.
<apex:outputText value="{!$User.FirstName}" />
<apex:commandButton value="Save" action="{!save}" />
What are Visualforce global variables?
Global variables are predefined variables that can be used in Visualforce expressions. They start with $ and provide access to information such as the current user, organization, labels, resources, actions, pages, and request parameters.
{!$User.FirstName}gives the current user’s first name.{!$Organization.Name}gives the organization name.{!$CurrentPage.parameters.id}can be used to read a page parameter.{!$Resource.MyResource}can refer to a static resource.
Explain Visualforce versioning?
Visualforce pages and components are versioned. The version controls the behavior and available features for that page or component. Older pages do not automatically change behavior only because a newer Salesforce release is available. In an interview, mention that versioning helps preserve backward compatibility, but old page versions should still be reviewed during maintenance.
Explain Visualforce namespace?
Standard Visualforce tags use the apex namespace, such as <apex:page> and <apex:form>. Custom components commonly use the c namespace, such as <c:customComponent>. In a managed package, a registered namespace can be used instead of c.
<apex:page>
<c:accountSummary accountId="{!Account.Id}" />
</apex:page>
How to enable Visualforce Development Mode?
In older Salesforce setups, Development Mode could be enabled from personal settings so that a developer could edit Visualforce pages more directly. In current Salesforce orgs, most developers create and edit Visualforce pages from Setup, Developer Console, Salesforce Extensions for Visual Studio Code, or metadata deployment tools. If an interviewer asks this question, explain the older navigation and then mention the current development options.
Older navigation: Setup | My Personal Information | Personal Information | Edit | Development Mode | Save.
Different ways to create Visualforce pages?
- Create a page from Salesforce Setup by searching for Visualforce Pages.
- Create a page from Developer Console.
- Create and deploy Visualforce metadata using Salesforce CLI or an IDE.
- Use the URL shortcut
/apex/PageNamein some development workflows when the org allows page creation prompts. - Check different ways to create Visualforce pages.
What is View State in Visualforce?
View State is the serialized state of a Visualforce page, including component state and controller state that must be preserved between requests. Large View State can slow page performance and can cause limits-related errors. To reduce View State, avoid storing unnecessary large lists in controller properties, use transient for values that do not need to persist, and query only the fields needed by the page.
Which API is used to design a Visualforce page?
Visualforce pages are written using Visualforce markup, which is part of the Salesforce platform. The page can use Apex controllers to access data and implement logic. In a broader tooling context, Visualforce page metadata can be retrieved and deployed using Salesforce metadata tools.
What is the difference between actionSupport and actionFunction?
<apex:actionSupport> adds AJAX behavior to another Visualforce component based on an event, such as onclick or onchange. <apex:actionFunction> defines a JavaScript function that can call a controller action from JavaScript. Use actionSupport when the event belongs to a Visualforce component; use actionFunction when JavaScript needs to trigger the controller action.
What is actionRegion in Visualforce?
<apex:actionRegion> defines the part of a Visualforce page that is processed during an AJAX request. It is useful when a page has multiple input sections and only one section should be submitted or validated for a particular action.
What is the difference between apex:include and apex:insert?
<apex:include> includes another Visualforce page inside the current page. <apex:insert> is used with Visualforce composition templates to insert content into a named placeholder defined by <apex:define>. Interviewers ask this to check whether you understand page reuse and template composition.
How do you use a static resource in a Visualforce page?
Upload the file as a Static Resource in Salesforce and reference it with the $Resource global variable. Static resources are commonly used for CSS files, JavaScript files, images, and zipped asset bundles.
<apex:stylesheet value="{!URLFOR($Resource.SiteAssets, 'css/styles.css')}" />
<apex:image url="{!URLFOR($Resource.SiteAssets, 'images/logo.png')}" />
What is a remote action in Visualforce?
A remote action is an Apex method that can be called from JavaScript on a Visualforce page using JavaScript remoting. It is marked with @RemoteAction and is commonly used when the page needs lightweight asynchronous calls without rerendering Visualforce components.
How many records can we show in apex:pageBlockTable?
A <apex:pageBlockTable> can render records returned by the controller, but the practical number should be kept reasonable for performance, View State, and browser usability. For large datasets, use pagination with ApexPages.StandardSetController, filters, or server-side queries instead of trying to display all records at once.
What is the difference between relatedList, enhancedList, and detail in Visualforce?
<apex:relatedList> displays a related list for the current record. <apex:enhancedList> displays a list view-like table for an object. <apex:detail> displays a standard record detail section. These components are useful when a page needs standard Salesforce UI sections without rebuilding them manually.
What is AJAX in Visualforce and where is it used?
AJAX in Visualforce lets a page communicate with the server and update part of the page without a full page reload. It is commonly used with reRender, actionSupport, actionFunction, and actionStatus. A practical scenario is updating a dependent section when the user changes a picklist value.
What is the use of jQuery in Visualforce?
jQuery can be used in Visualforce for DOM manipulation, client-side validation, UI effects, and calling JavaScript remoting methods. In interviews, also mention that any external JavaScript library should be added carefully through Static Resources, and client-side logic should not replace server-side security checks.
What are S-Controls and how are they different from Visualforce?
S-Controls were an older Salesforce customization technology based mainly on HTML and JavaScript. Visualforce replaced S-Controls for custom UI development by providing a component-based markup framework and Apex controller support. For modern work, Lightning Web Components are generally preferred for new custom UI.
Can I pass parameters from a Visualforce page to an Apex method?
Yes. You can pass values through component attributes, <apex:param>, page parameters, form inputs bound to controller properties, or JavaScript remoting parameters. The right approach depends on whether the value is submitted through Visualforce components, JavaScript, or URL navigation.
<apex:commandLink action="{!selectRecord}" value="Select">
<apex:param name="recordId" value="{!acc.Id}" assignTo="{!selectedId}" />
</apex:commandLink>
How do you refer to the current page id in Visualforce?
You can read the current page parameter using $CurrentPage.parameters in markup or ApexPages.currentPage().getParameters() in Apex.
{!$CurrentPage.parameters.id}
String recordId = ApexPages.currentPage().getParameters().get('id');
What is $Action in Visualforce?
$Action is a global variable used to reference standard Salesforce actions such as view, edit, delete, and new. It is often used with URLFOR() to generate URLs for standard actions.
<apex:outputLink value="{!URLFOR($Action.Account.Edit, Account.Id)}">
Edit Account
</apex:outputLink>
How do you pass parameters from one Visualforce page to another?
You can pass parameters by adding them to a PageReference in Apex or by using URL parameters in links. The receiving page can read them from ApexPages.currentPage().getParameters().
PageReference pageRef = Page.SecondPage;
pageRef.getParameters().put('id', accountId);
return pageRef;
What are custom components in Visualforce?
Custom components are reusable Visualforce components created by developers. They are useful when the same UI block or behavior must be used on multiple pages. A custom component can also have an Apex component controller for custom logic.
How do you make a Visualforce page available for Salesforce mobile?
A Visualforce page can be exposed in Salesforce mobile experiences when the page and its tab, action, or navigation entry are configured appropriately. The page should be tested on mobile screen sizes, avoid desktop-only assumptions, and use responsive HTML and CSS where possible.
How do you embed Google Maps in Visualforce?
A Visualforce page can embed a map using supported JavaScript APIs, an iframe where allowed, or a Lightning-compatible approach depending on security settings. In an interview, focus on secure handling of API keys, Content Security Policy, Static Resources, and avoiding hard-coded sensitive values in page markup.
How to implement autocomplete lookup in Visualforce?
Autocomplete lookup can be implemented by using an input field, JavaScript, and a controller method that searches matching records as the user types. For older Visualforce pages, JavaScript remoting was commonly used. For new implementations, also consider whether a Lightning component is more suitable.
Visualforce Scenario-Based Interview Questions
A Visualforce page is slow. What would you check first?
Check View State size, SOQL queries, number of rendered components, large collections stored in controller properties, repeated database calls from getter methods, unnecessary rerendering, and client-side resources. A strong answer also mentions testing with realistic data volume and using pagination for large tables.
A user can see data on a Visualforce page that should be hidden. What could be wrong?
The custom controller may be running in system context without enforcing sharing and field-level security. Review whether the Apex class uses with sharing, whether object and field permissions are checked, and whether the query exposes fields that the user should not see.
When would you choose Visualforce instead of Lightning Web Components?
Visualforce may be chosen when maintaining an existing page, supporting a managed package that already uses Visualforce, generating a simple PDF, or working in an area where a Visualforce customization already exists. For most new interactive UI work, be prepared to discuss Lightning Web Components as the preferred modern option.
FAQs on Salesforce Visualforce Interview Questions
Is Visualforce still used in Salesforce?
Yes, Visualforce is still used in many Salesforce orgs, especially for existing custom pages, managed packages, PDF pages, older integrations, and custom UI areas built before Lightning components became common. New UI work is usually evaluated against Lightning Web Components first.
What should I revise first for a Visualforce interview?
Start with page structure, standard controllers, custom controllers, controller extensions, data binding, global variables, View State, Static Resources, AJAX components, and security behavior in Apex controllers.
Are Visualforce controllers written in Apex?
Custom controllers and controller extensions are written in Apex. Standard controllers are provided by Salesforce for standard and custom objects and can be used without writing a full Apex class.
What is the hardest Visualforce topic for interviews?
Scenario questions on View State, controller security, custom controller design, and performance are usually harder than syntax questions. Interviewers often ask how you would fix a slow page or prevent unauthorized data exposure.
Should I learn Visualforce or Lightning Web Components for Salesforce jobs?
Learn Lightning Web Components for most new Salesforce UI development, but keep Visualforce fundamentals clear if the role involves maintenance, migrations, managed packages, or older Salesforce implementations.
QA Checklist for Salesforce Visualforce Interview Questions Page
- Visualforce is explained as a Salesforce UI framework with markup and controller logic.
- Answers distinguish standard controllers, custom controllers, and controller extensions clearly.
- Questions cover practical interview areas such as View State, AJAX, Static Resources, parameters, and global variables.
- Security notes mention sharing, field access, and avoiding accidental data exposure in custom controllers.
- The page addresses whether Visualforce is still used and how it compares with Lightning Web Components.
- Code examples use Visualforce markup or Apex-style snippets only where they clarify the answer.
- FAQs stay specific to Salesforce Visualforce interview preparation.
Final Preparation Notes for Salesforce Visualforce Interview Questions
For Visualforce interviews, do not stop at memorizing tag names. Practice writing a basic page with a standard controller, a custom controller, and a controller extension. Be ready to explain View State, parameter passing, Static Resources, AJAX behavior, custom components, and the security effect of Apex controller code. These topics give interviewers a better view of how you would maintain or improve real Visualforce pages in Salesforce.
TutorialKart.com