We believe in My Learning My Development | There is no age for learning

"Education is the key that unlocks the door to limitless opportunities, empowering minds to soar and dreams to become reality."

Salesforce Developer Interview & Certification Questions

1) How to Reset the user password through Developer Console? Please select the appropriate syntax.

A) Go to Developer Console. In Developer Console, 

    Click Debug – Open Execute Anonymous Window. 

    In Anonymous window you can use the following code to reset password.

    */ * SYNTAX * system.setPassword(‘‘, ‘Actual_Password_To_Be_Set’); */                      system.setPassword(‘005xx0000000XXX’, ‘New_Password_645’); 

B) Go to Developer Console. In Developer Console, 

 Click Debug – Open Execute Anonymous Window.
  In Anonymous window you can use the following code to reset password.
 */ * SYNTAX* system.setPassword(”, ‘Old_Password’,’Actual_Password_To_Be_Set’,);
*/
system.setPassword(‘005xx0000000XXX’, ‘oldpassword’, ‘New_Password_645’);

C) Go to Developer Console.In Developer Console, 

Click Debug – Open Execute Anonymous Window.
In Anonymous window you can use the following code to reset password.
*/
* SYNTAX
* system.setPassword(”, ‘Actual_Password_To_Be_Set’);
*/
system.setPassword(‘00D5i00000ABCED’, ‘New_Password_645’);

D) None of the Above

Correct Answer : A

2) The following example creates an sObject of type Account with the name Acme and assigns it to the acct variable.

A) Account acct = new Account(Name=’Acme’); 

 

B) Account a = new Account (); 

a.Name = Acc1;

C) Account a = new Account();

D) Both A & B

E) None of the above

Correct Answer : D

3) Variables that are declared with the generic sObject data type can reference any Salesforce record, whether it is a standard or custom object record.

True

False

Correct Answer : True

4) Choose the correct one below

Option 1 : A custom object with a label of Customer has an API name of Customer__c.
Option 2 : A custom field with a label of Description has an API name of Description__c.
Option 3 : A custom relationship field with a label of Items has an API name of Items__r.

A) Option 1

B) Option 2

C) Option 1, Option 2, Option 3

D) Option 3

Correct Answer : C

5) Which below DML statement can be used to combine or join three records of the same sObject type into one of the records, deleting the others, and re-parenting any related record

A) Upsert

B) Update

C) Database Class

D) Merge

E) None of the above

Correct Answer : D

6) What would be the output for this below code?

Set<Integer>SemMarks=new Set<Integer>{10,20,30,40,50};
Boolean b2=SemMarks.Isempty();
System.debug('No It is not empty ' +b2);

A) No It is not empty false

B) It is empty false

C) No It is not empty true

D) It is empty true

E) Throws Error

Correct Answer : A

7) Instead of using the equal operator (=) for comparison, you can perform fuzzy matches by using below operator.

A) Like

B) =:

C) IN

D) Between

E) All of the above

Correct Answer : A

8) This is a special data type in Salesforce. It is similar to a table in SQL and contains fields which are similar to columns in SQL.

A) Enum

B) sObject

C) Blob

D) List

E) Map

Correct Answer : B

9) Which method from Database class can be used to delete the records from Recycle bin? Example:
List MyList = [SELECT Id,Name From Account Where Industry='Media'];
DELETE MyList;

A) DataBase.emptyRecycleBin(MyList);

B) DataBase.emptyRecycleBin();

C) Database.undelete()

D) Database.delete()

E) Database.emptyRecycleBin(List ids)

Correct Answer : A

10) Upsert uses the sObject record's to determine whether it should create a new record or update an existing one

A) primary key (the ID)

B) an idLookup field

C) external ID field

D) All of the above

Correct Answer : C

11) Each DML statement accepts either a single sObject or a list (or array) of sObjects.

A) True

B) False

Correct Answer : A

12)What would be the output for below program? Map<String,String>chemicals =new Map<String,String>{'1000'=>'HCL','1002'=>'H2SO4','1003'=>'NH3'};
Set<String>setofkeys=new Set<String>(); setofkeys=chemicals.keySet();
System.debug('Values of set with Keys ' +setofkeys);

