Salesforce: Salesforce Interview questions with answers

1.       A company has an Apex process that makes multiple extensive database operations and web service callouts. The database processes and web services can take a long time to run and must be run sequentially.

How should the developer write this Apex code without running into governor limits and system limitations?

A.      Use multiple @future methods for each process and callout.

B.      Use Limits class to stop entire process once governor limits are reached.

C.       Use Apex Scheduler to schedule each process.

D.      Use Queueable Apex to chain the jobs to run sequentially.

Ans-D

2.       As part of their quoting and ordering process, a company needs to send PDFs to their document storage system's REST endpoint that supports OAuth 2.0. Each Salesforce user must be individually authenticated with the document storage system to send the PDF.

 

What is the optimal way for a developer to implement the authentication to the REST endpoint?

 

A.      Hierarchy Custom Setting with an OAuth token custom field

B.      Named Credential with Password Authentication

C.       Hierarchy Custom Setting with a password custom field.

D.      Named Credential with an OAuth Authentication Provider.

 

Ans-D

 

3.       A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation?

 

A.      RecordType

B.      Profile

C.       Report

D.      User

 

Ans-C

4.       The use of the transient keyword in Visualforce Page Controllers helps with which common performance issue?

A.      Improves Query Performance

B.      Reduces View State

C.       Reduces Load Times

D.      Improves Page Transfers

Ans-B

5.       A managed package uses a list of country ISO codes and country names as reference data in many different places from within the managed package Apex code.

What is the optimal way to store and retrieve the list?

 

A.      Store the information in a List Custom Setting and query it with SOQL.

B.      Store the information in Custom Metadata and query it with SOQL.

C.       Store the information in Custom Metadata and access it with the getAll() method.

D.      Store the information in a List Custom Setting and access it with the getAll() method.

 

Ans-C

6.       A developer notices the execution of all the test methods in a class takes a long time to run, due to the initial setup of all the test data that is needed to perform the tests.

What should the developer do to speed up test execution?

A.      Reduce the amount of test methods in the class.

B.      Define a method that creates test data and annotate with @createData.

C.       Define a method that creates test data and annotate with @testSetup.

D.      Ensure proper usage of test data factory in all test methods

Ans-C

7.       A page throws an ‘Attempt to dereference a null object’ error for a Contact.

What change in the controller will fix the error?

A.      Change the getter’s signature to be static Contact.

B.      Change the setter's signature to return a Contact.

C.       Declare a static final Contact at the top of the controller.

D.      Use a condition in the getter to return a new Contact if it is null.

Ans-D

8.       In an organization that has multi-currency enabled, a developer is tasked with building a Lighting Component that displays the top ten Opportunities most recently access by the logged in user. The developer must ensure the Amount and LastModifiedDate field values are displayed according to the user's locale.

What is the most effective approach to ensure values displayed respect the user's locale settings?

A.      Use the FOR VIEW clause in the SOQL query.

B.      Use REGEX expressions to format the values retrieved via SOOQL.

C.       Use the FORMAT() function in the SOOL query.

D.      Use a wrapper class to format the values retrieved via SOQL.

Ans-C

9.       A company has a custom object, Request__c, that has a checkbox field, Completed__c, and a Lookup to Which SOOL query will get a unique list of all of the Opportunity records that have a Completed Request?

A.      SELECT Opportunity _c FROM Request__c WHERE Completed__c = true

B.      SELECT Opportunity c FROM Request__c WHERE Id IN (SELECT Id FROM Request__c Where  Completed_c = true)

C.       SELECT Id FROM Opportunity WHERE Id IN (SELECT Opportunity _c FROM Request__c WHERE Completed __c = true)

D.      SELECT Id FROM Opportunity WHERE Id IN (SELECT Id FROM Request__c Where Completed_c = true)

Ans-C

10.   What are three benefits of using static resources in Visualforce and Aura components?

       Choose 3 answers

A.      Relative paths can be used in files in static resource archives to refer to other content within the archive.

B.      Static resource files are automatically minified.

C.       Static resource files can be referenced by using the $Resource global variable instead of hardcoded IDs.

