1] What is Apex?
Answer: Apex is an object-oriented programming language that enables the developers to execute flow and transaction control statements, on Salesforce servers in association with a call to an API.
It adds business logic to system events such as related record objects, button clicks, and Visualforce pages – with Java-like syntax and acts as a stored procedure.
2] What are Maps in Apex?
Answer: Maps are used to store data in the form of key-value pairs, where each unique key maps to a single value.
Syntax: Map<String, String> country_city = new Map<String, String>();
3]What is an Apex Transaction?
Answer: An Apex transaction is a set of operations, that is executed as a single unit. These operations include DML operations that are responsible for querying records.
4]Is it possible to edit Apex Class/Trigger in the Production Environment?
Answer: No, it is not possible. We cannot directly edit the Apex Class/Trigger in the production environment. It can be done only in the Developer edition, sandbox org or the testing org.
5] What are the ways to call an Apex Class in Salesforce?
Answer: The various ways to call an Apex class in Salesforce are as follows:
· From a Developer Console
· Using Triggers
· From Visualforce Page
· With JavaScript Links
· From Home Page Components
· From Another Class
6]Is it possible to customize Apex and Visualforce directly from the Production Org?
Answer: It is not possible to customize Apex in the production org itself, however, it can be changed and deployed through a sandbox, and must meet test coverage. Visualforce, on the contrary, can be changed in the production org.
7]When is it possible to use Apex over Workflow rules or Process Builder?
Answer: There are various reasons to adopt Apex over Workflow rules or Process Builder as shown below:
· Apex can be used in those cases where there are limitations for Workflow rules or Process Builder like putting information in external systems.
· Apex is more efficient while dealing with large sets of data as it has fewer limitations.
8] What is Apex Email Service?
Answer: When you want to process the content, attachments, and the headers of inbound emails then Apex Email Service is used. It is possible to create an email service that automatically creates contact records based on contact-related information in the messages.
9] What are the methods of Batch Apex Class?
Answer: It implements Database batchable interface with three methods as shown below.
a) Start: This is used at the beginning of the batch Apex job. It is used to collect the records or objects, to pass to the interface method execute. It returns the DatabaseQueryLocator object or an iterable that contains the records or objects passed into the job.
b) Execute: This is used for each batch of records that are passed to the method. This method is used for all the processing of data. This method takes the following:
· A reference to DatabaseBatchableContext Object.
· A list of sObject records.
c) Finish: This is called once all the batches are processed. This is used for sending confirmation emails or for executing post-processing operations. It uses one argument, which is the reference of the DatabaseBatchableContext object.
10] What are the types of Collections in Apex? Explain List and Set in Collections.
Answer: The types of collections in Apex are listed below:
· List
· Map
· Set
The list is a variable that has an ordered collection of elements and they are distinguished by their indices. The index is numeric and starts at zero. Given below is an example of declaring a list, with the list keyword followed by primitive data, sObjects, nested lists, map or set types.
A set is a collection of unordered elements of primitives or sObjects. No element can be retrieved by using an index as in the case of a list. While iterating the elements in a set, there should not be any reliance on the same order. Moreover, a set cannot contain duplicate elements.
Here is an example of a set created with hardcoded string values.
Post a Comment
0 Comments