Salesforce interview with Fiverr

Difference between role and profile?
Profiles help to control object privileges such as CRED (Create, Read, Edit, Delete). They also contain system permissions that a user can carry out such as exporting data.
Roles help with sharing records across an organization. They work in a hierarchical fashion, giving users access to records that are owned by people lower down in the hierarchy.
A user can only have a single Profile and Role assigned to them.

There is a project Contract. A is junior and B is senior but A can see  everything  B has created.Why?

What is with and without sharing?

With Sharing: 
It means “with Security Settings enforced”.If you declare a class as a With Sharing, Sharing rules given to the current user will be taken into the consideration. This, pertains to only respecting OWDs and Sharing Rules.  We cannot “automatically” enforce field level security or profile permissions with “with sharing,”
Example
public with sharing class sharingClass
Without Sharing:
If you declare a class as a Without Sharing, then this Apex class runs in system mode which means Apex code has access to all the objects and field irrespective of current users sharing rules, field level security and Object permissions.

User A dont have access to contact object. Apex class has query Select ID from Contact. If user executes the class will he be able to access records on contract object. Class is using with sharing?

Q.Examples of Governor Limit and how you resolved it?

if we have more than 50000 orders (custom object) in salesforce.
List<Order__c> ord_list = [Select id, source__c from Order__c];
This would end up in hitting governor limits. As the maximum number of records that can be fetched by a SOQL is 50000.
Solution
1. Use batch apex limit is 50 million
2.@ReadOnly annotation in webservices  allows us to query up to 1 Million SOQL Rows. However, we  will not be able to perform DML operations when we execute a transaction.
 3.Use  Database.QueryLocator limit is 10000

Q.What is asynchronous process?
A process which run in the background without user having to wait for the task to be finished.

Q. How batch will handle 60,000 records so as to not hit the governor limit?
Apex job that contains 60000 records and uses the default batch size is considered 300 transactions of 200 records each.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to MailChimp ( more information )
50% LikesVS
50% Dislikes