DEV-401: Building Applications with Force.com and Visualforce Exam

If you’re preparing to become a Salesforce developer, the DEV-401: Building Applications with Force.com and Visualforce exam is a critical step to validate your skills. This exam tests your ability to design, develop, and deploy custom applications on the Salesforce platform using Force.com and Visualforce technologies.

What Is the DEV-401 Exam?

The DEV-401 exam is designed for professionals aiming to demonstrate their expertise in building business applications on Salesforce’s Force.com platform. It focuses on practical skills such as creating custom user interfaces with Visualforce, writing Apex code, and implementing business logic through triggers and controllers.

Successfully passing this exam proves that you understand the core components of the Salesforce development environment, including Visualforce pages, Apex programming, data modeling, and application security.

What Will You Learn from DEV-401?

Studying for the DEV-401 exam equips you with essential skills, including:

  • Visualforce Page Design: Learn how to create dynamic and interactive pages using Visualforce components such as <apex:form>, <apex:commandLink>, and <apex:repeat>. Understand how to leverage standard controllers, custom controllers, and controller extensions for managing data and user interaction.

  • Apex Programming Fundamentals: Master writing efficient Apex code with an emphasis on best practices like bulkification, governor limits, and exception handling. Gain proficiency in trigger development for automating business processes.

  • Security and Access Controls: Understand how Salesforce enforces CRUD (Create, Read, Update, Delete) and Field-Level Security (FLS) through standard controllers and Apex, ensuring your applications respect user permissions.

  • Asynchronous Processing: Explore techniques like Batch Apex and future methods to handle large data volumes and long-running operations efficiently.

  • Integration with Lightning Components: Learn about Lightning Out and how to embed Lightning components into Visualforce pages, bridging classic and modern Salesforce development.

  • Testing and Debugging: Discover how to write robust test classes with Test.startTest() and Test.stopTest(), verify exception handling, and maintain high code quality.

Key Topics Covered in the DEV-401 Exam

The exam covers a wide range of topics essential for Salesforce developers:

  1. Visualforce Fundamentals: Using components, creating forms, data tables, conditional rendering, and working with view state optimization.

  2. Apex Basics: Writing triggers, batch Apex, using context variables, handling governor limits, and dynamic SOQL queries.

  3. Security Model: Enforcing sharing rules, CRUD, and FLS in code.

  4. User Interface and Data Binding: Passing parameters from Visualforce to Apex, using apex:param, and managing page navigation.

  5. Error Handling: Utilizing ApexPages.addMessage(), try-catch blocks, and testing exceptions.

  6. Integration and Asynchronous Processing: Calling Apex from Lightning components using @AuraEnabled and managing async operations.

Why Choose Exam Sage for Your DEV-401 Exam Preparation?

At ExamSage.com, we specialize in providing carefully curated practice exams and study materials tailored for Salesforce certifications like DEV-401. Our resources are crafted by industry experts to reflect the latest exam format and real-world scenarios.

  • Comprehensive Question Banks: Gain access to hundreds of high-quality, up-to-date multiple-choice questions with detailed explanations covering all exam topics.

  • Realistic Practice Tests: Simulate actual exam conditions to build confidence and improve your time management skills.

  • Clear Explanations: Understand the reasoning behind every answer to deepen your knowledge.

  • Regular Updates: Stay current with Salesforce platform changes and exam updates.

Whether you are a beginner or an experienced developer, Exam Sage’s DEV-401 practice tests help you identify knowledge gaps and strengthen your understanding, making your certification journey smoother.

Final Thoughts

The DEV-401: Building Applications with Force.com and Visualforce exam is a valuable credential for Salesforce developers seeking to validate their application development skills. By mastering Visualforce, Apex, and Salesforce’s security model, you’ll be well-equipped to build powerful custom business applications.

Preparing with trusted resources like Exam Sage’s practice exams ensures you are ready to pass the DEV-401 exam confidently and advance your Salesforce career.

Sample Questions And Answers

1. What is the primary purpose of a Visualforce page?
A) To write Apex code
B) To create custom user interfaces on the Force.com platform
C) To manage data in Salesforce
D) To deploy metadata