A) Values of set with Keys {1000, 1002, 1003}

B) Values of set with Keys {HCL, H2SO4, NH3}

C) Values of set with Keys {1000,HCL; 1002,H2SO4; 1003,NH3}

D) Values of set with Keys {‘1000,HCL’; ‘1002,H2SO4’; ‘1003,NH3’}

E) Through Error

Correct Answer : A

13) Choose the correct ones for External Id’s
1) An object can have at most 7 External IDs’ fields.
2) External IDs are indexed; meaning queries against them will run a bit faster.
3) External IDs are not indexed and thus non searchable
4) It is a user-defined cross-referenced field.

A) 1,2 & 3

B) 1,2 & 4

C) 1,2,3,4

D) 2,3,4

Correct Answer : B

14) 14)Given the code block:
Integer x;
for(x=0; x<10; x+=2)
{
if(x==8) break;
if(x==10) break;
}
System.debug(x);
Which value will the system.debug statement display?

A) 4

B) 10

C) 2

D) 8

Correct Answer : D

15) What is the data type returned by the following SOSL search?
[FIND ‘Acme’ IN Name Fields Returning Account, Opportunity];

A) List<List<Account>, List<Opportunity>>

B) Map<sObject, sObject>

C) List<List><sObject>>

D) Map<id, sObject>

E) None of the above

Correct Answer : C

16) SOQL statements in Apex can reference Apex code variables and expressions if they are preceded by a colon (:) The use of a local variable within a SOQL statement is called

A) Bind

B) System.asserts

C) Find {:}

D) (AND, OR)

E) None of the above

Correct Answer : A

17) When should You Use DML Statements or Database Methods?

1) Use DML statements if you want any error that occurs during bulk DML processing to be thrown as an Apex exception that immediately interrupts control flow (by using try. . .catch blocks).
2) Use Database class methods if you want to allow partial success of a bulk DML operation—if a record fails, the remainder of the DML operation can still succeed.
3) All DML operations in a transaction either complete successfully, or if an error occurs in one operation, the entire transaction is rolled back and no data is committed to the database.
4) When using Database class, you cannot write code that never throws DML exception errors.

A) 1 & 2

B) 1 & 3

C) 1 & 2 & 3

D) 2 & 4

Correct Answer : C

18) Which below statements are TRUE?

A) Use DML statements if you want any error that occurs during bulk DML processing to be thrown as an Apex exception

B) Use Database class methods if you want to allow partial success of a bulk DML operation

C) In Database class if a record fails, the remainder of the DML operation can still succeed

D) A & B

E) All three statements A,B and C are correct

Correct Answer : E

19) Which clause that can be used in a SELECT statement of a SOQL query when you’re querying data that contains polymorphic relationships.

A) Having Clause

B) TypeOf

C) Group By

D) Order By

E) None

Correct Answer : B

20) Methods with the future annotation must be static methods, and can only return a void type.

A) True

B) False

Correct Answer : E

21)The System.schedule() method of schedulable Asynchronous Apex takes how many arguments?
Option 1) A name for the job
Option 2) A CRON expression used to represent the time and date the job is scheduled to run,
Option 3) An instance of a class that implements the Schedulable interface.

A) 1, 2

B) 2, 3

C) 3, 2

D) 1, 2, 3

Correct Answer : D

22) Which trigger event only works with recovered records—that is, records that were deleted and then recovered from the Recycle Bin through the undelete DML statement.

A) after insert

B) after delete

C) after undelete

D) before update

E) None of the above

Correct Answer : C

23) Which exception below code return?
List str;
str.add(‘salesforce’);

A) Illegal assignment from List to String

B) DmlException

C) ListException

D) NoException

Correct Answer : A

24) Select appropriate Governor limits in Salesforce

A) Per-Transaction Apex Limits

B) Size-Specific Apex Limits

C) Miscellaneous Apex Limits

D) Email Limits

E) Push Notification Limits

F) All of the Above

Correct Answer : F

25) Below are the reasons to cause
1) The developer is trying to dereference a null object.
2) The developer is performing some DML and it fails.
3) The developer is assigning a list of records to a singleton object.

A) Exception Handling

B) Apex Handler

