Visual Force Interview Questions

Visual Force

1.       What are expressions used in pages  to bind in controllers?
Using methods we can bind.
Getter:Will return value from controller to vf page
Setter:Will pass value from vf page to controller
Action:Will redirect to another page.
2.       What is the purpose of controllers?
Controllers provide the data and actions that are available to a Visualforce page.
3.       Which objects have associated standard controllers?
All standard and custom objects that can be accessed via the API have associated controllers
4.       What is included with each standard controller?
Data: the fields for the associated object record that are API accessible, including the related records (5 up/1 down).  Actions: save, delete, view, edit, cancel.
5.       When do you need to go beyond a standard controller and code custom Apex?
If you need data beyond the limits of what is available in the standard controller or actions that go beyond the provided standard actions.
6.       Compare and contrast custom controllers and controller extensions.  How are they the same?  How are they different?
Both allow for custom code to be used, allowing for custom data sets and custom actions.  Extensions leverage the existing data and actions within a standard or custom controller.  Custom controllers must contain all data and actions that need to be executed by the page.  Extensions that extend standard controller allow for the pages which use those extensions to be used in custom buttons, standard button overrides, and over declarative features.
7.       What identifies a controller as being an extension?
The controller must declare a constructor which takes another controller explicitly.  For example: public myControllerExtension(ApexPages.StandardController stdController) {this.acct = (Account)stdController.getRecord();  }
8.       Why are properties helpful in controllers?
Properties can automatically create standard getters and setters while still allowing for their customizations.  They save you from both writing the tedious code and reading the clutter when reviewing code.
9.       In what order do methods fire within a controller?
The only rule is that setters fire before action methods.  Aside from that, there is no guaranteed order.
10.   What are some Apex classes that are commonly used within controllers?
StandardController, SelectOption, PageReference, Message, etc.
11.   How are wizard controllers different from other controllers?
The two main issues is that they must handle multiple pages and they must maintain the state across those pages.
12.   What are the effects of using the transient key word?
The transient key word prevents the data from being saved into the view state.  This should be used for very temporary variables.
13.   When is a component controller required for custom components?
A component controller is required when business logic is required to decide how to render the component.
14.   What kind of content can be included in a Visualforce page?
Any content that can be rendered in a browser (HTML, JavaScript, etc.).
15.   What do {!expressions} refer to when used in Visualforce components?
Expressions refer to either data or actions that are made available to the page from the controller
16.   What are the ways that Visualpages can be incorporated into the rest of your user interface?
Basically, via links, buttons, tabs, and inline frames.
17.   Is it always necessary to know Apex to create Visualforce pages?  When does it become necessary?
No, it is not always necessary.  You can use standard controllers and VF component tags to accomplish quite a bit.  Apex becomes necessary when you need either a custom set of data or custom actions to be available from the page.
18.   What are attributes?  What is the syntax for including them?
Attributes are modifiers to the main tag that belong after the tag name in the start tag.  The syntax is attributeName=“attributeValue”
19.   What are three types of bindings used in Visualforce?  What does each refer to?
Data bindings refer to the data set in the controller. 
Action bindings refer to action methods in the controller. 
Component bindings refer to other Visualforce components
20.   What is the main difference between using dataTable vs. pageBlockTable tags?
PageBlock: For default salesforce standard format.
dataTable:To design customformats

21.   Which tag is used with both radio buttons and picklists to create the selectable values?
<Apex:selectoption> tag

22.   How many controllers can a page have?  Where is the controller for a page assigned?
One main controller (of course, it could have extensions or custom components could have controllers, etc.).  The controller is assigned in the <apex:page> tag.
23.   There are a series of layout components that all help recreate the traditional Salesforce page layout style very easily.  What name do they share?
   pageBlock.
24.   Which tags should be used to automatically bring in the Salesforce label and default widget for a field?
pageblock
25.   What are static resources?
Static resources are a new type of storage in Salesforce specifically designed for use in Visualforce pages.  They are ways to store images, flash files, stylesheets, and other web resources on the Salesforce servers that can be cached for better page performance. 
26.   What are some examples of JavaScript Events?
Onmouseover, onclieck etc.
27.   What is AJAX typically used for in Visualforce
AJAX is primarily used for partial page updates in Visualforce.  In s-controls, the AJAX toolkit was the soap (XML over HTTP) client that gave you access to the force.com Web Services API.
28.   What is the purpose of <script> tags?
Script tags allow you to create JavaScript (or other types) functions that can be used within your pages
29.   What are the different AJAX action tags?  What does each do?
    • actionStatus: used to display start and stop statuses of AJAX requests.
    • actionSupport: used to call a second component when an event happens to the first component.
    • actionPoller: similar to actionSupport, but the event is based on a timer instead of a user action.
    • actionFunction: provides support for invoking a controller action from JavaScript code using an AJAX request by defining a new JavaScript function.
    • actionRegion: used to demarcate which parts of the page the server should reprocess.

30.   How can you create partial page refreshes? 
Basically, you need to define the section of the page that is going to refresh (typically with a panel of sorts), and then define the event that will cause the refresh.  The method changes depending on if the area being refreshed is the same as the one handling the event.  It also depends on if you are just processing something on the server, or if you need the UI to change. 
31.   Which tag is used with both radio buttons and picklists to create the selectable values?
<apex:selectOption>
32.   What is the purpose of creating attributes on components? 
By allowing the component to take parameters via an attribute, you can make the component more flexible and reusable
    33.What are the Global Key words?
        We have global keywords like component,User,url,current page etc., to access various values from      components on page, from user object or from url or from current page fields. To access value from each source, we have different global keywords. One such keyword is explained in above question(!$component)
Various global keywords are:
i.                     URL
ii.                   USER
iii.                  PROFILE
iv.                 Resource
v.                   Component
vi.                 Current page
vii.                Page reference etc.

34.How can you access visualforce components values into a JavaScript?
Using Component global variable, we can access visualforce components in javascript. Let us suppose, we want to use id of an apex field with id=”afield”.
So, we can use the {!$Component.afield} syntax to use properties of the field in javascript.
Let us suppose, we want to store the field’s value in java script, then we can use like below:
<script>
Var a =’ document.getElementById('{!$component.afield}').value’;
</script>


35.What are the Gov Limits in Salesforce.com?

Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces a     number of limits to ensure that
runaway scripts do not monopolize shared resources. These limits, or governors, track and enforce the statistics outlined in the following table. If a script ever exceeds a limit, the associated governor issues a runtime exception that cannot be handled.
Governor limits can be extended from release to release.


Trigger
Class
Test
Total number of SOQL’s
20
100
100
    Total number of                SOSL’s
0
20
20
Total number of records Retrieved by single SOQL Query
1000
10000
500
Total number of records Retrieved by single SOSL Query
0
200
200
Total Number Of  Call out Methods
10
10
10
Total number of send email methods allowed
10
10
10
Total Heap Size
300000 Bytes
3MB
1.5MB