Interview Questions – II

Q – What is the Difference between for loop using list and SOQL for loop in Apex ? Explain which one you prefer and why ? Check Answer

Q – Write a trigger to update Contacts when Account is updated ? [Trigger to update from Parent to childs] code link

Q – What is the difference between Remote Site setting and Named Credentials.

Named Credentials: A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. To simplify the setup of authenticated callouts, specify a named credential as the callout endpoint. If you instead specify a URL as the callout endpoint, you must register that URL in your org’s remote site settings and handle the authentication yourself. For example, for an Apex callout, your code would need to handle authentication, which can be less secure and especially complicated for OAuth implementations.

Remote Site Settings: When you want to access the external sites in your Salesforce application using callouts, webservices, etc… You need to add that in the Remote Site Settings. This is just a security that platfom is going to check.
Before any Visualforce page, Apex callout, or JavaScript code using XmlHttpRequest in an s-control or custom button can call an external site, that site must be registered in the Remote Site Settings page, or the call will fail.