Answer: B
Explanation: Visualforce pages are used to create custom user interfaces that can be tightly integrated with Salesforce data and business logic.


2. Which tag is used to create a form on a Visualforce page?
A) <apex:page>
B) <apex:form>
C) <apex:input>
D) <apex:commandButton>

Answer: B
Explanation: <apex:form> is the Visualforce tag that creates a form to submit data back to the server.


3. How do you bind a Visualforce page component to a controller property?
A) Using {!propertyName} syntax
B) Using #propertyName syntax
C) Using $propertyName syntax
D) Using @propertyName syntax

Answer: A
Explanation: Visualforce uses the expression syntax {!propertyName} to bind page components to controller variables or methods.


4. Which controller type allows you to add custom logic to a Visualforce page?
A) Standard Controller
B) Custom Controller
C) Standard Set Controller
D) Both B and C

Answer: D
Explanation: Custom controllers and extensions (Standard Set Controller) enable custom logic beyond standard Salesforce actions.


5. What is the default access modifier for an Apex class?
A) public
B) private
C) global
D) protected

Answer: B
Explanation: Apex classes are private by default and only accessible within the same namespace unless explicitly declared public or global.


6. Which attribute in <apex:page> defines the standard controller for the page?
A) controller
B) standardController
C) extensions
D) recordSetVar

Answer: B
Explanation: The standardController attribute specifies the standard Salesforce object controller to use on the page.


7. What is the purpose of the extensions attribute in <apex:page>?
A) To include JavaScript libraries
B) To add additional custom controllers to a page
C) To set page styles
D) To define page permissions

Answer: B
Explanation: extensions allow adding custom logic on top of a standard controller by linking Apex classes.


8. Which method must be implemented in a class used as a standard set controller extension?
A) start()
B) getSelected()
C) No specific method required, but must have a constructor accepting StandardSetController
D) execute()

Answer: C
Explanation: The extension class must have a constructor that accepts a StandardSetController instance to interact with multiple records.


9. What is the maximum number of records a StandardSetController can handle at once?
A) 50
B) 200
C) 1000
D) 2000

Answer: D
Explanation: StandardSetController can manage up to 2,000 records in a batch.


10. Which Visualforce component displays a list of records from the controller?
A) <apex:pageBlockTable>
B) <apex:dataTable>
C) <apex:repeat>
D) All of the above

Answer: D
Explanation: All these components can be used to display lists, but <apex:pageBlockTable> provides Salesforce styled tables.


11. How can you include a CSS style sheet in a Visualforce page?
A) Using <style> tag inside <apex:page>
B) Using <apex:stylesheet>
C) Using <apex:includeScript>
D) Using <apex:page stylesheets="true">

Answer: B
Explanation: <apex:stylesheet> is used to include external CSS files in Visualforce pages.


12. What does the action attribute in <apex:commandButton> do?
A) Specifies the URL to navigate to
B) Calls a controller method when the button is clicked
C) Defines the button label
D) Sets the button’s style

Answer: B
Explanation: The action attribute calls an Apex method in the controller when the button is clicked.


13. How do you perform navigation to another Visualforce page from Apex controller?
A) PageReference and return it from an action method
B) redirect() method
C) navigateTo() function
D) Using JavaScript window.location

Answer: A
Explanation: Returning a PageReference object from an action method triggers navigation in Visualforce.


14. What is the governor limit on the number of SOQL queries per transaction?
A) 50
B) 100
C) 150
D) 200

Answer: D
Explanation: Apex transactions can execute up to 100 SOQL queries (200 in newer API versions).


15. Which annotation allows a method to be called from a Visualforce page via JavaScript remoting?
A) @RemoteAction
B) @WebService
C) @AuraEnabled
D) @TestVisible

Answer: A
Explanation: @RemoteAction exposes Apex methods for JavaScript remoting.


16. Which of the following is a correct way to handle exceptions in Apex?
A) Using try-catch blocks
B) Using throws keyword
C) Using if-else statements
D) Using handleException() method

