Master Salesforce Developer Interview Questions | 2020

Master Salesforce Developer Interview Questions 2020

Salesforce Developer Interview Preparation 2020

Hey Kid!! Ready for landing to your next job or preparing for your next Salesforce Developer Interview? Let me help you with that 😊.

All the questions attached in this blog will definitely help for your next interview. Hence Don't worry much about how you will prepare OKEY? 

I have planned something new for you Kid.....Check this out 👇

This time I want to YOU to contribute for finding out the ANSWERS to these questions and get a chance to feature your answers along with your name.


NOTE: All the below questions are not belongs to any specific company or organisation. These are general questions asked in the interviews.

Here are the SIMPLE RULES TO GET FEATURED ⭐️⭐️⭐️⭐️ :
  1. You need to comment down your Answers in the comments section of this blog only.
  2. While commenting your answers mention the Question No. for example Question No. 1: Your AnswerXXXX.
  3. Once you are done with the Answer mention Your Name as Trailblazer Name: XXXX XXXX.
  4. You can answer single or multiple answers in the same fashion as mentioned above.
  5. Your Answer Pattern should start with a simplified version of definition (Not copy-pasted from somewhere) and as you know this SFDC Kid is known for simplifying the explanation, which a Small Kid can also understand.
  6. The best answer will be selected based on Simplified Version of concept to get featured.
  7. All the selected answers will be available immediately after the questions along with the trailblazer Name.
  8. Updating and selecting the answer will be in a weekly frequency. If you have better answer than the featured one post your counter Answer as Counter Question No.1 : Your AnswerXXX

Let's prepare together Kid......


--- INTERVIEW QUESTIONS ---

Q.1 Explain Batch apex execution pattern?

Q.2 Explain Apex trigger execution pattern?

Q.3 Explain Controller and Extension (difference, execution pattern, when to refer to what)?

Q.4 What is {get: set;} method in salesforce ? (use of it, how it actually fetch the data in the background)?
ANS :
---------------------------------

As the name suggest "GET" method fetch value of variables used in VF page from its controller or extension
and "SET" method sets the value of the variables in apex controller or extension
In short you can say that we use Get and Set methods to communicate between our VF page and Apex class i.e, for passing data
For ex:- If you want to display your name in VF page like this:

here {!myname} is your variable
now, Apex code to get and set this variable value will be like this:

