3.2K
Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on Salesforce servers in conjunction with calls to the API. Below are some of important questions.
You can also check below question posts for interview questions.
Salesforce Interview Question – Security
Top 20 Salesforce Interview Question – Integration
- What is difference between custom controller and controller extension?
Ans.
custom controller:
Custom controller is required when standard controller is not fitting a requirement Like if you need to some custom validation or some external system call. We have to implements all of the logic for a page without leveraging a standard controller.controller extension:
controller extension extends the functionality of a standard or custom controller. This is used when- When we want to override any action like edit, view save or delete.
- When we want to add new action
- What is use of dynamic apex?
Ans.
There are number of use case of dynamic apex. Some of them are- Showing record based on object selection on Page
- Copy records into other object based on dynamic configuration
- How to find list of classes in org?
Ans.
We can use object ApexClass to get list of all Apex Classes.Select Id, name from ApexClass
- How to find list of pages in Org?
Ans.
We can use object ApexPages to get list of all Apex pages.Select Id, name from ApexPage
- How to find list of triggers in Org?
Ans.
We can use object ApexTrigger to get list of all Apex trigger in org.Select Id, name from ApexTrigger
- Can we do overloading in Apex? If yes, how?
Ans.
Yes, we can do overloading in Apex. We can do constructor and method overloading. Overloading support in giving different signature and implementation based on parameter.public class OverloadExample { integer height; //Constructor Overloading public OverloadExample() { height=0; } public OverloadExample(integer xNum) { height=xNum; } //Method Overloading public integer getHeight(integer x) { return x*x; } public integer getHeight(integer x, integer y) { return x*y; } }
- Why we have 15 and 18-character length record id?
Ans.
15 Character length id is case sensitive and 18-character id is case insensitive. Salesforce recommends to use 18-character ID. Lightning is using 18-character Id to view record page.We can remove last 3 character to get 15-character Id. - Can we create Interface in Aped and How we can use it?
Ans.
Yes, we can create interface in Apex.interface IReqeuest { string getRequestNumber(); } public class CaseRequest implements IReqeuest { public string getRequestNumber() { // Give your implemenation return ''; } }
- How to retrieve record from recycle bin?
Ans.
We can use ALL Rows in SOQL.SELECT COUNT() FROM Contact WHERE AccountId = a.Id ALL ROWS
- How can we lock record using SOQL so that it cannot be modified by other user?
Ans.
For Update will lock record. Other user can not edit after records are locked.Account [] accts = [SELECT Id FROM Account LIMIT 2 FOR UPDATE];
3 comments
[…] Salesforce Apex Interview Question […]
[…] Salesforce Apex Interview Question […]
[…] Interview Question for Asynchronous ApexSalesforce Integration Interview QuestionsSalesforce Apex Interview QuestionTypes Of Integration Patterns in SalesforceDifference Between Custom Setting and Custom Metadata […]