Answer: A
Explanation: Apex uses try-catch blocks to handle exceptions.


17. Which Visualforce tag allows adding JavaScript code?
A) <apex:script>
B) <script>
C) <apex:includeScript>
D) Both B and C

Answer: D
Explanation: You can use standard <script> or <apex:includeScript> to add JavaScript.


18. What is the difference between a custom controller and a controller extension?
A) Custom controller completely replaces standard functionality; extensions add to it
B) Extensions replace the controller; custom controllers add to it
C) No difference
D) Extensions are for Lightning only

Answer: A
Explanation: Custom controllers provide full custom logic, while extensions add functionality on top of standard controllers.


19. Which of the following statements about Visualforce components is TRUE?
A) Components can be reused across multiple Visualforce pages
B) Components can contain other components
C) Components are packaged as part of managed packages
D) All of the above

Answer: D
Explanation: Visualforce components are reusable, composable, and packageable.


20. How do you access the current user’s ID in Apex?
A) User.getId()
B) UserInfo.getUserId()
C) System.UserId
D) CurrentUser.Id

Answer: B
Explanation: The UserInfo.getUserId() method returns the current user’s Salesforce ID.


21. Which of these Visualforce components is used to display data in a scrollable table?
A) <apex:dataTable>
B) <apex:pageBlockTable>
C) <apex:pageBlockSection>
D) <apex:datatableScroll>

Answer: A
Explanation: <apex:dataTable> can be styled to be scrollable; <apex:pageBlockTable> is a styled table without built-in scrolling.


22. How does Salesforce enforce sharing rules when using a standard controller?
A) Sharing rules are always enforced
B) Sharing rules are never enforced
C) Depends on the with sharing keyword in Apex class
D) Depends on profile settings only

Answer: C
Explanation: Apex class declared with sharing enforces sharing rules; standard controllers follow system-level sharing.


23. What is the limit of Visualforce view state size?
A) 100KB
B) 135KB
C) 170KB
D) 200KB

Answer: B
Explanation: Visualforce view state size limit is 135KB to ensure efficient server communication.


24. Which attribute in <apex:inputField> automatically respects field-level security?
A) field
B) value
C) required
D) None

Answer: B
Explanation: <apex:inputField> bound to an SObject field automatically respects field-level security.


25. What happens if a Visualforce page uses a controller without with sharing?
A) It ignores org sharing rules and runs in system context
B) It enforces sharing rules automatically
C) It causes a compilation error
D) It runs with user profile permissions only

Answer: A
Explanation: Apex classes without with sharing run in system context ignoring sharing rules.


26. What is the purpose of the <apex:variable> tag?
A) To declare variables that can be used within Visualforce markup
B) To declare Apex variables
C) To create global variables accessible across pages
D) To store user session data

Answer: A
Explanation: <apex:variable> allows temporary variables within Visualforce markup for iteration or calculations.


27. Which method is used to add records to a list in Apex?
A) .insert()
B) .add()
C) .append()
D) .push()

Answer: B
Explanation: The .add() method is used to add elements to Apex Lists.


28. How do you make a Visualforce page accessible to users?
A) Add the page to a public site
B) Set page access permissions in the profile or permission sets
C) Publish the page as a web service
D) Assign page ownership

Answer: B
Explanation: Page accessibility is controlled via user profiles and permission sets.


29. What is the use of the <apex:outputPanel> component?
A) To conditionally render sections of a Visualforce page
B) To display images
C) To handle user input
D) To execute Apex code

Answer: A
Explanation: <apex:outputPanel> can group content and be used for conditional rendering or partial page refresh.


30. Which tool can you use to debug Visualforce pages and Apex code?
A) Developer Console
B) Salesforce Inspector
C) Visual Studio Code with Salesforce Extensions
D) All of the above

Answer: D
Explanation: All these tools are commonly used for debugging Salesforce development.

31. Which Apex keyword enforces that a class respects the current user’s sharing rules?
A) global
B) with sharing
C) without sharing
D) public

Answer: B
Explanation: with sharing ensures the Apex class enforces sharing rules for the current user.


