Job interview questions on visualforce pages – 1

1.What is visualforce?

Visualforce is tag-based markup language to develop a customized user interface in salesforce.

2. What is the visualforce controller in salesforce? What are they?

Visualforce controller is a set of instructions that specify what happens when a user interacts with components on visualforce pages, such buttons & links.

There are three types of controllers. They are.

Standard Controller, Custom controller & Controller extensions.

3. What is Standard Controller?

A standard controller provides the salesforce inbuilt functionality to interact with visualforce pages. You can use the standard actions like Save, Edit, Cancel & delete by using standard controllers.

Syntax : <apex:page standardController=”Account”>

Know more about the standard controller

4. What is Standard List Controller?

Standard List Controller allows displaying a list of records in a visualvalfoce page. Standard list controller provides additional pagination actions (First, Lat, Next & Previous) compared to the standard controller.

Syntax: <apex:page standardController=”Account” recordSetVar=”accounts”>

defining this controller is similar to standard controller. But need to add one more attribute recordSetVar

Know more about Standard List Controller

5. What is Custom Controller?

Custom controller is an apex class that implements customized logic to visualfore pages.

We can override or create new functionality by using custom controllers.

Syntax: <apex:page controller=”Account” >

Know more about custom controller

6. Can we use standardController & controller attributes at a time?

No, We cannot reference both attributes at a time.

See below syntax to under stand

<apex:page standardController=”ControllerName” extensions=”Class1, Class2,..”> Correct

 <apex:page Controller=”MYControllerName” extensions=”Class1, Class2,..”> Correct syntax

<apex:page standardController=”MYControllerName” Controller=”MyController”>  Wrong

7. What are the tasks of standard controller?

Standard controllers provides the ability to access and interact with structured business data contained in records displays in the proper user interface.

Standard controller tasks: controlling data, controlling actions and controlling navigation.

8. How can you create a visualforce page in salesforce?

We can create visualforce pages in two ways.

1. From the setup menu go to Setup-> develop -> Build->Pages-> click on new button to create a page & enter name & code for visualforce page.

2. From the Visualforce editor. Enter /apex/pagename at the url & create a new page in the visualforce editor.

Know more information about this

9. What is <apex:page> tag in visualforce markup?

This tag represents a single visualforce page. Every page must start & end with this tag.

<apex:page>

<!– Body of the page –>

</apex:page>

know more about <apex:page> tag

10. How can we enable visualforce editor?

We need to check the “development mode” check box at the user level to enable visualforce editor.

To enable this, go to user details page check the development mode check box.

Job interview questions