public class GetSetController{
**Note:- always write getVariableName and setVariableName otherwise you will get error**

//declare a local variable to pass it to SET method to set the actual variable

public String myname;

//get method
//here return type will change accordingly
public String getmyname(){ return 'SFDC Kid' ;}

//set method
public void setmyname(String myname) (
this.myname = myname;
}


Now, whenever you will load your page You can see value "SFDC Kid". It will be default/static value

Now if you want dynamically get and set the variable values then you have to modify your code like this:

Apex Class :
public class GetSetController {
//This is another way to write getter and setter methods whenever you are dealing //with dynamic value scenario

public String myname{get; set;}
}

Here when you enter any value in the textbox it will be stored in {!myname} variable i.e., GET method and
when you hit enter button same time this value is set on the same variable and show on below line on the same page i.e., the SET method

TrailBlazer Name : - Akshata

---------------------------------

Q.5 What is view state ? Explain in brief governor limits, how to reduce the size of it, best practices? 

Q.6 What exactly you do when you are doing Http Callouts in salesforce ? How it works?

Q.7 Why do we need to write Test classes (pattern, how to use it, all keyword used for what purpose)?
ANS :
---------------------------------
Basically, we write a test class to check whether our functionality will run in all types of scenarios as expected. In short, our apex class should handle errors in the proper way

The test class coverage should be minimum of 75% to deploy it to production.
But note that it should cover all positive as well as negative test cases
Positive Case: You will give all necessary data in your test class and check whether you are getting output as expected in the assert statement.
For ex: If your functionality is saving record of Account. In the test class, you will give all necessary data to create an account and at last, in assert statement, you will check whether its working fine or not.

Negative Case: There is no negative test case as such because negative test cases are similar to the positive case only but from a different perspective. I used this term just to differentiate between 2 scenarios of writing
test cases
Here you will check what if user enter wrong/invalid data or did not enter any data and hit save button then in that case Account should not insert and you already have written logic to throw an error in your Apex class
Then in test class also you will not give required values while giving dummy data and check whether it's covering that line of code from your class

Create Common Test Utility Classes For Test Data Creation:
- Test Utility Class is nothing but creation of test data which is reusable
while writing test classes while inserting test data
- Its start with @isTest annotation and public always
- You can write different methods for each object test data creation. This
method are written in similar way as we write in apex class

There are few key points you have to remember while writing test class:
1.Best practice says write your test class name in this form : ApexClassName+Test
2.Start test class with @isTest annotation
3.To write test class methods you have 2 choice either you can simply write methods as you write in your apex class and will put @isTest annotation before it
or write as testmethod keyword before it
4.All methods must be static and void
5. Now if your class deals with functionality of multiple objects then you can write @testSetup method to give all required test data at start of test class only
for ex: - @testSetup
public static void insertTestData(){}
Use this test data in other test methods
Otherwise you can give test data inside each method also
6. System.debug statements are not counted in test class
7. Use Test.startTest and Test.stopTest while actual testing so that your testing will not face governor limit errors as it get refreshed always before your actual testing
8.You must write System.assert once testing is done to check whether your functionality is giving same output as you expected

Annotations Used in Test class and its significance
1.@isTest ==> Indicates it is test class so that it will not get counted in governor limit for apex class
2.@testSetup ==> Indicated test data setup method and provide required test data for other test methods
3.test.startTest => Indicates testing has been started so that governor limits will get refreshed
4.test.stopTest ==> Indicated testing is done.
5.Test.isRunningTest() ==> to ensure trigger will not fire if its value is true to avoid limit exception also in your callout code its indicates context while unit testing so that actual
callout will not happen and will return a predefined string that we have written
6.test.runAs ==> to test functionality in different user context

System.assert Methods
1.system.assert ==> here you will just check returned value or boolean value if apex method does not return anything
2.system.assertEquals ==> you will compare expected and actual values
3.system.assertNotEquals ==> here actual and expected values will be different in order to execute test case otherwise error will be thrown

Trailblazer Name - Akshata
---------------------------------


Q.8 What is Lightning Communities (what are they, how community URL is separate, what are types, how auth is done in communities)? 

Q.9 What is System Mode & User Mode in salesforce?

Q.10 What is WhoId & WhatId (Explain in brief)?

Q.11 What is **Null pointer exception (why and when we get this in salesforce and how we can avoid this)?
ANS :
---------------------------------
When object has not been initiated or attribute of object has not been initiated and still you trying to access attribute of that object you will receive an error " System.NullPointerException: Attempt to de-reference a null object".

for example :
Account objAccount;
System.debug(objAccount.name); // this line you will get an error

Trailblazer Name : Satya Jarag
---------------------------------

Q.12 What is SOQL Queries (parent to child, child to parent, aggregate function and best practices) ?

Q.13 What is SOSL (When to use SOSL over SOQL)?

Q.14 What is With sharing and without sharing in salesforce (what is default sharing mode)? Why?

Q.15 Explain Security Model in Salesforce briefly?

Q.16 Difference between Query Locator and Database Query?

Q.17 What is Auth (Authentication, SSO/Auth Provider)?

Q.18 What is CPU Time Limit (All aspects) ?

Q.19 How does Asynchronous Triggers are different than normal triggers?

Q.20 What exactly do you mean by using API in Salesforce (functionality,Types, limits)?

Q.21 What is the first thing which will be initialised in batch apex?

Q.22 What are **Governor Limits in Salesforce (why they used, what the limit of… )?

Q.23 What is heap size in Salesforce (Limitations, Optimisation Technique, how to check it)?

Q.24 What is URL in Aura Component?

Q.25 How to optimise your Apex code (All possible techniques and methodologies use )?

Q.26 When to write the apex trigger and when to not?

Q.27 What is cross-reference Id errors (Reason, How can you avoid that)?

Q.28 What is Mix DML Exception (Reason, How to avoid it)?
ANS
---------------------------------
When in a single transaction we are trying to perform insert/update/delete operation on set-up and non-setup objects then we receive MIX DML Error.
Setup objects can be classified as User,Profile etc and non-setup objects can be classified as Account,Contact and our custom objects are also counted against non-setup objects.
So if it is necessary to perform DML operation on both set-up and non-setup objects in a single transaction then we have to break the transaction and we can achieve that by implementing the asynchronous method i.e. future method.

Below code will be helpful :

#before implementing future
User usr = [SELECT ID,Email FROM USER WHERE Id = : UserInfo.getUserId()];
user.email = sfdckid@salesforce.com
update use;

Account acc = [Select Id,Name FROM Account LIMIT 1];
acc.name='salesforcekid';
update acc;

In above example when we will try to update User and Account we will get MIX DML Operation Error so in-order to avoid it we will be implementing future method 2 break transaction into 2 parts.
#after implementing future
Account acc = Account acc = [Select Id,Name FROM Account LIMIT 1];
acc.name='salesforcekid';
update acc;

calling another class in the same logic which will be implementing future method.
class ImplementFuture{
@future updateUser(){
User usr = [SELECT ID,Email FROM USER WHERE Id = : UserInfo.getUserId()];
user.email = sfdckid@salesforce.com
update use;
}
}
Trailblazer Name : Abhishek Singh
---------------------------------

Q.29 What kind of error you can face while using Data Loader in Salesforce?

Q.30 Execution of synchronous and Asynchronous apex (Limits, Which is best in what condition)?

Q.31 Explain  different modes of Asynchronous apex (future method, Queable, batch, Schedulable?

Q.32 How can you search for the errors and why we get that in apex code?

Q.33 When to use flow, when to use process builder?

Q.34 What is Mutable and immutable in apex and javaScript in salesforce (explain for both, how different it is)?

Q.35 What is Inside batch?

Q.36 What is Salesforce DX?

Q.37 What kind of error have you faced in Aura and LWC  (How to handle them)?

Q.38 How to debug errors in process builder and Flows?

Q.39 What are Apex Imperative methods?

Q.40 What exactly is difference between WireMethod to a function or WireMethod to a property?

Q.41 What kind of changes you have faced while developing lightning web component?

Q.42 Explain different record Id’s present in salesforce (External Id, record Id)?

Q.43 Explain Event-driven architecture - Platform Events, Streaming API, Change data capture?

Q.44 What is difference between Sites, Communities and Force.com?

Q.45 How does Salesforce handle calls to the Apex from multiple Lightning Components?


                                  --- ···· ---

I am pretty sure all of the above questions will blow your mind 😅 and seems challenging to you as well even if you are 2+ years of development experience. But trust me this will open new boundaries to your interview preparation as well.

All of the above questions are the Key set to crack any tough salesforce developer interview 🤝and will definitely help you 😊.

Please do participate in answering these questions to help each other to crack interviews with top-notch knowledge and make this world a better place to live 🌍.

Wish you all the very best for your preparation...

WOHOOO !! YOU HAVE JUST COMPLETED MASTER INTERVIEW PREPARATION 2020 EPISODE
If you like this SFDCkid learning platform please let me know in the Comment section...Also, Share with your salesforce folks wish you all
Happy Learning ☁️⚡️ (Learn. Help. Share.) 😊 

Master Salesforce Developer Interview Questions | 2020 Master Salesforce Developer Interview Questions | 2020  Reviewed by on Rating: 5

19 comments:

  1. Sosl to be used when we don't know where is data we need to search . Also when we need quick results (sosl is more efficient than soql). Soql help us query on related objects (parent and child) only. Sosl gives only 2000 records. Soql can give 50000 records. 100 Soql is allowed per transaction sosl only 20.also sosl can't be used in triggers

    ReplyDelete
    Replies
    1. Hi Ankit,

      Could you please submit your answer in the format mentioned above in the post to consider your answer ?

      Thanks in advance! 😊

      ⚡️HAPPY LEARNING ⚡️

      Delete
  2. I didn't got the 24th question (What is URL In Aura Component) and 35th question (what is inside batxh apex)

    ReplyDelete
  3. Question 11 : when object has not been initiated or attribute of object has not been initiated and still you trying to access attribute of that object you will receive an error " System.NullPointerException: Attempt to de-reference a null object".

    for example :
    Account objAccount;
    System.debug(objAccount.name); // this line you will get an error

    Trailblazer Name : Satya Jarag

    ReplyDelete
    Replies
    1. Thanks for answering Satya 😊
      Congratulations 🥳🎉☁️⚡ Your answer is now featured below the given Question.

      ⚡Happy Learning⚡

      Delete
  4. Q.28 What is Mix DML Exception (Reason, How to avoid it)?
    Ans ) When in a single transaction we are trying to perform insert/update/delete operation on set-up and non-setup objects then we receive MIX DML Error.
    Setup objects can be classified as User,Profile etc and non-setup objects can be classified as Account,Contact and our custom objects are also counted against non-setup objects.
    So if it is necessary to perform DML operation on both set-up and non-setup objects in a single transaction then we have to break the transaction and we can achieve that by implementing the asynchronous method i.e. future method.
    Below code will be helpful :

