Wednesday, 22 October 2014

sfdc salesforce.com sales cloud service cloud remedyforce - top interview questions by salesforce realtime experts

288.What is the difference between the global and public and Private Class Access Modifier keywords ?
Ans:- Classes have different access levels depending on the keywords used in the class definition
 Global :- This class is accessible by all Apex everywhere
o All methods / variables with the webservice keyword must be global
o All methods / variables / inner classes that are global must be within an global class to be accessible
 Public :- This class is visible across your application or namespace
 Private ( for inner classes only ) :- This inner class is only accessible to the outer class.
Top-level ( or outer ) classes must have one of these keywords
 There is no default access level for top level classes
 The default access level for private classes is private

289.What is the difference between the global and public and Private and Protected Variable & Method Access Modifier keywords ?
Ans:- Like classes , methods and variables have different access levels depending on the keywords used in the declaration.
 Private : This is the default and means that the variable / method is accessible only within the class it is defined
 Protected : This method / variable is also available to any inner classes or sub-classes. It can only be used by instance methods and member variables
 Public : This method / variable can be used by any Apex in this application namespace
 Global : This method / variable is accessible by all Apex everywhere
o All methods / variables with the webservice keyword must be global
289.What is the definition of Inheritance?
Ans:- The ability to extend classes is now available in all orgs
 Virtual : This class allows for extensions and overrides
 Abstract : This class contains abstract methods and is designed to be extended
 Override : The method overrides base class methods
A class can implement multiple interfaces , but only extend one class. Classes can cast as super classes and verify an object’s class using this instanceof keyword
290.What are the different data types for Apex Variables ?
Ans:- The different data types for Apex Variables are :-

291.What are the different Primitive data types for Apex Variables ?
Ans:- Apex uses the same Primitive data types as the Web services API , most of which are similar to their Java counterparts. In addition , there are two non-standard types:-
292.What is Collection Casting in Apex ?
Ans:- Collections can also be cast in Apex For Example , a list of child class objects can be assigned to a list of parent class objects
293.What is Enum Data Type in Apex ?
Ans:- Enum ( or enumerated list ) is an abstract data type that stores one value of  
finite set of specified identifiers To define an Enum , use the enum keyword in the variable declaration and then define the list of values By creating this Enum , you have created a new data type called Season which can be used as any other data type Apex provides some built-in Enums for built-in concepts such as API error (
System.StatusCode ).
294.What are the different types of Enum Data Type Methods ?
Ans:- Although Enum Values cannot have user-defined methods added to them , all
Enum values have some implicit methods similar to Java
 Ordinal () returns the position of the item in the list ( from 0 )
 Name () returns the name of the Enum item as string
 Values() is a static method that returns the list of values
295.What is an sObject Data Type ?
Ans:-An sObject represents a row of data in the Salesforce database An sObject must be declared using the API name for the object. They are initialized to null by default An sObject can be instantiated using name / value pairs to add initial values to fields , or can be populated later.
296.What are the different types of sObject Data Type Methods ?
Ans:- The following methods are available on sObjects :-

297.What are the three different types of collections ? How are they different ?
Ans:- There are three different types of collection objects in Apex List : An ordered collection of primitives , sObjects , collections or Apex objects based on indices
Set : An unordered collection of unique primitives
Map : A collection of unique , primitive keys that map to single values which can be primitives , sObjects , collections , or Apex objects
298.What is a List Data Type ?
Ans:- Lists are similar to arrays in that they are an ordered collections of typed
primitives , distinguished by their indices. The first element in a list is always at index 0 Generic list declaration syntax
Examples:-
299.How do you define Static Variables in Apex ?
Ans:- Use the static keyword to define static variables to store data that is shared within the class
 Static Variables are not necessarily constants
 All instances of the same class share a single copy of static variables
 This can be technique used for setting flags to prevent recursive triggers

301.What are SOQL Queries ?
Ans:- The Salesforce Object Query Language ( SOQL ) is similar to the SELECT command in SQL and allows you to specify the source object and allows you to specify the source object and a list of fields with an optional WHERE clause.
 These query strings are typically used with the query() call to the Web Services API
 SOQL statements evaluate to a List of sObjects , a single sObject or an integer ( for count queries )
 You can use the ALL ROWS keywords to query all records in an organization , including deleted records and archived activities
 The FOR UPDATE keywords can be used to lock records for updating
 Records can then only be updated through the current trigger context
