Salesforce Developer Interview Question – Apex continued
APEX (Continued)
Table of Contents
51. What is a wrapper class in salesforce?
Answer:
A wrapper class is an apex class with a collection of different data types. As the name suggests a wrapper class in salesforce allows developers to combine different data types and use them for specific purposes.
A common wrapper class example is displaying the list of accounts on a visualforce page or lightning component along with a checkbox. Here we are wrapping account records along with a Boolean which is used for checkbox.
52. What are annotations in apex? Or what are the annotations supported by apex?
Answer:
An apex annotation modifies the way that a method or class is used. Annotations are defined with an initial @ symbol, followed by the appropriate keyword.
Apex supports the following annotations :
@AuraEnabled
@Deprecated
@Future
@isTest
@testSetup
@ InvocableMethod
@ InvocableVariable
@ JasonAccess
@ NamespaceAccessible
@ Readonly
@ RemoteAction
@ Suppresswarnings
@ Testvisible
@ RestResource
@ HttpGet
@ HttpPatch
@ HttpPost
@ HttpPut
53. What are some governor limits which are very frequently encountered in salesforce apex ?
Answer:
Governor limits per transactions:
Description | Synchronous Limit | Asynchronous Limit |
Total number of SOQL queries issued | 100 | 200 |
Total number of records retrieved by SOQL queries | 50,000 | 50,000 |
Total number of records retrieved by Database.getQueryLocator | 10,000 | 10,000 |
Total number of SOSL queries issued | 20 | 20 |
Total number of records retrieved by a single SOSL query | 2000 | 2000 |
More governour limits
Description | Synchronous Limit | Asynchronous Limit |
Total number of DML statements issued | 150 | 150 |
Maximum number of methods with the future annotation allowed per Apex invocation | 50 | 0 in batch and future contexts;1 in queueable context |
Maximum CPU time on the Salesforce servers5 | 10,000 milliseconds | 60,000 milliseconds |
Maximum number of EventBus.publish calls for platform events configured to publish immediately | 150 | 150 |