Monday, April 6, 2015

Basic Salesforce Interview questions part 11

1. Expand SOQL and SOSL.
Ans - SOQL- salesforce object query language, SOSL - salesforce object search language.

122. What is the difference between soql and sosl?
Ans - SOQL can query records from a single object at a time, while sosl can query records from multiple objects. SOQL returns a list while SOSL returns list of lists.

123. How can you query all records using an soql statement?
Ans - This can be done using ALL ROWS keyword. This queries all records including deleted records i recyclebin.

124. What is the use of @future annotation?
Ans - Using @future annotation with a method executes it whenever salesforce has resources available.

125. What are the different access modifiers that can be used with methods and variables?
Ans - Global, Public, private and protected

126.  What is the significance of static keyword?
Ans - Methods, variables when defined as static are initialised only once when class is loaded. Static variables are not transmitted as part of view state for a visualforce page.

127. Can custom setting be accessed in a test class?
Ans -  Custom setting data is not available default in a test class. We have to set seeAllData parameter true while definig a test class as below.
         @isTest(seeAlldata=true)

128. What is the difference between role and profile?
Ans - Role defines record level access while profile defines object level access.

129. On which objects can you create Queues?
Ans - Queues can be created on two standard objects (Lead and case) and also on all custom objects.

130. What are the different ways to invoke apex code?
Ans - Apex code can be invoked using DML operation(trigger), Apex class can be scheduled using schedulable interface(ex. batch apex), apex code can be run through developer console, an apex class can be associated with a visualforce page.

No comments:

Post a Comment