302.What are SOSL Queries ?
Ans:- The Salesforce Object Search Language ( SOSL ) allows you to search  ultiple
fields for multiple objects with a single query
 These search strings are typically used with the search() call to the Web Services API
 SOSL Statements evaluate to a List of List of sObjects where each list contains the search results for a particular sObject type , returned in the same order as listed in the Query
303.What is bind ?
Ans:- SOQL & SOSL statements in Apex can reference variables and expressions when preceded by a colon
 This is referred to as a bind
Examples:-
304.What are System Static methods in Apex ?
Ans:-Apex includes both built-in system static methods and instance methods for
expressions of particular data types. System static methods are similar to Java and are always of the form : Class. method(args)
System Static Methods do not have implicit parameter , and are invoked with no object context.
306.What are Apex Objects ?
Ans:- A class is a template or blueprint from which Apex objects are created Any standard or custom Apex object ( not sObject , but object instantiated from an Apex class ) can use :-
 clone : returns a new object with the same value references ( shallow copy )
 toString : returns a string representation of the values ( similar to debug )

307.What is the purpose of Limit Methods ?
Ans:-Due to multi-tenant environment , the Apex runtime engine strictly enforces a
number of limits.
Apex contains built-in methods to help manage these limits There are two versions of each method.
The first returns the amount of resource that has been used in the current context
The second ( containing the word Limit ) returns the total amount of the resource available for that context
 309.What is the purpose of Data Manipulation Language ( DML ) Statements ?
Ans:- DML Statements allow users to retrieve , insert , delete , and update data in the Salesforce database , similar to the parallel API Verbs
 Insert , update , upsert , delete , merge
 Undelete which can utilize the ALL ROWS parameter similar to the API QueryAll call
 Convertlead is functionality equivalent to the API Convertlead() DML Statements can take two forms
 Special , standalone statements :- delete , record
 Functional calls in method form from the database class
 Database.delete(record);
They can take a single sObject or an sObject list
 The upsert statement also takes an optional external id
310.What is the purpose of Database.DML options ?
Ans:- The Database.DML Options provides the ability to add extra information during a transaction
 Specify truncation behaviour
 Specify locale options
 Trigger assignment rules
o Only used for account , case , or lead
 Trigger email notifications based on certain events
o Creation of new case of task
o Creation of a case comment
o Conversion of a case email to a contact
o New user email notification
o Password reset

311.What is the maximum number of rows that can be brought back by a SOQL Query ?
Ans:- SOQL Query Results in a trigger cannot exceed 1000 records per record submitted
312.Name some DML Statement Guidelines ?
Ans:-  You can pass a maximum of 200 sObject records into a single method
 Each DML Statement can only operate on one type of sObject at a time
 You must supply a non-null value to all required fields when inserting or updating
 Inserting a record automatically sets the ID for the record
 The ID for the current sObject record cannot be modified , but related IDs can
 Upsert calls consist of two separate operations of insert and update
 Deleting supports cascading deletions
 Merging works for a maximum of three records at a time
o Only Leads , Contacts , and Accounts can be merged

313.Name some unsupported sObjects for DML Statements ?
Ans:- DML Statements are not supported within Apex on the following sObjects:-

314.How are Transactions controlled in Apex ?
Ans:-  All Transactions are controlled by the trigger , Web service or anonymous block that executes the Apex Script
 If the Apex Script completes successfully , all changes are committed to the database. If the Apex Script does not complete successfully , all database changes are rolled back
316.What are some of the Characteristics of user-defined methods in Apex ?
Ans:- Note that user-defined methods :-
 Can be used anywhere that system methods are used
 Pass arguments by reference
 Can be recursive
 Can refer to themselves or to methods defined later in the same class or
anonymous block
 Can be polymorphic
317.What are Triggers in Apex ?
Ans:- A trigger is an Apex script that executes when a data manipulation language (
DML ) event occurs on a specific sObject.
DML events include : insert , update , delete , undelete
Triggers can be created on any custom or top-level standard objects