C) Governor Limits

D) Apex Debuging

E) None of the above

Correct Answer : A

26) In below list or set iteration for loops do not need the size or length of the collection to run?

A) for (initialization; Boolean_exit_condition; increment) {…….};

B) for (variable : list_or_set) {…….};

C) for (variable : [inline_soql_query]) {…….};

D) All of the Above

Correct Answer : B

27) I have a scenario where I need to Retrieve 50,000,000 of SOQL queries but normal Apex can retrieve 50,000 SOQL queries. What process or which apex I need to use to retrieve 50,000,000 queries?

A) Batchable

B) Queueable

C) @future

D) Schedulable

E) None of the Above

Correct Answer : A

28) The below code defines an Account list with no elements.
List accts = new Account[]{};

A) True

B) False

Correct Answer : A

29) What happens to the below code is executed String change = [SELECT Name FROM Account [0].Name.toLowerCase();

Correct Answer : A name that has been shifted to lower case is returned. The SOQL statement returns a list of which the first element (at index 0) is accessed through [0]. Next, the Name field is accessed and converted to lowercase with this expression .Name.toLowerCase()

30) Calling addError()in a trigger causes the entire set of operations to roll back, except when bulk DML is called with partial success.

A) @future(callout=true)

B) addError()

C) clear()

D) get(fieldName)

E) clone()

Correct Answer : B

31) In which Asynchronous Apex but provide additional job chaining and allow more complex data types to be used

A) future method

B)  Batch Apex

C) Queueable Apex

D) Scheduled Apex

Correct Answer : C

32) What happens when below code gets executed in Anonymous window. There is no record called ‘Apex’

Account m=[SELECT NAME from Account where NAME='Apex' LIMIT 1];
System.debug(m);

A)  Simply executes

B) Throw an exception called ‘System.QueryException: ‘

C) Throw an exception ‘System.sObject Exception:’

D) Retreivies Apex record

E) None of the above

Correct Answer : B

33) Which block always executes regardless of what exception is thrown, and even if no exception is thrown in Apex

A)  catch

B) finally

C) Try

D) Throws

Correct Answer : B

34) What is not counted for Apex CPU Time Limit?
Option A) Database operations like database operation for DML, SOQL and SOSL.
Option B) Execution of Visualforce Pages
Option C) Wait time for Apex Callout
Option D) Aggregate SOQL
Option E) If you perform more then 150 DML statements in one execution.

A)  Option A, B, C

B) Option A, B, D

C) Option A, B, C, D

D) Option A, C, D

Correct Answer : D

35) In which type of exceptions enable you to specify detailed error messages and have more custom error handling in your catch blocks.

A)  List Exception

B) NullPointer Exception

C) sObject Exception

D) Custom Exception

Correct Answer : D

36) Which annotation can be used to improve runtime performance by caching method results on the client

A) @AuraEnabled(cacheable=true)

B) @AuraEnabled

C) @InvocableMethod

D) @SuppressWarnings

Correct Answer : A

37) If you execute DML operations within an anonymous block, they execute using the current user’s object and field-level permissions

A) True

B) False

Correct Answer : A

38) In Apex you can insert records related to existing records if a relationship has already been defined between the two objects, identify the relationships

A) Lookup & Master-detail relationship

B) Self

C) Hierarchical

D) External

Correct Answer : A

39) Select which are correct for Batch Apex?
1) Using Batch apex, we can perform the DML operations on the bulk records at a time
2) Batch Apex allows us to process max. of 50 million records.
3) To implement the batch process, we need not use an interface called as Database.Batchable
4) All Batch Apex classes should be defined with the Access specifier "Global".
Select appropriate answer

A) 1,2,4

B) 1,3

C) 2,3

D) None of the above

Correct Answer : A

40) What is the purpose of @TestVisible?

A) We can include @TestVisible so that even though variable is private we can access from the test class

B) We can include @TestVisible so that even though variable is private we cannot access from the test class

C) We can include @TestVisible so that even though variable is private we can access from the another class

D) ExternalWe can include @TestVisible so that even though variable is private we can access from the another class

Correct Answer : A

41) Use the Approval.process method to submit an approval request and approve or reject existing approval requests

