0% found this document useful (0 votes)
86 views32 pages

Interview Preparation Questions

Here are the key points about DML statements in Apex: - The main DML statements are insert, update, delete, and undelete. They allow creating, modifying, and removing sObject records from the database. - DML operations are performed within transactions to maintain data integrity. Transactions can include multiple DML statements but have limits on governors like number of records. - Partial DML returns a result object indicating success/failure of each record. This avoids all-or-nothing behavior and allows partial success. - Mixed DML errors occur when setup and non-setup objects are modified together in a transaction. They must be separated into different transactions. - Upsert allows inserting new or updating

Uploaded by

Akshay Thamke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views32 pages

Interview Preparation Questions

Here are the key points about DML statements in Apex: - The main DML statements are insert, update, delete, and undelete. They allow creating, modifying, and removing sObject records from the database. - DML operations are performed within transactions to maintain data integrity. Transactions can include multiple DML statements but have limits on governors like number of records. - Partial DML returns a result object indicating success/failure of each record. This avoids all-or-nothing behavior and allows partial success. - Mixed DML errors occur when setup and non-setup objects are modified together in a transaction. They must be separated into different transactions. - Upsert allows inserting new or updating

Uploaded by

Akshay Thamke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 32

SR No.

Questions
1 What are objects the in OOP?
2 What is meant by the term OOPs?
3 What is the need for OOPs?
4 What is Class ?
5 What is Encapsulation ?
6 What is Inheritance?
7 Why Multiple Inheritance not supported for classes?
8 What is Abstraction ?
9 What is a constructor?
10 Types of Constructors
11 What is a method in Apex?
12 How Method is Declared?
13 What is the access specifier in apex ?
14 What are the various types of inheritance?
15 What is an interface?
16 What is Object Oriented Programming?
17 Differentiate between overloading and overriding.
18 What Is Apex?
19 What is an abstract class?
20 What is abstract method?
21 What do you understand by OOP?
22 Real time example of OOP
23 What are the limitations of OOPs?
24 What is the purpose of a default constructor?
25 What is the static variable?
26 Difference between method Overloading and Overriding.
27 What are the differences between abstract class and interface?
28 Can we create a object in apex?
29 Can we create a class in object?
30 Can we declared two method with same name ? with different param ?
31 Is the constructor inherited?
32 Can we call a method of a class without creating an object of a class?
33 Can we override the static methods?
34 Can we make constructors static?
35 Can we override the private methods ? If no then what is the reason
36 What is the final method ?
37 What is the final class ?
38 Can we declare a constructor as final?
39 What is the difference between abstraction and encapsulation?
40 Can there be an abstract method without an abstract class?
41 Can you use abstract and final both with a method?
42 Can you declare an interface method static?
43 Can the Interface be final?
44 Can we define private and protected modifiers for the members in interfaces?
45 Why we used Inheritance. What is the benefit of this.
46 Why we use Method Overloading
47 Why we use Method Overriding
48 What is the use of super keyword?
49 What is the use of this keyword?
50 Can private and final methods be overloaded?
51 What is the difference between non-static and static?
52 When should we use apex?
53 How does apex work?
54 What is Developer Console?
55 What are the tasks supported by developer Console?
56 What are the other IDE or code editors you use as a salesforce developer?
57 What are the different data types we have in salesforce?
58 What are primitive data types?
e developer?
SR No. Questions
1 What are Collections are supported in apex ?
2 Is it possible to write the set like that set<Account> ?
3 What is Collection in Salesforce?
4 When we should use Map over the list?
5 how to check whether a list is null or empty?
6 What is the different between list.Size() > 0 vs list != null vs list.IsEmpty()?
7 Will the set maintain insertion Order?
8 Will the list maintain insertion Order?
9 Can we sort the values in the set?
10 Which are Methods of Map ?
11 Which are Methods of Set?
12 Which are methods of List ?
13 What are some common use cases of list, set and map?
14 What do you think which is better List, Set or Map?
15 How will you find, whether an element exists in a List of size
16 How does Set and List differ
17 Is there any relation between map, set and list?
18 Can you write the syntax of initializing a map in one line?
19 Can we declare List<List<Integer>>, like this?
20 If yes to the above question how much level deep we can declare?
21 What are the features of the List collection?
22 What is the maximum size of the List collection?
23 What are the types of Data Types available in Salesforce?
24 What is the difference between Add and Set function in the List collection?
25 What is the difference between List and Set collection?
26 What happens when duplicate values are entered in Set collection?
SR No. Questions
1 How to Handle common Errors in Apex and Triggers?
2 What is Insufficient Privileges Error in Salesforce?
3 What is FIELD_CUSTOM_VALIDATION_EXCEPTION Error?
4 What is Too many SOQL queries: 101 error? and how to handle it?
5 What is System.LimitException: Too many query rows: 50001 in Apex and Triggers?
6 System.Query Exception: List has no rows for assignment to s-object?
7 What is Null Pointer exception and How to handle it?
8 What is Attempt to de-reference a null object error in Apex?
9 What is a MIXED-DML-OPERATION error and how to avoid?
10 Explain try catch finally and throw keyword in detail
11 How to create custom exception?
12 Why do we need to handle exception?
13 After any error in try block the remaining code gets executed?
14 Can we write multiple catch blocks?
15 If we write catch(Exception e) {} as first catch block then can we define other catch blocks
16 If yes to above question try it once, If no to above question justify your answer.
17 State some of the exceptions that you know also mention when these exceptions can occur.
18 Is it always necessary to use finally block?
19 Which is the exception that cannot be caught?
20 Mention some of the Apex best practices. Click here for answer
21 Best practices for Excception Handling. Click here for answer
22 What is Apex CPU time limit exceeded?
SR No. Questions
1 Differentiate between Salesforce Object Query Language and Salesforce Object Search Language.
2 Get name of accounts and related contacts
3 Count number of unique stage names from opportunities
4 Get the name of the single record for a given id
5 Get contact on asc order of account creation date
6 Get 10 names from account in ascending order starting from 4th name
7 Retrieve all the contact records where name contains ‘s’
8 Get the 5th highest amount from opportunity
9 What Are The Types of SOQL Statements in SalesForce?
10 Why do we need Dynamic SOQL?
11 What is Escape quote?
12 Governor Limits of SOQL and SOSL
13 How we can limit our SOQL result?
14 How to assign SOQL result to a Map?
15 What will be the data types of Map for the above question?
16 Can you explain the syntax of a basic SOQL query?
17 How do you select all fields from an object using SOQL?
18 Is it possible to use multiple where conditions in one SOQL statement? If yes, then how?
19 Which operator can be used to combine two or more criteria while writing a SOQL query?
20 Explain Parent to Child and Child to Parent queries
21 What is the maximum number of records that can be returned by a single SOQL query?
22 What happens if we exceed the limit for records in a single SOQL query?
23 What are some common errors that occur when running SOQL statements?
24 How do you perform SOQL queries on related objects?
25 What are the different types of relationship queries available in Salesforce?
26 What is the best tool to run SOQL queries?
27 What are some best practices to follow when using SOQL?
28 Can you explain what “sObjects” are in context with SOQL queries?
29 Is it possible to run SOQL statements in anonymous windows inside Salesforce? If yes, then how?
30 How do you write a basic query in Salesforce using SOQL and view the results?
31 What is an sObject variable?
32 Explain the use of for each loop to iterate SOQL result
33 for(Account acc : [SELECT Id, Name FROM Account]){} is this a valid syntax?
34 What does the ORDER BY clause do in SOQL?
35 How do you specify dynamic field names using SOQL?
36 Explain INCLUDES and EXCLUDES operator in SOQL
37 Give some example of like operator
38 Explain all the aggregate functions
39 Why we should use IN operator, Why can't you use OR operator in that case?
40 Get Accoount records having atleast one child contact
41 What is an sObject?
42 How to access sObjects fields?
bject Search Language.

