Interview Questions : Scenario based

Note: I am writing answer as per my understanding if anyone find best solution please correct me and give your answer in comment.

 

Deloitte Interview Questions

 

                                                    Technical Round-1 and Round-2

 

1. Describe OFFSET and give example and why we use?

Ans- OFFSET is a clause which is used in SOQL query. When using offset only first batch of records are returned for a given query. If you want to retrieve next batch you will need to re-execute query with the highest OFFSET Value.

     Example- A query like- [select id, name from Account limit 10 OFFSET 10]

     Then it will return record from 11 to 20.

     

     2. Can we convert lookup in to master-detail relationship and how?

     Ans- Yes , we can convert lookup to master but When we are converting lookup in to master then any of the lookup fields should not be blank, if there will be blank then populate values in lookup fields then covert.

 

     3. How to find that which record is inserted/ updated in batch class?

     Ans- Use SaveResult class like Database.SaveResult[] srLst=d atabase.update(lstData, false); and there is isSuccess() method which finds the successfully record inserted and getError() method used to get error from the failure record and by using getId() method we can get failure records Id in class.

     4. How to find that which record is inserted/ updated in batch class?

     

     5. How to use rest Api in class?

 

     6. What is custom metadata and how do we use custom metadata?

     Ans- Follow this link-- http://www.salesforceadda.com/2017/08/create-custom-permission-set-using.html

 

      7. What is difference between profile and permission set?

     Ans- The difference between Profile and Permission Sets is Profiles are used to restrict from something where Permission Set allows user to get extra permissions.

      Lets take Example--

      You have one profile assigned to 15 different users.

      Now Suppose you want give some extra permission to one of user. You have two options here.

      a) To change Profile permissions : By this way those extra permissions will received by every user who is having that profile

 

      b) Second way is to create a permission set having those extra permission. You need to assign this permission set to particular user by navigating to User detail page. In this way, you dont have to worry about other users, as only specific user is getting those extra permissions.

 

      You can assign permission set as many users you want.

 

      8. If profile has read access and we create permission set with read/write access then what will happen?

      Ans- Then profile will have both read and write access.

 

     9. If profile has read/write and permission set has read access then what will happen?

     Ans- Then profile will have both read and write access. We cannot decrease permission on profile but we can increase permissions using permission set.

 

     10. If account has related list Address and there is checkbox name primary, then record insert in Address then each account has only one address with checkbox true if records exist already in address with checkbox true then make them false.

 

     11. What is future method?

     Ans- Follow this link-- http://www.salesforceadda.com/2017/08/future-method-and-prevent-mixed-dml.html

 

      12. Why we use future method and provide scenario where you have used future method?

     Ans- Follow this link-- http://www.salesforceadda.com/2017/08/future-method-and-prevent-mixed-dml.html

 

      13. How to read JSON in your class?

      

      14. Do you know about SOAP and Rest API?

 

     15. What is difference between role and profile?

      Ans- Role determines what is visible to the user

               Profile determines what actions they are allowed to perform

     16. Can we create user without profile?

     Ans- NO

 

     17. What is difference between insert and database.insert()?

     Ans- Follow this link: http://www.salesforceadda.com/2017/08/insert-vs-databaseinsert-in-salesforce.html

 

     18. Why we use true and false in database.insert()? 

    Ans- Follow this link: http://www.salesforceadda.com/2017/08/insert-vs-databaseinsert-in-salesforce.html

 

     19. If we have list of integer type and there is 20 items and want to display list in table on page and I want to display 5 data then 5 and then 4 so on, how you will display?

 

     20. If we have 10 data and inserting 10 data and 3 insert successfully and failed at 4 then what will happen when using Database.insert() .

     Ans- It will insert success records and not insert error records.

 

     21. Can we change picklist data type into text?

     Ans- Yes

 

     22. How to get list of child data in email templates.

     Ans- Cross Object Email Template is not Possible in salesforce at this point in time Only Possible way to access and Display child record details in email template of parent is to use Visualforce Email Templates.

 

     23. If there is one object and we create two lookup field related to User object. And we have 3 users like A, B, C of same roles and same profile. If we have assigned two users in two lookup like A and B then only these two user can edit that object record C user cannot be able to edit the record. How will you achieve this?

 

      24. What is having clause? Give the example.

      Ans- HAVING is a clause that can be used in a SOQL query to filter results that aggregate functions return. You can use HAVING clause with GROUP By clause to filter the results returned by aggregate function,such as SUM(). HAVING clause similar to WHERE clause. The difference is that you can include in aggregate functions in a HAVING Clause , but not in WHERE Clause.

      Ex- Firstly query,

      [Select Id, name from Lead] → It will return Lead record with Id and Name.

 

      [Select Id, Name from Lead GROUP BY name] then it will through error like  Field must be grouped or aggregated: Id

 

[Select id, count(name) from Lead GROUP BY name ]-- then it will also through error , you cannot use same field name used in count i.e-- select id, count(name) from Lead GROUP BY name ^ ERROR at Row:1:Column:18 Grouped field should not be aggregated: Name

 

[SELECT LeadSource, count(Name) FROM Lead GROUP BY LeadSource]-- Now it will return record With LeadSource and count total name field correspond to particular LeadSource.

 