    #before implementing future
    User usr = [SELECT ID,Email FROM USER WHERE Id = : UserInfo.getUserId()];
    user.email = sfdckid@salesforce.com
    update use;

    Account acc = [Select Id,Name FROM Account LIMIT 1];
    acc.name='salesforcekid';
    update acc;

    In above example when we will try to update User and Account we will get MIX DML Operation Error so in-order to avoid it we will be implementing future method 2 break transaction into 2 parts.
    #after implementing future
    Account acc = Account acc = [Select Id,Name FROM Account LIMIT 1];
    acc.name='salesforcekid';
    update acc;

    calling another class in the same logic which will be implementing future method.
    class ImplementFuture{
    @future updateUser(){
    User usr = [SELECT ID,Email FROM USER WHERE Id = : UserInfo.getUserId()];
    user.email = sfdckid@salesforce.com
    update use;
    }
    }
    Trailblazer Name : Abhishek Singh

    ReplyDelete
    Replies
    1. Well Done!! Abhishek 😊
      Congratulations 🥳🎉☁️⚡ Your answer is now featured below the given Question.

      ⚡Happy Learning⚡

      Delete
  5. Question 7 : The code must have 75% code coverage in order to be deployed to Production. This code coverage is performed by the test classes. Test classes are the code snippets which test the functionality of other Apex class and Triggers without manual efforts.
    The test class are written under @isTest annotation. By using this annotation for test class we maintain code limit as it is not counted in it. Create Raw-Data At First: The Test Class In Apex Salesforce does not have access to any of the data which is stored in the related Salesforce org by default.
    The best practice is to name your test class as your original Class or trigger Name + 'Test'. Methods of your test class have to be static, void and testMethod keyword has to be used.