32. What is the purpose of the rendered attribute in Visualforce components?
A) To make a component editable
B) To control whether the component is displayed based on a condition
C) To bind data to the component
D) To set the component’s style

Answer: B
Explanation: The rendered attribute conditionally displays the component based on a Boolean expression.


33. Which Apex data type is used to hold a collection of unique values?
A) List
B) Map
C) Set
D) Array

Answer: C
Explanation: A Set is a collection that stores unique values without duplicates.


34. How do you call a controller method asynchronously from a Visualforce page?
A) Using @future annotation and JavaScript remoting
B) Using <apex:commandButton> with immediate="true"
C) Using setTimeout in JavaScript
D) Using Apex batch class

Answer: A
Explanation: @future methods are used for asynchronous Apex calls, and JavaScript remoting can invoke them from Visualforce.


35. Which Visualforce tag allows you to create reusable UI components?
A) <apex:component>
B) <apex:page>
C) <apex:include>
D) <apex:template>

Answer: A
Explanation: <apex:component> defines a reusable Visualforce component.


36. What is a key benefit of using controller extensions?
A) They can override standard controllers entirely
B) They enable code reuse by extending existing controllers
C) They are required for every Visualforce page
D) They automatically generate SOQL queries

Answer: B
Explanation: Controller extensions add functionality while reusing the existing standard controller behavior.


37. How can you prevent users from seeing fields they don’t have permission to view on a Visualforce page?
A) Manually hide fields using CSS
B) Use <apex:inputField> or <apex:outputField> which respect field-level security
C) Remove the fields from the page layout
D) Use JavaScript to hide fields

Answer: B
Explanation: <apex:inputField> and <apex:outputField> respect Salesforce field-level security automatically.


38. How do you define a constructor in an Apex class?
A) A method with the same name as the class and no return type
B) A method named construct()
C) A method with the same name as the class and returning void
D) Any public method

Answer: A
Explanation: Apex constructors have the same name as the class and no return type.


39. What will happen if you call Database.rollback() inside a try block?
A) The entire transaction is rolled back
B) Only partial data is deleted
C) The rollback fails silently
D) No rollback occurs

Answer: A
Explanation: Calling Database.rollback() undoes all database changes in the transaction.


40. Which Visualforce component should you use for multi-record editing?
A) <apex:repeat>
B) <apex:dataTable>
C) <apex:pageBlockTable>
D) <apex:inputField>

Answer: C
Explanation: <apex:pageBlockTable> is ideal for editing multiple records simultaneously.


41. What is the role of the get and set keywords in Apex properties?
A) To define database triggers
B) To declare getters and setters for variables
C) To execute SOQL queries
D) To define Visualforce tags

Answer: B
Explanation: get and set provide accessors for Apex properties.


42. How can you pass parameters from a Visualforce page to an Apex controller method?
A) Using URL query strings only
B) Using actionFunction or actionSupport components
C) Using global variables
D) Parameters cannot be passed

Answer: B
Explanation: <apex:actionFunction> and <apex:actionSupport> allow parameter passing to controller methods.


43. Which of the following is TRUE about Governor Limits?
A) They are Salesforce’s way to ensure fair resource use across tenants
B) They can be ignored if you are using a paid org
C) They only apply to API calls
D) They reset every 24 hours

Answer: A
Explanation: Governor Limits prevent any one tenant from monopolizing shared resources on the multi-tenant Salesforce platform.


44. What is the purpose of the view state in Visualforce?
A) To store the user’s browser cookies
B) To maintain the page state (component tree, controller data) between requests
C) To hold temporary JavaScript variables
D) To cache static resources

Answer: B
Explanation: View state maintains component and controller state between server round trips.


45. What Apex feature allows you to run code in a batch asynchronously?
A) Batch Apex
B) Queueable Apex
C) Future Methods
D) All of the above

Answer: D
Explanation: All are asynchronous Apex mechanisms, but Batch Apex is designed for large data volumes.


46. How do you execute a SOQL query to avoid hitting the query limit in Apex?
A) Use a loop with individual queries
B) Use a single query with filters and relationship queries where possible
C) Query inside for loops
D) Use multiple queries in try-catch blocks

