Salesforce Developer Interview Questions | Glassdoor.co.in

Salesforce Developer Interview Questions

309

Salesforce developer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

First Round- Q1. The following is a description of the instance of this famous puzzle involving 2 eggs and a building with 100 floors. Suppose that we wish to know which floors in a 100-story building are safe to drop eggs from, and which will cause the eggs to break on landing. What strategy should be used to drop eggs such that total number of drops in worst case is minimized and we find the required floor. Q2. { "A":{ "B":"12", "C":"34" } } How to get the value of C as output? Q3.To call an external web service via a button in visualforce page. Q4.Write a trigger to update phone number on case each time its associated accounts' phone number is updated. Q5.How to limit the number of child records in a look up relationship? Some of the other questions were to tell what would be the output for given simple code.

5 Answers

Let us make our first attempt on x'th floor. If it breaks, we try remaining (x-1) floors one by one. So in worst case, we make x trials. If it doesn’t break, we jump (x-1) floors (Because we have already made one attempt and we don't want to go beyond x attempts. Therefore (x-1) attempts are available), Next floor we try is floor x + (x-1) Similarly, if this drop does not break, next need to jump up to floor x + (x-1) + (x-2), then x + (x-1) + (x-2) + (x-3) and so on. Since the last floor to be tired is 100'th floor, sum of series should be 100 for optimal value of x. x + (x-1) + (x-2) + (x-3) + .... + 1 = 100 x(x+1)/2 = 100 x = 13.651 Therefore, we start trying from 14'th floor. If Egg breaks we one by one try remaining 13 floors. If egg doesn't break we go to 27th floor. If egg breaks on 27'th floor, we try floors form 15 to 26. If egg doesn't break on 27'th floor, we go to 39'th floor. An so on... The optimal number of trials is 14 in worst case.

Refer to this example- myObj = { "name":"John", "age":30, "cars": { "car1":"Ford", "car2":"BMW", "car3":"Fiat" } } You can access nested JSON objects by using the dot notation or bracket notation: Example x = myObj.cars.car2; // or: x = myObj.cars["car2"];

We would first need a way to know the count of children object your parent object has. If it were a master-detail relationship, you could use a rollup summary field for this. You could change your lookup to a master detail, but if you don't want to do that and keep it as a rollup, you have a few options. Use Rollup helper from the app exchange. Great tool that allows you to simulate rollup summaries on lookup relations. Try out the declarative rollup summary tool created by Andy Fawcett. Its an open source project he did to also allow you to simulate rollup summary fields on lookups. Write something yourself with Triggers or Batch classes Once you have one of these created, then you will have a field on the parent that gives you the count of children. Then you just need to write a validation rule on the parent that ensures this count field in not greater than 1. Count_Field__c > 1

Can a batch be called from the execute method of another batch apex?

3 Answers

2. Some questions are related to programming concepts such as OOP, memory management etc.

2 Answers

which tag is used for vf page as ms word

2 Answers

average of 5 member family is same as the 3 years when new baby is born so what is the age of baby

1 Answer

A is twice old as B.B is thrice old as C.sum of all A,B,C is 2.find the age of B

1 Answer

1.Basic questions on OOPs concepts and Java. 2.Basic programs on Java using constructors and destructors. 3.Error fixing from the program which they had given.

1 Answer

Prime Number Reverse String Anagram Palindrome Pattern

1 Answer

why should i hire you

1 Answer

What I completed- 1.Show pick list record(account name)on account object. 2.On select of any account- open related contact in edit mode. It should display (email,phone,name) 3.One hit of save button record should save . Please read below: -There are no validations Where is validation asked? -We are expecting contacts in tabular format which was not there - (Can be done apex:pageblocktable not much to do in this. Test class is not proper with best salesforce practices (Assertions of negative result with bulkify is best practise as in 2 hours based on time constraints I was able to make this much. ) (This validation part was not mentioned in requirement). Contact page table is displaying thing ,(can be done easily in one vf tag) . Test class I created in short time. Best practice can be achieve ,as I said .

1 Answer
110 of 309 Interview Questions