    Trailblazer Name : Lalit Kashyap

    ReplyDelete
  6. Question 36 : DX stands for developer experience and it is for salesforce continuous integration and release management and it is aimed at providing a more modern user experience for Salesforce developers.
    DX promises a shift to modern life-cycle management tools for coding on the Force.com platform. Salesforce DX is designed to help Salesforce developers “build together and deliver continuously with modern deeloper experience.

    With Salesforce DX, you can now benefit from modern collaboration technologies such as Git to version control everything across your team - your code, your org configuration, and your metadata. To make this possible, we're enabling you to export more of your metadata, define data import files, and easily specify the edition, features, and configuration options of your development, staging, and production environments.

    Salesforce DX, introduces a new type of environment: Scratch orgs. Scratch orgs are source-driven and disposable deployments of Salesforce code which can be used to drive development, testing, and continuous integration. You can quickly spin up a dedicated scratch org to test your code and, once you've validated your changes, you can use your own continuous integration tools to immediately test and promote your code. As soon as your tests are passing, you can merge your branch, build packages, and deploy to a staging sandbox for final testing

    Salesforce DX gives you an amazing developer experience out-of-the-box, while enabling you to bring the tools of your choice to meet the needs of your team . Built around a powerful command-line interface and open APIs, you have the flexibility to build with the tools you know and love. Whether you prefer to code in a text editor or prefer the modern convenience of an integrated development environment, we have you covered! Want to use Jenkins or Selenium? No problem!

    Salesforce DX introduces a new way to organize your metadata and distribute your apps. With Managed Packages, enterprise customers and partners can adopt a source-driven, CLI-centric approach to automate and manage the end-to-end lifecycle and deliver apps in a modern and efficient manner. Managed packages take full advantage of Salesforce DX tools including Scratch Orgs, the Salesforce CLI, and VS Code to improve the experience of your development team while working with the Salesforce Platform.