318.What is the difference between Before and After Triggers ?
Ans:-
Triggers execute either before or after the event
 Before triggers can update or validate values before they are saved to
the database
 After triggers can access field values that are set automatically ( such as
Id or last Updated fields ) or to affect changes in other records ( such as
auditing or queued events ).

319.What is the order of execution of triggers in Apex ?
Ans:-
1.The original record is loaded from the database ( or initialized for insert )
2.The new record field values are loaded and overwrite the old values
3.System Validation occurs ( verifying required fields , running Validation
rules )
4.All before triggers execute
5.The record is saved to the database , but not yet committed
6.All after triggers execute
7.Assignment rules execute
8.Auto-response rules execute
9.Workflow rules execute
10.If there are workflow field updates , the record is updated again
11.If the record was updated with workflow field updates , before and after
triggers fire once more
12.Escalation rules execute
13.All DML operations are committed to the database
14.Post-commit logic executes , such as sending email

320.Name some trigger considerations ?
Ans:-
All triggers are considered to be bulk triggers and should be able to process
multiple records at a time
 Remember that triggers execute via API access as well , which can
submit multiple records for each DML verb
All triggers run as System by default
 This means that triggers may have access to objects and fields that the
current user does not
 You can override this using the with sharing keywords
Trigger code cannot contain the static keyword
Triggers can only contain keywords applicable to an inner class

321.What are the 3 different ways Apex can be deployed ?
Ans:-
Apex can be deployed in 3 different ways:-
 Using the Force.com IDE , for developers
 Using the Force.com Migration Tool ( Ant ) , for technical IT
administrators
 Using 3rd-party tools such as Dreamfactory Snapshot ( which implement
deployment utilities using the Metadata API ) for non-technical IT

322.Describe the steps of deploying Apex using Force.com IDE ?
Ans:-
1.Right-click your src folder in your project and Select Force.com | Deploy to
Server
2.Enter
Username / Password
Security Token ( if necessary )
Environment
3.Select whether to create project and destination archives and if so where to
store them
4.Select the items that you wish to migrate
5.Validate the deployment to catch any testing coverage issues
6.Examine the deployment plan to verify what will be added or overwritten
7.Execute the Deployment

323.What is the purpose of Force.com Migration Tool ?
Ans:-
Use the Force.com Migration Tool to deploy and retrieve tasks to create ,
update , and retrieve metadata

324.What is the command for running Force.com Migration Tool ?
Ans:-
From the directory where build.xml exists , in a command shell , run Ant
followed by the target
 Example with the ―test target ; ant test

325.What are the 4 different Dynamic Apex Components ?
Ans:-
Dynamic Apex consists of several components

326.What is Dynamic SOQL ?
Ans:-
Dynamic SOQL refers to the creation of a SOQL string at runtime within an
Apex Script
Makes an Application more flexible by allowing SOQL Creation on the fly:-

327.What is Dynamic DML ?
Ans:-
Dynamic DML is the process of creating sObjects dynamically , and inserting
them into the database using DML

328.What are Wizards ?
Ans:-
Wizards are multi-step sequences designed to simplify lengthy or complicated
tasks
Each step in the wizard is generally its own Visualforce page
However , there is generally just one controller for the entire wizard to maintain
the state
 Usually , the state is cleared when navigating to a new page
 The wizard must track all user input values until the final step in order to
allow users to page back and forth through the wizard

329.What is the purpose of Transient Variables ?
Ans:-
Declaring variables as transient reduces view state size
 The transient keyword can only be used in Visualforce controllers and
controller extensions
Use the transient keyword to declare instance variables that cannot be saved ,
and should not be transmitted as part of the view state for a Visualforce page

330.What are the 2 different ways of deploying Controllers in Apex ?
Ans:-
Controllers are simply Apex classes , so all of the usual coding , testing , and
deployment rules and guidelines apply
Controllers can be deployed in 2 ways:-
 Force.com Migration Tool via ANT
 Force.com IDE via Eclipse

331.What are Crypto Classes ? How many types of Crypto Classes are there ?
Ans:-
Crypto methods enables access to external services that require encryption