s, then how?
SOQL query?

OQL query?

rce? If yes, then how?


SR No. Questions
1 What are the DML statements available in Apex?
2 Governor Limits for DML statements ?
3 Difference between
What are Mixed DMLinsert/update and Database.insert/
Exception? (When Database.update?
you perform operation on setup and non setup object in
4 a transaction)
5 Difference between delete and hard delete?
6 Why DML should not be written inside for loop
7 How to avoid writing dml inside for loop
8 Can we perform DML on Set
9 Can we perform DML on List
10 Can we perform DML on Map
11 My list has 20000 records to update. So will my transaction run successfully?
12 What is the return type of Partial DML?
13 How to get successfully updated and failed to update record id using parial dml
14 What is merge DML? How it works
15 What is upsert DML
16 Why do we need upsert?
17 Explain merge and upsert partial DML with their syntax
18 What is DML Exception
19 Can you explain in which scenario you get across DML Exception?
20 What do you understand by an Apex Transaction?
21 How to get id of inserted records in Apex?
22 Suppose you are given a recordId of custom object, How will you get the object name in apex of that id?
23 What are DML operations in apex?
24 What is single vs Bulk DML operation?
25 Which DML is recommended ? SINGLE or BULK?
26 What is the difference between DML Statements vs Database Class Methods?
27 What is the benefit of locking statement?
e in apex of that id?
SR No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Questions
Why should we go with one trigger on one object?
Why do we write a helper class for triggers?
What is the difference between Trigger.New and Trigger.NewMap ?
What is trigger recursion? How to avoid recursion?
How many records trigger can process at a time? Ans:- 200
How will you decide whether to use before or after trigger?
How many time triggers are recursively call ?
Is the id of record changes if we undelete a deleted record?
What is the
if i have twodifference between database.insert
triggers(Accttrigger1 and insert?
and accounttrigger2) on the Same object(Account) with Same
event(after insert), can i know which trigger will fire first?
Can we send Emails using Triggers?
Can we call a trigger from another trigger?
Why before undelete is unavailable?
What are the limitations of Workflows overcome by Triggers in Salesforce ?
What are the the context variable available with before insert event?
What are the the context variable available with after insert event?
What are the the context variable available with before update event?
What are the the context variable available with after update event?
What are the the context variable available with before delete event?
What are the the context variable available with after delete event?
What
What are the the
will you do ifcontext variable
a method insideavailable withneed
apex class aftertoundelete event?
be executed only when it is getting called from
trigger?
What is a Trigger?
Why there is no before-undelete event in Salesforce Triggers?
What are the various event on which a trigger can fire?
What are different type of Triggers?
What are the considerations while implementing the Triggers?
Best practices of Triggers
What are context variables in triggers?
How is Trigger.New Different from Trigger.newMap?
What is the use of trigger.isexecuting?
How is Trigger.new different from Trigger.old?
Can a trigger call a batch class? (Yes)
Can a trigger make a call to Apex callout method? (Yes)
Define Recursive Trigger and how to avoid it?
What do you mean by the bulkifying trigger?
Is there any limit on number of triggers define on an object?
Can you explain the order of execution in Triggers?
Difference between Validation rules and Triggers?
Write rollup summary trigger which will count opportunity, sum, min and max of amount field
What is Trigger Syntax?
Trigger are synchronous or asynchronous?
Why triggers are needed?
Write a validation trigger to prevent account deletion if isActive checkbox is checked.
Can we modify Trigger.new?
Can we modify Trigger.old?
Why we cannot
In which writeSalesforce
order does before trigger inside
execute after and
events uponvice versa?
saving a record?
Ans:- Before Triggers; Validation Rules; After Triggers; Assignment Rules; Workflow Rules; Commit.
Write a trigger such that Whenever a record is inserted to the contact automatically inserted into the account.
Why should we avoid SOQL queries inside FOR loops?
What’s the best way to prevent recursive triggers from executing more than once?
What type of exception can be thrown as part of a trigger invocation?
What
Ans :-are the different
A trigger ways of
can throw a invoking Apex methods?
System.Exception, which includes a number of different types of
exceptions, such as DmlException, QueryException, and EmailException.
How would you determine if your trigger logic is running efficiently or not?
ed into the account.
SR No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Questions
Why do we need Custom Settings?
Why do we need Custom Metadata?
Why do we need Custom Labels?
Is it necessary always to use Custom settings?
Difference between settings and metadata
How to retrieve data of custom settings in Apex
Do we need to use query for getting custom setting data inn apex
What are the types of custom settings? Explain in detail
Advantages / Disadvantages of Custom Settings
What are the field datatypes available in Custom Settings
What is the difference between getInstance() and getValues() method in Hierarchy Custom Settings
How to create Hierachy Custom setting using apex
Once created a List custom setting can we convert it into hierarchy?
Why we should not use query to get custom settings data?
What is the use of getAll() method and what is its return type?
Why do we need to use Custom Metadata if Custom Setting is available?
Can we deploy Custom Settings?
How to get Custom Metadata records in Apex?
Which are the methods available to get Custom Metadata records?
How to get Custom Label value in Apex?
SR No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Questions
Why test classes are needed?
What testing is done here?
Can we deploy Apex Class / Trigger without test classes
How to write a test class
Which annotations are available in test classes?
What is the use of testSetup method
Is it always necessary to use testSetup method
What is the difference between @testSetup and @isTest?
What is @isTest(seeAllData = true) and @IsTest(SeeAllData=false) ?
Why it is recommended to avoid using seeAllData=true?
Does Salesforce count calls to system.debug() against the code coverage?
Why do we use @testVisible annotation?
How is a class defined as a test class ?
What is Test.isRunningTest() ?
What is the use of Test.startTest/Test.stopTest method?
How many types of Assert Statements are there in Test Class?
Is it always necessary to use assert statements?
What is System.RunAs() ?
Which
Can wescenarios should
share email frombe consider
test for testing?
method?
Ans:- No
Which Objects can we access without (seeAllData=true)?
From where we can create a test suite?
What is the purpose of test suite?
How to modify createdDate of a record in test class?
Can we modify createdDate of a record in classes other than test class?
What is the minimum code coverage required?
State some of the best practices of test classes
SR No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Questions
What are types of Asynchronous apex? What are their uses?
Explain governor limits of Asynchronous Apex
Why do we use Batches?
Why do we use batch apex?
What interface will you use for batch apex?
What are the methods used in batch apex?
What is the difference between queryLocator object and Iterable used in batch apex?
What are the parameters passed in the execute method of Batch, Queueable and Schedule?
How to invoke batch Class?
How to track batch, queueable, future and schedule?
What is the state of batch apex?
What is the use of Database.Stateful?
How to monitor Batch job?
How to schedule a batch?
If a batch is having 200 records and 1 record fails what will happen?
Can we call the batch into another batch apex?
Can we call batch apex into another batch in the execute method?
Can we call the batch apex from triggers in salesforce?
What is per day limit of batch apex?
Can we call the future method in batch class?
How to test batch apex?
How many records we can insert while testing batch apex?
What are the limitations of Batch Apex ?
How can you stop a Batch job?
What is the maximum size of a batch that we can set up ?
What is the minimum batch size we can set up is?
What is the default size of the batch if we haven't configured it at the time of execution?
How many active batches(running parallel) can be allowed at a time?
How can we do chaining of batch jobs?
How can I use this Job Id to trace the Job?
Which method runs in synchronous mode in batch apex?
How to pass parameters to the batch apex?
How to abort batch apex from apex?
When to use batch apex instead of Queueable Apex?
Can I call Queueable from a batch?
Use of System.isBatch() in Salesforce ?
What is the advantage of Queueable Apex over future methods?
What is the interface used for Queueable Apex?
What are methods used in Queueable Apex Class?
When will we use future methods instead of Queueable?
How many jobs can you chain from executing a queueable job?
How many jobs can you queue in a single transaction? (Ans - 50)
How can I use this Job Id to trace the Job?
If I have written more than one System.enqueueJob call, what will happen?
I have a use case to call more than one Queueable Jobs from a Batch apex, how can I achieve it?
How to test Queueable Apex?
What are Limitations of Queueable Jobs?
Differences between Future and Queueable Apex?
Use of System.isQueueable() in Salesforce ?
What is apex Flex Queue?
Can you change order of job in Apex Flex Queue?
How many
Explain job of
status can runinconcurrently?
jobs Apex Flex Queue?