    Trailblazer Name : Lalit Kashyap

    ReplyDelete
    Replies
    1. Hey Lalit!! This Answers seems to be copy pasted from https://developer.salesforce.com/platform/dx
      Hence it will not be consider for this quiz as mentioned in the Rules of answer selection.

      I request you to please go through all the rules before commenting your answers 😊 Looking forward to genuine answer next time.

      ⚡️HAPPY LEARNING⚡️

      Delete
  7. Question 42 : Every record within Salesforce is assigned a record ID when created. This ID is unique throughout your Salesforce org, and is referenced frequently when performing operations using existing Salesforce data. The API (e.g. Data Loader) will accept 15 or 18 character IDs, but will return 18 character IDs by default.

    The two versions are used in different situations. 15 character ID is a case-sensitive version which is referenced in the Salesforce user interface. You can use this ID while performing data operations through the user interface. 18 character ID is the case-insensitive version which is referenced through the APIs(e. g. Data Loader ).

    other than record Id Salesforce also allows you mark up to 3 fields as External IDs and these fields must be text, number or email field types. Values in these External ID field must also be unique and you can also determine whether or not value are case sensitive

    Trailblazer Name : Lalit Kashyap

    ReplyDelete
  8. Question No. 4: ANSWER

    As name suggest "GET" method fetch value of variables used in VF page from its controller or extension
    and "SET" method sets value of the variables in apex controller or extension
    In short you can say that we use Get and Set methods to communicate between our VF page and Apex class i.e, for passing data
    For ex:- If you want to display your name in VF page like this:





    here {!myname} is your variable
    now, Apex code to get and set this variable value will be like this:

    public class GetSetController{
    **Note :- always write getVariableName and setVariableName otherwise you will get error**

    //declare a local variable to pass it to SET method to set actual variable

    public String myname;

    //get method
    //here return type will change accordingly
    public String getmyname(){ return 'SFDC Kid' ;}

    //set method
    public void setmyname(String myname) (
    this.myname = myname;
    }

    Now whenever you will load your page You can see value "SFDC Kid". It will be default/static value

    Now if you want dynamically get and set the variable values then you have to modify your code like this:



    Name :








    Apex Class :
    public class GetSetController {
    //This is another way to write getter and setter methods whenever you are dealing //with dynamic value scenario

    public String myname{get; set;}
    }

    Here when you enter any value in the textbox it will be stored in {!myname} variable i.e.,GET method and
    when you hit enter button same time this value is set on the same variable and show on below line on same page i.e.,SET method

    TrailBlazer Name : - Akshata

    ReplyDelete
  9. Akshata9/06/2020

    Question 7
    Basically we write test class to check whether our functionality will run in all types of scenarios as expected. In short our apex class should handle errors in proper way

    The test class coverage should be minimum 75% to deploy it to production.
    But note that it should cover all positive as well as Negative test cases
    Positive Case : You will give all necessary data in your test class and check whether you are getting output as expected in assert statement.
    For ex: If your functionality is saving record of Account. In test class you will give all necessary data to create account and at last in assert statement you will check whether its working fine or not.

    Negative Case : There is no negative test case as such because negative test cases is similar to positive case only but from different perspective.I used this term just to differentiate between 2 scenarios of writing
    test cases
    Here you will check what if user enter wrong/invalid data or did not enter any data and hit save button then in that case Account should not insert and you already written logic to throw error in your Apex class
    Then in test class also you will not give required values while giving dummy data and check whether its covering that line of code from your class

    Create Common Test Utility Classes For Test Data Creation:
    - Test Utility Class is nothing but creation of test data which is reusable
    while writing test classes while inserting test data
    - Its start with @isTest annotation and public always
    - You can write different methods for each object test data creation. This
    method are written in similar way as we write in apex class