[SELECT LeadSource, count(Name) FROM Lead GROUP BY LeadSource HAVING count(Name)>6]-- It will filter above group by query and return records which count is greate than 6.

 

25. What is return type of SOSL query?

 

Ans- List<List<SObject>>

 

26. What is return type of Aggregation query?

 

Ans- AggregateResult[]

 

27. What is soft delete and hard delete?

 

Ans- Using Hard Delete your data will not be stored in the recycle bin. It will be permanently   deleted.

      But using Soft Delete you can restore those datas lated within 15days from recycle bin.

 

     28. Difference between with sharing and without sharing?

      Ans- "with sharing" keyword in apex class so that it will enforce only sharing rules of current user but not, object permissions, field level permissions

 

     But “without sharing” will not enforce only sharing rules of current user . does it mean it will enforce current user object and field level permissions.

 

     29. Can we show error message using future method?

 

 

      

     Cognizant Interview Questions

 

                                                           Technical Round-1 and Round-2

 

    1.   Difference between all evaluations criteria in workflow rules?

    Ans- 

created

Evaluate the rule criteria each time a record is created. If the rule criteria is met.

In this option, the rule never runs more than once per record.

created, and every time it’s edited

Evaluate the rule criteria each time a record is created or updated. If the rule criteria is met, run the rule.

In this option, the rule repeatedly runs every time a record is edited, as long as the record meets the rule criteria.

Note: We cannot add time-dependent actions to the rule if you select this option.

created, and any time it’s edited to subsequently meet criteria

Evaluate the rule criteria each time a record is created or updated.

  • For a new record, run the rule if the rule criteria is met.
  • For an updated record, run the rule only if the record is changed from not meeting the rule criteria to meeting the rule criteria.

With this option, the rule can run multiple times per record, but it won’t run when the record edits are unrelated to the rule criteria.


2. 
We have two team service team and sales team, and we have 15 fields in Account object and want to show 10 fields to service team and 5 fields to sales team, how will you do this?

 

3. Define all sharing rules?

 

      4. What is Re-evaluate checkbox in workflow?

      5. What is trigger framework?

 

      6.  What is process builder? Can we use apex class in process builder?

 

      7.  Difference between process builder and workflow?

 

      8.  What is upsert? How it works?

 

      9. Can we call future method in batch class?

 

     

Capgemini Interview Questions

 

Technical Round-1 and Round-2

 

 

 

b    1.     What are Salesforce securities?

      

    2.  I want to delete child when I delete parent object records in lookup relationship, because we have already too many master-detail in object and not able to create master-detail, so how will you do this task?

 

      3. We have table with two rows with two columns, and data in table as-

 

     Columns:   Name       class

      Rows     :     Arun        10

                           Aman      12

 

      Write query to count of total number of 12th class student.

 

 

 

4. How to write rollup summary for lookup and how to update roll up summary using lookup.

 

5. Write down Roll Up summary trigger.

 

6. What are the mixed DML operations?

 

Ans:- Follow link-- http://www.salesforceadda.com/2017/08/future-method-and-prevent-mixed-dml.html

 

7. What are the best practices for test class?

 

8. What are the AJAX functions in salesforce?

 

9. Difference between render, rerender, render as.

 

10. What are the Sharing rules?

 

11. What is OWD? If for any object OWD is private so what will happen?

 

12. What is the default OWD of tasks and events?

Ans:- 
In Salesforce.com, for Activity objects (Task & Event), there are only 2 option in the Organization-Wide Defaults sharing setting:

 

- Controlled by Parent
- Private

Private

Only activity owner (label as Assigned To), and users above the activity owner in the role hierarchy can edit and delete the activity.
Users with read access to the record to which the activity is associated (Name and Related To) can view and report on the activity.

Controlled by Parent

A user can perform an action (such as view, edit, transfer, and delete) on an activity based on whether he or she can perform that same action on the records associated with the activity.

Example
, if a task is associated with the Acme account and John Smith contact, then a user can only edit that task if he or she can also edit the Acme account and the John Smith record.

 

13. Difference between save report and run report?

 

14. What are the buckets and formula fields in reports?

 

15. What is future method? What are the restriction of the future method? Can we call future method from batch class?

 

16. Write query to get child from parent.

 

17. Assume there is user lookup in Account, if any user create account record then that user Id should populate in lookup, how will you do this task?

 

18. Can we update record on account on ‘After insert’ trigger event?

 

19. What is forecasting in Salesforce?

 

20. What is territorial management?

 

21. What are the types of trigger and events?

 

Ans- 
         There are two types of triggers:

 

           Before triggers are used to update or validate record values before they’re saved to the database.

                  After triggers are used to access field values that are set by the system (such as a record's Id or LastModifiedDate field).

 

        Trigger Events:

             

              Before Insert, Before Update, Before Delete, After Insert, After Update, After Delete and                     after undelete

 

22. What is workflow and time dependent workflow? Write will send mail after 15 mins?

 

23. Create visual force page1 with  3 rows data like Here no data from database, just you                create your own field
      Column:  Name   Checkbox
      Row 1:   Arun      True
      Row 2:   B            False
      Row 3:   C            True
     
      Now we have showData button, then on click on button data which has checkbox
      True should display on another visual force page.

              


0 comments:

Post a Comment

If you have any doubts, please let me know.