What is an apex Scheduler?


What is interface used for Schedulable Apex?
What are the methods used with a Schedulable interface?
What is the parameter of the execute method ?
What happens after the class is scheduled?
What are the arguments of the System.Schedule method?
How to Test Scheduled Apex?
How many Scheduled Apex jobs can be there at one time?
How to monitor Scheduled Jobs?
What is CRON expression?
CRON Expression Syntax
How to Schedule a batch class?
Can you Schedule your any Apex Trigger?
How can you stop the execution of a job that has already been scheduled?
Can you Schedule your Job from Trigger?
What could be the use cases for Scheduled Apex?
What is SchedulableContext?
How can we schedule the apex class?
What is the use of the System.isScheduled() ?
What is the use of the Future Method?
What are the considerations while using future methods?
Why don’t we pass sobjects in future methods?
Can we fix the order in which future methods will run?
How to test future methods?
What are the best practices for future methods?
Can you call a future method from another future method?
What are governor limits for future methods?
How to monitor future methods?
What are use cases of future methods?
Is it possible to call future method from apex scheduler or not?
Why future method is static and void?
From which places we can call future method?
What kinds of parameters supported in Future methods?
How Can I call a future method?
Can we call future method in a Batch Job?
What is the use of system.isfuture()?
How Many Future methods can be defined in a Class?
What is a Mixed DML error?
How to test a future method?
What are some limitations of future methods?
How to write test classes for Callout code
What is remote site settings
How to do callouts from future
How to do callouts from Queueable
How to do callouts from Batch
Explain in detail about their test classes
SR No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Questions
https://www.apexhours.com/salesforce-integration-interview-questions/
What is remote site settings ?
What are methods in REST
What is difference between SOAP and REST?
What is JSON ?
Test Classes of Rest API
Why we use Postman?
How to receive Response
How do you generate an access token for authentication with the Salesforce REST API?
Can you explain the different types of APIs that are supported by Salesforce?
What is HTTP POST used for?
What’s the purpose of annotations like @RestResource in Apex?
What’s the importance of @HttpGet, @HttpPost, @HttPatch annotations in context with Salesforce?
What is the default timeout period for an HTTP request made through the REST API in Salesforce? (120 seconds)
Are there any restrictions on using the @RestResource annotation?
What is the maximum size of data that can be sent or received via REST calls in Salesforce? (10 MB)
What is the best way to debug issues related to REST API requests in Salesforce?
What is the URL format for accessing records in Salesforce through the REST API?
What is the format used for sending responses from the Salesforce REST API?
What is the syntax used to create new records in Salesforce via the REST API?
120 seconds)
SR No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Questions
What is a flow in Salesforce?
Can you explain what Flow Builder is?
When do you think it’s best to use Flow Builder over Workflows, Processes, or Triggers?
What are some of the most common reasons for using Flows in your project?
Can you give me an example of how you would use Flows to create complex logic in your organization?
Does every record that enters a flow get processed by every element in the Flow?
How can you implement decision making and branching within a Flow?
Can you explain what Decision elements are used for in a Flow?
What are Loops in the context of Salesforce flows? When should they be used?
What types of loops can you define in a Flow?
If a loop becomes too large, can it cause performance issues on the server side?
Can you explain what the Assign Element is used for in a Flow?
What are the different ways you can share a flow with other users?
What data type restrictions are there when sending information from one screen to another in a Flow?
What happens if a user navigates back to the previous screen while filling out values on a multi-screen flow?
What happens when you delete a flow from your org? Can you recover it?
What are some real-world examples where you have used Flows to solve customer problems?
What is difference between screen flow and auto launched flow?
What is invocablemethod?
Difference between flow and process builder?
Can we change the data type of variable once we have created in lightning flow designer?
What are the ways in which flows can be launched?
Can we query process Builder / Flow
How to handle fault in Salesforce flow?
What is use of loop element in Salesforce flow ?
After deployment are flows directly activated in PROD?
Solutions
https://www.kicksaw.com/blog/the-ultimate-guide-to-salesforce-flows#:~:text=In%20Salesforce%2C%20a%20flow%
Same as above
No coding, No test classes, easy to use.

No depends upon the decision elements used.

Use it when you're getting multiple records or iterating over a collection


For loop
If 2000 elements visit limit is crossed then it may cause issues.
To assign value to a particular field or variable

Yes

Iterating over the collection


No
20Salesforce%2C%20a%20flow%20is,without%20using%20a%20programming%20language.

You might also like