A) True

B) False

Correct Answer : A

42) Which method to submit an approval request and approve or reject existing approval requests.

A) Approval.ProcessSubmitRequest()

B) Approval.process(approvalRequests)

C) Approval.LockResult()

D)  Approval.unlock()

E)   None of the above

Correct Answer : B

43) In single email message class which methods can set up to 100 addresses & set the main body of the mail.
Option 1: setBccAddresses(bccAddresses)
Option 2: setCcAddresses(ccAddresses)
Option 3: setToaddress()
Option 4: setPlainTextBody()
Option 5: setHtmlBody(htmlBody)

A) 1,2,4

B)  2,4,3

C) 4,5

D) 3,4

E) None of the above

Correct Answer : D

44) How many numbers of jobs, a developer can queue using System.enqueueJob() at a time?
Option-1) 50 jobs to the queue with System.enqueueJob in a single transaction in Synchronous apex.
Option-2) In asynchronous transactions, you can add only one job to the queue.
Option-3) 100 jobs to the queue with System.enqueueJob in a single transaction in Synchronous apex.
Option-4) In asynchronous transactions, you can add only 5 job to the queue.

A) Option-1 & 2

B)  Option-2 & 3

C) Option-3 & 4

D) Option-4 & 1

Correct Answer : A

45) What is the process of Metadata API?
Option 1) Metadata API is to move metadata between Salesforce orgs during the development process.
Option 2) Metadata API does work directly with business data.
Option 3) Using Metadata API, you can deploy, retrieve, create, update, or delete customization-related information such as page layouts and custom object definitions.
Option 4) You can move metadata with one of two ways. The first method is with Metadata API deploy() and retrieve() calls.

A) Option-1 & 2

B)  Option-1,2 & 3

C) Option-2,3 & 4

D) Option-1,3 & 4

Correct Answer : D

46) Contact c=[SELECR id,FirstName,LastName,Email from Contact Where lastname='Ajay'];
What does the query return if there is no contact with the last name Ajay?

A) Null

B) System.QueryException occurs with no records found

C) DML Exception

D) Ajay record will return and store in database

Correct Answer : B

47) Check the below code ad choose the correct answer

List<Account>acc=new<Account>List();
Account a1= new Account(Name='Demo 1');
Account a2= new Account(Name='Demo 2');
Account a3= new Account(Name='Demo 3');
acc.add(a1);
acc.add(a2);
acc.add(a3);

Database.SaveResult[] srList = Database.insert(acc, true);
What happens if I give boolean value as true or false as one of the parameter in Database.insert(acc, true)
Option 1) In the above program when we give Database.insert(acc, true), if any errors occurs in any of the records a1,a2,a3 the entire operation of insert is rollbacked.

Option 2) In the above program when we give Database.insert(acc, false), if any errors occurs in any of the records a1,a2,a3 only that record is terminated and the status us saved to SaveResult class and rest of the operations are processed normally.

Option 3) Throws an Exception


Option 4) Simply records will get inserted

A) Option-1 & 2 are correct

B)  Option-1,2 & 3 are correct

C) Option-3 & 4 are correct

D)  Option- 4 & 1 are correct

Correct Answer : A

48) Which clause in a SOQL query to add subtotals for all combinations of a grouped field in the query results. This action is useful for compiling cross-tabular reports of data

A) GROUP BY ROLLUP

B)  GROUP BY CUBE

C) [GROUP BY fieldGroupByList]

D)  Having clause

Correct Answer : B

49) Identify which options does External objects don’t support below SOSL operators.

A) INCLUDES operator

B)  LIKE operator

C) EXCLUDES operator

D)  toLabel() function

E)  A,B,C

F) All off the above

Correct Answer : D

50) Identity the appropriate answer
Can we call callouts from the Triggers?

Option A) We cannot call the callouts directly from Triggers.
Option B) Instead we will define callouts in the future annotated methods and this future annotated method can be called from the Triggers.
Option C) Can we call 10 callouts in a single transaction.

A) Option A is only correct

B)  Option B is only correct

C) Option C is only correct

D)  Option A, Option B, Option C are correct.

Correct Answer : D

2 Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Help?