332.What is the purpose of REST Service Callouts ?
Ans:-
REST Stands for Representational State Transfer
REST simply receives XML over HTTP from a URL
REST builds on the existing structure of the web by using HTTP and XML
without the need to delve into the intricacies of SOAP
Uses HTTP ―verbs such as POST , GET , PUT and DELETE to call services
located at a specific URL
You must make the service endpoints accessible via Setup | Security Controls
| Remote Site Settings

344.What are the different ways to instantiate pages ?
Ans:-
There are 4 different ways to instantiate pages , depending on the type of page:-

345.When is Creating Controller Extensions recommended ?
Ans:-
If you want to keep most of the functionality of a standard or custom controller
, it is probably wiser to create an extension rather than a new custom controller
Controller Extensions can extend either standard or custom controllers

346.What are the different types of Exceptions in Apex ?
Ans:-
Similar to Java , Apex uses exceptions to note errors and other events that
disrupt script execution with the following keywords:-

348.What does System Log Contains ?
Ans:-
The system log contains information derived from the following:-
 Database changes
 Automated workflow processes , such as:-
o Workflow rules
o Assignment rules
o Escalation rules
o Auto-response rules
o Approval processes
 Validation rules
 Request-response XML
 Apex Script Errors
 Resources used by an Apex script

349.What are Apex Unit Tests ?
Ans:-
Unit tests are Apex class methods that verify whether a particular piece of
code is working properly
Unit tests :-
 Take no arguments
 Commit no data to the database
 Are flagged with the testMethod keyword
Unit Test Syntax:-

350.Name some Unit Tests Best Practices ?
Ans:-
Good unit tests should:-
 Cover as many lines of code as possible , including all branches of
conditional logic
o Apex automatically tracks the lines of code that are executed
by the tests and at least 75% of your Apex Scripts must be
covered by unit tests , and all triggers should have some test
coverage
 Complete successfully without throwing unexpected exceptions
 Make liberal use of the System.assert() methods to verify expected
results
 Test triggers by calling DML statements on their objects using the
Database methods

351.What are the different ways of running Unit Tests ?
Ans:-
Unit tests can be run via in the Salesforce UI
 Under Setup | Develop | Apex Classes | Run All Tests
Unit tests can also be run in the Force.com IDE
 Invoked in the Force.com IDE by right mouse clicking on an Apex
based folder or class and selecting Force.com | Run Tests
 Results in the Apex Code Test Runner view

352.What are the basic steps for creating an email service ?
Ans:-
Create the shell of an Apex class that implements the
Messaging.InboundEmailHandler interface provided on the Email Service
setup page
Generate an Apex email service domain under Setup | Develop | Email
Services filling out the requisite setting

353.How many inbound emails can all email services combined consume in a
day ?
Ans:-
The total number of messages that all email services combined can process
daily is calculated by multiplying the number of user licenses by 1,000

354.Can an inbound email service process binary attachments as well as plain
text attachments ?
Ans:-
Yes Inbound email supports both text as well as binary attachments

356.Can we send Mass Email outbound via Apex that uses an existing email
template to a group of Contacts ? Users ?
Ans:-
Yes.

357.Do emails sent via Apex to internal Salesforce users count against our org
email limits for the day ?
Ans:-
There is no limit to the number of internal emails per day

358.Can we use a Visualforce page like an email template to provide the body
of our outbound emails ?

359.What is the maximum of total emails can be send to external email
addresses per day ?
Ans:-
Maximum of 1000 total emails can be send to external email addresses per day
Number of external Email Addresses on any one mass email varies by Edition
Force.com IDE Debugging

360.What are the different types of bindings for Visualforce components ?
Ans:-
There are primarily 3 types of bindings for Visualforce components
 Data Bindings :- using the expression syntax to pull in data from the
data set made available by the page controller
 Action Bindings :- using the expression syntax to call action methods
for functions coded in the page controller
 Component Bindings :- using component attribute values to reference
other components IDs

361.What is a Visualforce controller ?
Ans:-
A Visualforce controller is an Apex class that specifies the data available and
the behaviour when a user interacts with components on a page