    There are few key points you have to remember while writing test class:
    1.Best practice says write your test class name in this form : ApexClassName+Test
    2.Start test class with @isTest annotation
    3.To write test class methods you have 2 choice either you can simply write methods as you write in your apex class and will put @isTest annotation before it
    or write as testmethod keyword before it
    4.All methods must be static and void
    5. Now if your class deals with functionality of multiple objects then you can write @testSetup method to give all required test data at start of test class only
    for ex: - @testSetup
    public static void insertTestData(){}
    Use this test data in other test methods
    Otherwise you can give test data inside each method also
    6. System.debug statements are not counted in test class
    7. Use Test.startTest and Test.stopTest while actual testing so that your testing will not face governor limit errors as it get refreshed always before your actual testing
    8.You must write System.assert once testing is done to check whether your functionality is giving same output as you expected

    Annotations Used in Test class and its significance
    1.@isTest ==> Indicates it is test class so that it will not get counted in governor limit for apex class
    2.@testSetup ==> Indicated test data setup method and provide required test data for other test methods
    3.test.startTest => Indicates testing has been started so that governor limits will get refreshed
    4.test.stopTest ==> Indicated testing is done.
    5.Test.isRunningTest() ==> to ensure trigger will not fire if its value is true to avoid limit exception also in your callout code its indicates context while unit testing so that actual
    callout will not happen and will return predefined string that we have written
    6.test.runAs ==> to test functionality in different user context

    System.assert Methods
    1.system.assert ==> here you will just check returned value or boolean value if apex method does not return anything
    2.system.assertEquals ==> you will compare expected and actual values
    3.system.assertNotEquals ==> here actual and expected values will be different in order to execute test case otherwise error will be thrown

    Trailblazer Name - Akshata

    ReplyDelete
    Replies
    1. Well Done!! Akshata 😊
      Congratulations 🥳🎉☁️⚡ Your answer is now featured below the given Question.

      ⚡Happy Learning⚡

      Delete
  10. Question 1 : Batch Apex is a global Apex class that implements Database.Batchable interface. Now, the order of execution of the methods implemented are as follows.
    1. start()
    2. execute()
    3. finish()

    For Example :
    global class BatchClass implements Database.Batchable {
    global (Database.QueryLocator / Iterable) start(Database.BatchableContext bc) {
    // Queries or gathers the records or objects to be passed to execute
    }
    global void execute(Database.BatchableContext bc, List records){
    // process and perform operations to each batch of records
    }
    global void finish(Database.BatchableContext bc){
    // execute any post operations or processing tasks
    }
    }

    Trailblazer Name : Himanshu Baghmar

    ReplyDelete
    Replies
    1. Hey Himanshu!!
      Could you please add some more explanation as describe in the rules of posting the answer. for example you can explain how and when exactly the execution of each methods takes place etc.

      I hope this will help to expand it.

      ⚡️HAPPY LEARNING⚡️

      Delete
    2. Question 1 : Batch Apex is a global Apex class that implements Database.Batchable interface. Now, the order of execution of the methods implemented are as follows.
      1. start() : This method will be the first method to be called in a Batch Job. The method gathers or collects the data on which the Batch job will be performed.
      ->We use the Database.QueryLocator object when we are using a simple query to fetch the records of the objects used in the batch job. The SOQL data governer limit is bypassed.
      ->We use the iterable object when we have complex scope for the Batch job. Database.QueryLocator gives the scope of records which the batch should process.

      2. execute() : This method will be called after the completion of START method. This method is responsible for performing all the tasks required for Batch Job. The methods contains two parameters 'Database.BatchableContext' instance and the List of sObject. The List of sObject contains the list of records collected or gathered in START method.

      3. finish() : This method will be called at the end. This method is used for doing some post operations or finishing activities like sending an email.

      For Example :
      global class BatchClass implements Database.Batchable {
      global (Database.QueryLocator / Iterable) start(Database.BatchableContext bc) {
      // Queries or gathers the records or objects to be passed to execute
      }
      global void execute(Database.BatchableContext bc, List records){
      // process and perform operations to each batch of records
      }
      global void finish(Database.BatchableContext bc){
      // execute any post operations or processing tasks
      }
      }

      Trailblazer Name : Himanshu Baghmar

      Delete
  11. This is a great blog. I am pretty much impressed with your good work. You put really very helpful information. Keep it up

    HR consultancy in velachery

    HR consultancy in chennai

    ReplyDelete
  12. Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. ecommerce development salt lake city

    ReplyDelete

HELP !! SHARE !! SUGGEST !!

Powered by Blogger.