Answer: B
Explanation: Efficient SOQL queries minimize the number of queries executed to stay within limits.


47. How do you prevent users from editing a Visualforce page?
A) Remove the Visualforce page from their profile or permission set
B) Use readOnly="true" in <apex:page>
C) Use rendered="false" on the entire page
D) Both A and B

Answer: D
Explanation: Permissions control access, and readOnly="true" disables editing on the page.


48. Which tag is used to include a static resource like a JavaScript file in Visualforce?
A) <apex:script>
B) <apex:includeScript>
C) <script src>
D) <apex:staticResource>

Answer: B
Explanation: <apex:includeScript> is used to include JavaScript static resources.


49. What is the maximum number of characters allowed in an Apex method name?
A) 40
B) 255
C) 100
D) 30

Answer: B
Explanation: Apex method names can be up to 255 characters.


50. What type of Apex class is used for creating web services?
A) global classes with @RestResource or @WebService annotations
B) public classes only
C) with sharing classes only
D) abstract classes

Answer: A
Explanation: global visibility and annotations like @RestResource or @WebService expose Apex classes as web services.


51. How do you call an Apex method from JavaScript in Visualforce?
A) Using window.Apex.methodName()
B) Using JavaScript Remoting (@RemoteAction)
C) Calling directly by method name
D) Not possible

Answer: B
Explanation: JavaScript Remoting allows Apex methods marked with @RemoteAction to be called from JavaScript.


52. Which Visualforce tag is best for grouping components to apply conditional rendering?
A) <apex:panelGroup>
B) <div>
C) <apex:outputPanel>
D) <span>

Answer: C
Explanation: <apex:outputPanel> supports conditional rendering and partial page refresh.


53. How can you limit the number of records returned in a SOQL query?
A) Use LIMIT keyword in SOQL
B) Use OFFSET keyword
C) Use WHERE clause only
D) Use TOP keyword

Answer: A
Explanation: LIMIT restricts the number of records returned.


54. What is the difference between <apex:repeat> and <apex:dataTable>?
A) <apex:repeat> renders simple lists, <apex:dataTable> renders tables with columns
B) <apex:repeat> is for forms only
C) <apex:dataTable> cannot display collections
D) None

Answer: A
Explanation: <apex:repeat> repeats content; <apex:dataTable> builds formatted tables.


55. How do you make a Visualforce page available to a Salesforce community?
A) Add the page to the community builder and configure access
B) Assign the page to profiles manually
C) Publish the page as a Lightning component
D) Not possible

Answer: A
Explanation: Visualforce pages can be added to communities via builder and permission setup.


56. What type of test coverage is required before deploying Apex code to production?
A) 100% code coverage
B) 75% code coverage
C) 50% code coverage
D) No requirement

Answer: B
Explanation: Salesforce requires at least 75% Apex test coverage before deployment.


57. What happens if a Visualforce page uses immediate="true" on a command button?
A) Skips validation rules before action method executes
B) Executes the action after validation
C) Prevents the action from executing
D) Runs asynchronously

Answer: A
Explanation: immediate="true" skips validations during the request.


58. Which Visualforce component is ideal for inline editing of records?
A) <apex:inputField>
B) <apex:inlineEditSupport>
C) <apex:dataTable>
D) <apex:outputText>

Answer: B
Explanation: <apex:inlineEditSupport> adds inline editing capabilities to components.


59. What is a benefit of using transient variables in Apex controllers?
A) They are not saved in view state, reducing page size
B) They improve query speed
C) They are stored in the database temporarily
D) They are globally accessible

Answer: A
Explanation: transient variables are not serialized in the view state, reducing its size.


60. How can you refresh a portion of a Visualforce page after an action?
A) Use rerender attribute on <apex:commandButton> or <apex:actionFunction>
B) Use refresh() in JavaScript
C) Use window.location.reload()
D) Refresh is not possible without reloading the whole page

Answer: A
Explanation: The rerender attribute allows partial page updates after actions.