362.What are the different types of methods that Visualforce controllers define
?
Ans:-
Controllers typically define different types of methods:-
 Data methods to display data
o Getter methods to retrieve data from the controller
o Setter methods to pass data from the page to the controller
 Action methods to perform logic:-
o Specialized action methods for specific behaviours
o Navigation action methods to take the user somewhere else

363.What are the 3 main types of Visualforce Controllers ? What are they ?
Ans:-
There are 3 main types of Visualforce Controllers :-
 Standard Controllers :- are provided for all standard and custom
objects that are available via the API
o They provide the same basic data and actions that are available
through the API
o There are also standard list controllers to help manage lists of
records
 Custom Controllers :- are coded in Apex completely from scratch
o All data and actions must be provided by the developer
 Controller Extensions :- allow developers to take advantage of the
existing functionality of a controller while extending or overriding the
data or actions it provides
o Data and actions are inherited from the parent controller

364.How can Email logs be requested ?
Ans:-
Email logs can be requested through Setup | Monitoring | Email Log Files
365.What are Visualforce Custom Controllers ?
Ans:-
Visualforce Custom Controllers:-
 Are coded to create custom behaviours or non-standard data sets
 Can be used to create wizards or leverage callouts

366.What are Visualforce Controller Extensions ?
Ans:-
Visualforce Controller Extensions :-
 Add custom behaviour or additional data to standard controllers

Putting it All Together

367.When do you need to go beyond a standard controller and code custom
Apex ?
Ans:-
Standard controllers can often provide all of the functionality and data that you
need for your Visualforce page
However , you may need to start coding your own controller code if you want
to :-
 Override existing functionality
 Make new actions available to the page
 Customize the navigation
 Use HTTP callouts or Web services
 Have greater control for how information is accessed on the page
Standard List Controllers Example

368.If we want to make a callout from a Trigger , how do we do that ?
Ans:-
Use the @future annotation to make Web services callout from a trigger
HTTP Callout Example
369.How can Anonymous blocks can be compiled and executed ?
Ans:-
Anonymous blocks can be compiled and executed through the use of the
executeAnonymous() Web services API Call
From the Salesforce UI the System Log link brings up an execute anonymous
console
From the Force.com IDE the execute anonymous view allows you to enter
Apex and execute it anonymously

370.Name some Asynchronous Limitations ?
Ans:-
No more than 10 method calls per Apex invocation are allowed
No more than 200 future method calls per Salesforce license per 24 hours are
allowed
The parameters specified must be primitive datatypes or collections of
primitive datatypes
Methods with the future annotation cannot take sObjects or objects as
arguments
The @future annotation cannot be used in getter / setter methods or
constructors of Visualforce controllers

371.What are Pattern and Matcher Classes ?
Ans:-
In addition to SOSL searches , Apex supports the use of regular expressions
through its Pattern and Matcher Classes
 These are based on their Java counterparts
 All regular expressions are types as strings

372.What are the features of the 3rd Pary Deployment Tool Snapshot ?
Ans:-
AppExchange partner DreamFactory provides a tool called snapshot
Snapshot enables users to take a ―snapshot of the current state of the
customizations in a Salesforce ORG or Sandbox
Provides a highly visual way to compare and track schema changes over time
Schema ―push feature , which automates change management between
salesforce deployments
Automatically roll customizations from development into the Production
environment

373.Describe a typical Deployment Scenario ?
Ans:-
Develop the org
Incorporate all changes and perform an integration test
Stage the changes into a full , fresh sandbox
Perform full regression and acceptance test
Change control grants approval
Deploy changes to Production and Training environments

385.Are Visualforce Pages and components versioned ?
Ans:-
Visualforce pages and components are versioned
Previous versions of Visualforce elements remain available after new
implementations are introduced
The version settings tab displays the version of each page or component

393.What is the difference between Class and Object in Apex ?
Ans:-
A class is a template or blueprint from which objects are created.
An object is an instance of a class.

394.Where all can you define custom methods ?
Ans:-
You can define custom methods in anonymous blocks , triggers , or in stored
classes

400.What are Build Properties ?
Ans:-
Properties used by Force.com Migration Tool are stored in a build.properties

file

No comments:

Post a Comment