Plat-Dev-301 practice question 5 of 10
A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that users encounter "View State" errors when using it in production. What should the developer ensure to correct these errors?
Full set: 160 questionsA "View State" error occurs when the data stored in a Visualforce page's state exceeds the 170KB limit. This state includes controller properties and component trees needed to maintain the page's state between server requests. The transient keyword is the specific Apex feature designed to solve this. By declaring a variable as transient, a developer instructs the platform to exclude it from the view state, thus reducing its size. This is appropriate for variables that are not needed across postbacks or can be easily reconstructed.
A. Profile access issues would result in an "Insufficient Privileges" error, not a View State error.
B. The private access modifier controls code visibility, but does not prevent a variable from being included in the view state if it's accessed by the page.
D. Exceeding governor limits, such as the number of SOQL queries, results in a LimitException, which is a different error from a View State size error.
1. Visualforce Developer Guide, "Understanding Visualforce View State", Section: "Best Practices for Reducing View State". The guide explicitly states, "Use the transient keyword for variables that are not essential for maintaining the page’s state and can be reconstructed."
2. Apex Developer Guide, "Using the transient Keyword". This section details how the keyword prevents fields from being saved as part of the view state.
Keep practicing
Take the free Plat-Dev-301 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-301 practice questions
- Question 1Which use case can be performed only by using asynchronous Apex?
- Question 2The Account object has a field, Audit_Code__c, that is used to specify what type of audit…
- Question 3How should a developer verify that a specific Account record is being tested in a test cl…
- Question 4There is an Apex controller and a Visualforce page in an org that displays records with a…
- Question 6Refer to the code below: Lightning Web Component JS file JavaScript import {LightningElem…
- Question 7A developer is developing a reusable Aura component that will reside on an sObject Lightn…