D.      Static resource files do not count against an organization's quota of data storage.

E.       Static resource files can be packaged into a collection of related files in a zip or jar archive.

Ans-ACE

 

11.   How many levels of child records can be returned in single SOQL query from one parent object?

A.      2

B.      5

C.       1

D.      4

Ans-C

12.   How to create 1:1(One to One) relationship in Salesforce?

A.      Lookup Object

B.      Mater-details Object

C.       Self-Relation Object

D.      Junction Object

Ans-D

13.   External ID is applicable on which data type?

A.      Number

B.      Textarea

C.       Percent

D.      Phone

Ans-A

14.   A developer has a Visualforce page that automatically assigns ownership of an Account to a queue upon save. The page appears to correctly assign ownership, but an assertion validating the correct ownership fails.

What can cause this problem?

A.      The test class does not use the seeAllData=true annotation.

B.      The test class does not retrieve the updated value from the database.

C.       The test class does not implement the Queueable interface.

D.      The test class does not use the Bulk API for loading test data.

Ans-B

 

15.   A company has a custom object, Order__c, that has a required, unique external ID field called Order_Number__c.

Which statement should be used to perform the DML necessary to insert new records and update existing records in a list of Order__c records using the external ID field?

A.      merge orders Order_Number__c:

B.      upsert orders;

C.       upsert orders Order_Number__c;

D.      merge orders;

Ans-C

16.   Which trigger context is having abilities to change the field values?

Choose any 2 options.

A.      Trigger.isUpdate && Trigger.isBefore

B.      Trigger.isInsert && Trigger.isAfter

C.       Trigger.isUpdate && Trigger.isAfter

D.      Trigger.isInsert && Trigger.isBefore

Ans-AD

17.   Which is not true about Group?

A.      Group is used in record sharing.

B.      Group can have users assigned.

C.       Group can have Queue assigned.

D.      Group can have another group assigned.

Ans-C

18.   Which is not true about Permission Set?

A.      Provide record level access.

B.      Provide class access.

C.       Assign page layouts.

D.      Provide tab access.

Ans-C   

19.    Which action is not available while using process builder?

A.      Create a record.

B.      Create an email.

C.       Invoke class method.

D.      Create outbound message.

Ans-D

20.   How to provide field level access?

A.      Using OWD

B.      Using Apex Sharing.

C.       Using Permission Set.

D.      Using Role.

Ans-C

21.   What must an administrator do while creating a record type?

A.      Set the field level security for the record type.

B.      Create a new page layout for the record type.

C.       Add the record type to required user records.

D.      Assign the record type to the appropriate profiles.

Ans-D

22.   What tab setting on a profile makes a tab not Accessible on the All Tabs page or visible in any apps?

A.      Tab Hidden

B.      Default Off

C.       Default On

D.      Read Only

Ans-A

23.   What is affected by changing default locale setting for an organization.

A.      Time Zone

B.      Currency

C.       Language

D.      Date Fields

Ans-D

24.   Which field type is not allowed in Custom Metadata Type?

A.      Formula

B.      Picklist

C.       Text Area

D.      Text Area (Long)

Ans-A

25.   How to identify that record is updated by user while creating a validation rule?

A.      isUpdated()

B.      isEdit()

C.       !isNew()

D.      !isCreated()

Ans-C

26.   Which is false about Roll-up Summary field of type?

A.      SUM

B.      MIN

C.       COUNT

D.      TOTAL

Ans-D

27.   How to remove a value from Map.

A.      Map.delete(key)

B.      Map.remove(key)

C.       Map.delete(value)

D.      Map.remove(value)

Ans-B

28.   How to enable lightning component as Tab in Salesforce?

A.      force:appHostable

B.      force.app

C.       force.tab

D.      force.enableApp

Ans-A

29.   While creating a Lightning Web Component which 3 files are created by-default.

A.      .css

B.      .html

C.       .js

D.      .js-meta.xml

Ans-BCD

30.   Which is a Salesforce deployment App exchange product?

A.      Copado

B.      Jenkins

C.       Change Set

D.      Eclipse IDE

Ans-A


Comments