Deprecated: Optional parameter $list declared before required parameter $is_script is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/class.redux_cdn.php on line 21

Deprecated: Optional parameter $register declared before required parameter $footer_or_media is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/class.redux_cdn.php on line 45

Deprecated: Optional parameter $register declared before required parameter $footer_or_media is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/class.redux_cdn.php on line 104

Deprecated: Optional parameter $expire declared before required parameter $path is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/class.redux_functions.php on line 54

Deprecated: Optional parameter $depth declared before required parameter $output is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/themes/entaro/inc/classes/megamenu.php on line 155

Deprecated: Optional parameter $depth declared before required parameter $output is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/themes/entaro/inc/classes/mobilemenu.php on line 147

Deprecated: Optional parameter $args declared before required parameter $wp_customize is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/extensions/customizer/extension_customizer.php on line 583

Deprecated: Optional parameter $args declared before required parameter $wp_customize is implicitly treated as a required parameter in /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/extensions/customizer/extension_customizer.php on line 606

Warning: Cannot modify header information - headers already sent by (output started at /home1/oijoiv2f/public_html/wp-content/plugins/apus-framework/libs/redux/ReduxCore/inc/class.redux_cdn.php:21) in /home1/oijoiv2f/public_html/wp-includes/feed-rss2.php on line 8
Salesforce Interview Questions Archives - Salesforce Next Gen https://salesforcenextgen.com/category/salesforce-interview-questions/ Trailhead and Beyond Mon, 28 Dec 2020 19:46:19 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 https://salesforcenextgen.com/wp-content/uploads/2020/10/cropped-76dc0dd6-326a-4956-a412-bfdf20c7fb23_200x200-32x32.png Salesforce Interview Questions Archives - Salesforce Next Gen https://salesforcenextgen.com/category/salesforce-interview-questions/ 32 32 Top 50 Salesforce Lightning Interview Questions 2018 https://salesforcenextgen.com/salesforce-lightning-interview-questions-2018/ https://salesforcenextgen.com/salesforce-lightning-interview-questions-2018/#comments Wed, 07 Feb 2018 08:55:57 +0000 http://www.salesforcenextgen.com/?p=1223 Salesforce Lightning Interview Questions Below is the comprehensive list of questions asked in Salesforce Lightning Interview Questions. 1. What are the type of events into Salesforce Lightning component? a. Application Event – Scope of this event is throughout the lightning App and any component which has registered for this event would get a notification. b. …
Continue reading Top 50 Salesforce Lightning Interview Questions 2018

The post Top 50 Salesforce Lightning Interview Questions 2018 appeared first on Salesforce Next Gen.

]]>
Salesforce Lightning Interview Questions

Salesforce Lightning Interview Questions Below is the comprehensive list of questions asked in Salesforce Lightning Interview Questions.

1. What are the type of events into Salesforce Lightning component?

a. Application Event – Scope of this event is throughout the lightning App and any component which has registered for this event would get a notification.
b. Component Event– Scope of this event is within itself or the parent component of this event, all the components declared within the parent component would get notified of this event.
c. System Event- these are the events fired by Salesforce’s system during the lifecycle of the lightning app.

2. What are the basic differences between Application Event and Component Event?

Component events are used to do communication between child and parent. They use bubbling and capture same as used in DOM events. A change in a child component can be communicated to the parent component via component event.

Application events are used to communicate any change in the component to a broader audience. Any component who has registered for this event will get a notified.
To use Component Event API we use the below syntax

3. When should we use Component event and application events?

It is best to always use a component event instead of an application event. Component events can only be handled by components above them in the containment hierarchy, therefore, their usage is localized to the components that need to know about them.

Application events are best used for something that should be handled at the application level, such as navigating to a specific record. Application events allow communication between components that are in separate parts of the application and have no direct containment relationship.

4. Which interface we are supposed to implement so that a lightning component can be used as quick action?

We need to implement the following “force: lightningQuickAction” so that we can use the component as a Quick Action

5. Which interface we are supposed to implement so that a lightning component can be used as a Tab?

We need to implement the following “force:appHostable” so that we can use the component as a Tab

6. How can we use a lightning component in a VisaulForce Page? Explain?

A Lightning component can be embed in any webpage using a very powerful and flexible feature, Lighting out. When used with Visualforce some complexity becomes simpler.
Lightning component can be added to Visualforce page in three steps:

1. We have to first Add the Lightning Components for Visualforce JavaScript library to your targetted Visualforce page using the tag.

2. Next we have to create and refer a Lightning app which is used to the component dependencies.

3. Lastly we need to write a JavaScript function which will finally create the the component on the page using $Lightning.createComponent()

7. How can we call child component controller method from the parent component controller method?

To call a child component’s controller method, we need to first create a aura:method which is publically accessible, aura:method is used to communicate down the containment hierarchy i.e. parent to child. Sample code for implementing the aura method:
Component code

Controller
({
publicmethod: function(cmp, event) {
var params = event.getParam(‘arguments’);
if (params) {
var message = params. str;
console.log(“message: ” + message);
return message;
}
}
})

Calling the cild method from parent controller
({
callchildCompMethod : function(component, event, helper) {
var childCmp = component.find(“childCompName”);
var Result =
childCmp. publicmethod (“message sent by parent component”);
console.log(“Result: ” + Result);
}
})

8. What are the different Lightning component bundles?
a. Component
b. Controller
c. Helper
d. Style
e. Document
f. Design
g. SVG
h. Rendrer

9. How to ensure FLS while working with Lightning Component?

FLS and CRUD are not automatically enforced in the lightning component whenever any object is referenced in the Apex Controller and the component will display the fields and records for which the users do not have access. Therefore we should manually enforce the FLS and CRUD in the Apex Controller, or we should try to use Lightning Data service wherever possible because it takes care of FLS and CRUD for us.

10. How can we use Lightning Components with the Salesforce1 Mobile App ?

For this purpose we need to first make a lightning tab which points to the lightning component we created and then we have to include that tab in the salesforc1 Mobile Navigation select list and the newly created tab to it.

11. Can we make a Lightning Component that shows up in both the mobile and the desktop user interfaces?

Lightning component is lightning experience ready by default and is also compatible in Salesforce1 App, it has a responsive layout therefore it adjust its resolution according the screen size and therefore can be used on desktop as well without writing any separate code.

12. Is Lightning component framework an MVC framework ?

No it is not a MVC framework it is a component based framework and event driven.

13. Which parts of Lightning Components are server-side and which are client-side ?

Lightning components have two types of controller, one which uses javascript and responds to the event occurring in the components at client side and the second controller which is an apex class. Method of apex controller are accessed by the JavaScript controller methods asynchronously.

14. Can we make one component inherit styles/CSS from a parent component, or must we always define it in the component ?

Child component inherits the CSS from its aren’t we do not need to specify it for each component

15. What is the use of the aura:method tag in Lightning ?

aura:method is used to communicate down the containment hierarchy i.e. parent to child

16. Can we Include One Lightning component to another ?

Yes we can include one Lightning component in another Lightning component

17. Is there any limit on how many component to have in one Application?

There is no limit on number of components defined within an application by salesforce

18. Is Lightning Components replacing Visualforce?

No Lightning component is not replacing Visualforce, Visualforce is still supported by Salesforce.

19. What is Aura? Why do we use the aura: namespace in the code?

Aura is a UI framework for developing dynamic web apps for mobile and desktop devices. Aura provides a scalable long-lived lifecycle to support building apps engineered for growth.

Aura supports partitioned multi-tier component development that bridges the client and server. It uses JavaScript on the client side and Java on the server side.

20. Do we need a namespace to develop Lightning Components?

You can have namespace in your org but it is not necessary to have a namespace to develop lightning component.

21. What are the tools included in lightning?

Lightning App Builder – It is a tool with User interface to use drag and drop functionality and create app fast by reusing the components, components can be standard or custom depending upon your requirement.
Lightning Component Framework- it provides a bundle that can be used to build reusable custom components, Standalone App and to customize Salesforce1 App
Lightning Connect – it is a powerful tool to facilitate the integration of force.com app with an external data source using OData specification
Lightning Process Builder – it is a visualization tool to build automation required for your business processes.
Lightning Schema Builder – it is a visualizing tool to view, create objects fields and relationship among them.

22. What is difference between Visualforce Components and Lightning Components?

Visualforce page is created keeping page as the center of the application and most of its calculation is performed at the server side. Lightning component on the other hand are created using the component based framework, most of the calculations are performed at the client side and makes the more dynamic and provide rich customer experience, also lightning component are build using mobile first approach.

23. Does Lightning work with Visualforce ?

Yes Lightning component works with Visualforce by implementing Lightning out as discussed earlier.

24. Are there any CSS (styles) provided by salesforce.com as part of the supported Lightning Components ?

Salesforce has provided lightning design system as the default css to be used with Lightning component.

25. Are Lightning Components intended only for mobile apps?

Although lightning framework creates component keeping mobile first approach, but its responsive design helps in providing the same experience over the desktop without writing separate lines of code

26. What are the advantages of lightning?

There are many advantages of using lightning like its out of the box component set which enables the fast paced creation of new apps, its event driven architecture which enables the easy decoupling between the components. Device awareness, cross browser compatibility and framework optimized for the performance.

27. Can we integrate Lightning components with another framework, such as Angular?

Yes we can integrate lightning with any 3rd party framework.

28. Can we include external JavaScript/CSS libraries in components?

It is possible to use custom CSS and JAvascriipt in the Lightning component

29. What happens with existing Visualforce Pages in Lightning Experience?

Most of the Visualforce page can be easily converted to lightning experience, but they are still supported by the salesforce and are not required to be converted

30. Where we can display lightning component?

Lightning component can be displayed at following places:
1. Lightning Experience
2. Salesforce1 App
3. Template-based Community
4. Standalone Lightning App
5. Visualforce Pages (Using Lightning out )

31. Do I always create an app bundle first when develop lightning component ?

No it is not necessary to create an Appp Bundle first to develop the lightning component

32. How can we deploy components to production org?

Lightning component can be deployed to the production via change sets, force.com IDE, Managed Package.

33. What is Lightning Experience?

It is the new user Interface developed by salesforce team, which is built on component based framework and event driven architecture, which provides a dynamic and responsive Experience to the user. This framework is built to provide optimum performance by using stateful Client side and stateless Server architecture

34. What is the use of implements in lightning component?

Implements is use to refer platform interfaces which enables a component to be used in different contexts or to grant access to extra context data, a component can implement more than one interfaces.

35. What is aura:registerevent in lightning component?

aura:registerevent is the notifier component and it declares that it may fire a particular event, it includes ‘name’ attribute which is relevant only to component event and is not used for application event. Other attribute is the ‘type’ which lets the component know which event would be fired.

Ex. <aura:registerEvent name=”Event” type=”c:EventName”/>

36. How can we subscribe to an event in lightning component?

To subscribe to an event in lightning component we need to include tag in the containment hierarchy. Subscription of these event depends on the event type i.e. component event or application event. For Component event we write below code.

In this ‘name’ attribute in should be exactly as name attribute in tag in the component which has fired the component. The ‘action’ attribute of sets the client-side controller action to handle the event. The ‘event’ attribute specifies the event being handled.
For Handling Application event we write below code

‘Event’ and ‘action’ attribute are same as the component event handling, it is just that we do not include ‘name’ attribute to handle the application event.

37. How can we communicate between two component?

In Lightning Component Framework, the communication between two component is accompalished supported in several ways.
1. Attributes or Methods to pass data down the component hierarchy
2. Lightning Events to pass data up and around in the component hierarchy

38. What is aura definition bundle?

It represents a Lightning definition bundle, it contains a Lightning definition and all its related resources. It could define a component, application, event, interface, or a tokens collection.

An AuraDefinitionBundle component is a collection of component definition files, each representing a different resource such as markup code, event documentations, applications and interfaces.

Lightning bundles must be under a top-level folder that’s named aura. Each bundle must have its own subfolder under the aura folder.

A bundle doesn’t have a suffix but definition files can have one of these suffixes
Suffix Component Type

Suffix

Component Type
.app Application
.cmp Component
.design Design
.evt Event
.intf Interface
.js Controller, Helper, or Renderer
.svg SVG image
.css Style
.auradoc Documentation
.tokens Tokens collection

39. What is aura:attribute?

They are same as member variable in apex classes, they are typed fields and are instance of a component. Attribute helps in making component more dynamic.

All attributes have a name and a type can be marked required by specifying ‘required=true’and can also have a default value. It has a naming rule as well:

1. Must begin with a letter or an underscore
2. Must contain only alphanumeric or underscore characters

40. What is lightning: or ui: in any lightning component?

Lightning has provided us with common User Interface components in the ui namespace which are used in the lightning component framework. They are ui:input and ui:output provide easy to implement common user interface.
Component with lightning namespace also provides us with the user interface but on top of that they include lightning design system CSS by default so we do not have to worry about the styling of these components.
41. How can we extend any component?

To make a component extendable we need to set value of ‘extensible’ attribute as ‘true’ of the aura:component tag.
When a component extends another component it inherits all of the helper methods and attributes

42. How to register, fire and handle a component and application event?

We register an event by by using the following code

<aura:registerEvent name=”sampleComponentEvent” type=”c:compEvent”/>

We fire event as shown below:

var compEvent = cmp.getEvent(“sampleComponentEvent”);

compEvent.fire();

Handle component event as below :

<aura:handler name=”sampleComponentEvent” event=”ns:eventName”

    action=”{!c.handleComponentEvent}” phase=”capture” />

Handle Application event as below:

<aura:handler event=”c:appEvent” action=”{!c.handleApplicationEvent}”/>

43. Let’s say that you have an app myApp.app that contains a component myCmp.cmp with a ui:button component. During initialization, the init() event is fired in what order?

ui:button, ui:myCmp, and myApp.app.

44. Why do we use @AuraEnabled annotation?

The AuraEnabled annotation provides support for Apex methods and properties to be used with the Lightning Component framework.
The AuraEnabled annotation is overloaded, and is used for two separate and distinct purposes.
1. Use @AuraEnabled on Apex class static methods to make them accessible as remote controller actions in your Lightning components.
2. Use @AuraEnabled on Apex instance methods and properties to make them serializable when an instance of the class is returned as data from a server-side action.

45. Why do we use $A.enqueueAction(action)?

It adds the server-side controller action to the queue of actions to be executed. Rather than sending a separate request for each individual action, the framework processes the event chain and batches the actions in the queue into one request. The actions are asynchronous and have callbacks.

46. Use of THIS CSS class?

This adds namespacing to CSS and helps prevent one component’s CSS from blowing away another component’s styling.

47. What are the different ways to conditionally display markup, and what is the preferred approach?

Using the <aura:if> tag
Use CSS to toggle visibility of markup by calling $A.util.toggleClass(cmp, ‘class’) in JavaScript code.

47. What is $Resource global value provider? Is it possible to obtain a reference to a static resource in Javascript code?

It lets you reference images, style sheets, and JavaScript code you’ve uploaded in static resources.

To obtain a reference to a static resource in JavaScript code, use $A.get(‘$Resource.resourceName’).

48. Let’s say you have several buttons that reuse the same onclick handler. How will you retrieve the name of the button that fired the event?

Use event.getSource() in the client-side controller to get the button component that was clicked. Call

getLocalId() to get the aura:id of the clicked button.

49. What are the names of interfaces that are added to a Lightning component to allow it to be used as custom tabs, and to be used in Lightning and Community builder?

‘force:appHostable’ Allows a component to be used as a custom tab in Lightning Experience or the Salesforce app
‘forceCommunity:availableForAllPageTypes’ To appear in Community Builder, a component must implement the forceCommunity:availableForAllPageTypes interface

50. What is the use of force:hasRecordId interface?

Add the force:hasRecordId interface to a Lightning component to enable the component to be assigned the ID of the current record.
The recordId attribute is set only when you place or invoke the component in a context of a record. For example, when you place the component on a record page, or invoke it as an action from a record page or object home. In all other cases, such as when you create this component programmatically inside another component, recordId isn’t set, and your component shouldn’t depend on it.

51. What is Lightning Design System (SLDS)?

The Salesforce Lightning Design System (SLDS) component library is actively developed to enable Salesforce developers to create a uniform look and feel across all Salesforce-related applications while adhering to CSS best practices and conventions.

52. What is the use of access=“global”?

The framework enables you to control access to your applications, attributes, components, events, interfaces, and methods via the access system attribute. The access system attribute indicates whether the resource can be used outside of its own namespace.
You can specify these values for the access system attribute.

Private: Available within the component, app, interface, event, or method and can’t be referenced outside the resource. This value can only be used for or .Marking an attribute as private makes it easier to refactor the attribute in the future as the attribute can only be used within the resource.
Accessing a private attribute returns undefined unless you reference it from the component in which it’s declared. You can’t access a private attribute from a sub-component that extends the component containing the private attribute.

Public: Available within your org only. This is the default access value.

Global: Available in all orgs.

53. What is Lightning Data Services?

They are similar to a standard controller in Apex coding, advantages of using lightning Data service are mentioned below
1. Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code.
2. Lightning Data Service handles sharing rules and field-level security for you.
3. In addition to not needing Apex, Lightning Data Service improves performance and user interface consistency.

54. What are Local and Global ids with respect to lightning component?

Component IDs
A component has two types of IDs: a local ID and a global ID. You can retrieve a component using its local ID in your JavaScript code. A global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.

Local IDs
A local ID is an ID that is only scoped to the component. A local ID is often unique but it’s not required to be unique.
Create a local ID by using the aura:id attribute. For example:
Find the button component by calling cmp.find(“button1”) in your client-side controller, where cmp is a reference to the component containing the button.

Global IDs
Every component has a unique globalId, which is the generated runtime-unique ID of the component instance. A global ID (1) is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on. A global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.

55. What is a FlexiPage in lightning?

FlexiPage
Represents the metadata associated with a Lightning page. A Lightning page represents a customizable screen made up of regions containing Lightning components.
A Lightning page region can contain upto 25 components.

Lightning pages are referred as FlexiPages in API and referred as Lightning pages elsewhere in SFDC documentation

56. How to make quick lightning action?

Add the force:lightningQuickAction or force:lightningQuickActionWithoutHeader interface to a Lightning component to enable it to be used as a custom action in Lightning Experience or the Salesforce mobile app. You can use components that implement one of these interfaces as object-specific or global actions in both Lightning Experience and the Salesforce app.

57. What are value providers in Salesforce Lightning ?
Value providers helps use to access data in Lightning Application .They are two value providers as v(View) and c(controller)
v is component attribute set which helps to access component attribute values in markup
c is component controller helps us to link with event handlers and action for the component

58. List of Global value providers?

$globalID
$Browser
$Label
$Locale
$Resource

59. What are list of tools are avaliable in salesforce lightning ?

Lightning Connect
Lightning Component Framework
Lightning Schema Builder
Lightning Process Builder
Lightning App Builder

The answer to the questions have been referred from https://developer.salesforce.com and are reiterated in my language. Please go to the community to better understand the concept and enhance your knowledge, meanwhile use this post a help during your interview.
Keep learning.

Also, Have a look at the below resources:

  1. Best Salesforce Interview Questions book with Apex and Visualforce concept explained

Also, Have a look at the below learning resources:

  1. SOQL (Salesforce Object Query Language)

  2. Apex Trigger Best Practices and the Trigger Framework

  3. Salesforce Interview Question and Answers Part 2

  4. Salesforce Interview Questions on Test Class

The post Top 50 Salesforce Lightning Interview Questions 2018 appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-lightning-interview-questions-2018/feed/ 2
Salesforce interview Questions Latest https://salesforcenextgen.com/salesforce-interview-questions-latest/ https://salesforcenextgen.com/salesforce-interview-questions-latest/#comments Mon, 21 Aug 2017 03:56:43 +0000 http://www.salesforcenextgen.com/?p=971 Salesforce interview Questions In this post, I have collected all the Salesforce interview Questions which were asked to me in  Salesforce interview for 2-3 years of experience. I have compiled these questions to the best of my knowledge. The answer provided here are answered to the best of my knowledge and they can be wrong, so kindly …
Continue reading Salesforce interview Questions Latest

The post Salesforce interview Questions Latest appeared first on Salesforce Next Gen.

]]>
Salesforce interview Questions

In this post, I have collected all the Salesforce interview Questions which were asked to me in  Salesforce interview for 2-3 years of experience. I have compiled these questions to the best of my knowledge.

The answer provided here are answered to the best of my knowledge and they can be wrong, so kindly refer Apex developer guide and visualforce guide and other means to verify the answers.

If you think any answer is incorrect then do mention the same in the comments.

Here goes the list of Salesforce Interview Questions

Q 1. Which of the below can’t be used in Apex DML Operation?

  1. a) trigger.old
  2. b) trigger.new
  3. c) trigger.new and trigger.old
  4. d) None of the above

Q2.When considering trigger context variables, which of the statement is true?

  1. a) We can delete trigger.new
  2. b) We cannot delete trigger. new
  3. c) trigger.new is always ready only
  4. d) trigger.new is ready only, so we can delete
  5. e) None of the statement is true

3. In Apex, if you want to make something public, you need to use the PUBLIC access modifier.

4. On deletion of parent record, the child record should not getddeleted, which relationship will satisfy this requirement?

  1. a) Lookup
  2. b) Master-Detail
  3. c) Many to Many
  4. d) Master to Master
  5. e) Both b & c

Q.5. Product manager at XYZ company is required to help their sales team in selling certain products, but product manager does not have access to the opportunities and his involvement is required in assisting the deal. How will a salesforce admin resolve this scenario?

  1. a) Notify the product manager using opportunity update reminders
  2. b) Enable opportunity teams and allow users to add the product manager.
  3. c) Use similar opportunities to show opportunities related to the product manager.
  4. d) Enable account teams and allow users to add the product manager.

Q.6. When would a developer use upsert and external IDs? (There are two correct answers.)

  1. a)To integrate with an external system.
  2. b) To migrate customizations from sandbox to production.
  3. c) To load related records without knowing Salesforce record IDs.
  4. d) To use the Web Services API to query for data.

Q7. Considering child to parent relationship, you can traverse —

  1. a) up to five levels
  2. b) up to one level only
  3. c) up to three levels
  4. d) up to four levels
  5. e) All of the above statements are true

Q.8. Which of the Data format and communication is supported by REST API?

  1. a) XML and Synchronous
  2. b) JSON, XML and Asynchronous
  3. c) JSON, XML and Synchronous
  4. d) JSON and Synchronous
  5. e) None of the above

9. Which of the authorizations are supported by SOAP API ?

  1. a) Session ID
  2. b) Oath 2.0
  3. c) Both Oath 2.0 and Session ID
  4. d) None of the above

Q.10. Write a SOQL query to find the Ids and Cust__c of the Object CustObj__c. CustF__c field should contain either of the below values —

*AAA and BBB selected or *CCC selected

Select id, Cust__c  from CustObj__c where CustF__c  includes(‘AAA;BBB’,’CCC’)

*CCC selected

Select id, Cust__c  from CustObj__c where CustF__c  includes(‘CCC’)

Q.11. Write an SOQL query which returns account IDs for all Accounts that do not have any open Opportunities?

select id from account where id in (select accountid from opportunity where stagename in (‘Closed Won’, ‘Closed lost’))

Q.12. Which of the below SOQL query is true?

  1. a) Select Account.Narne , (Select Note.Body From Account.Notes ) From Account
  2. h) Select Account.Name , (Select Note.Body From Account.Notes where Note.Body LIKE `D%’) From Account

Q.13. Which one is a valid exception handling block in Apex?

a) try { code block }

catch (exceptionType)

{ code_block }

finally code block

b) try { code block }

catch (exceptionType)

code block

}

c)try { code block }

catch (exceptionType) {

code block }

catch (Exception e){ }

d) All of the above.

e) None of the above.

Q.14. Class annotated with isTest must be declared as?

a)Private

b)Public

c)Global

d)Private and Public both

e) None of the above

Q.15. Which statement is False regarding the isTest annotation

  1. a) Classes defined as isTest must be declared as Private.
  2. b) Classes defined as isTest do not count against organizations limits for Apex scripts.
  3. c) Classes defined as isTest cannot be called from another class or trigger.
  4. d) Classes defined as isTest can only contain methods declared as test methods.
  5. e) None of the above

Q.16. Which triggers are invoked when two contacts are Merged?

  1. a) Only delete and update contact triggers
  2. b) Only delete and update triggers on the parent account
  3. c) No triggers
  4. d) Delete and update contact triggers and triggers on the parent account
  5. e) None of the above

Q.17. In Salesforce which fields are indexed automatically?

  1. a) Primary keys
  2. b) External lds
  3. c) Audit dates (such as last modified date)
  4. d) Only External ids and audit dates
  5. e) All of the above

Q.18. Given the controller code what is the expected output?

<apex:page controller=”the controller”>

{lout}

<apex: page>

public class theController

{

public string out{

get {

if(out== null) out = ‘getter’;

return out ;

}

set;

public theController()

{

Out= ‘constructor’;

}

public void setout

{ out = ‘action’; }

}

  1. a) null
  2. b) action
  3. c) constructor
  4. d) getter.

Q.19. Which among these is a valid SOQL to query all records in an organization, including delete and archived activities?

  1. a) SELECT count() FROM contact WHERE accountid = a.id QUERY ALL.
  2. b) SELECT count() FROM contact WHERE accountid = a.id INCLUDE ALL.
  3. c) SELECT count() FROM contact WHERE accountid = a.id ALL ROWS.
  4. d) None of the above.

Q.20. How can permission sets be used?

  1. a) To assign unique login hours for specific users
  2. b) To assign access to a custom object for specific users
  3. c) To assign access to a custom field for specific users
  4. d) Only b & c
  5. e) All of the above

Q.21. Customer wants to add a custom validation process to the contact save process. Before the record is created and saved to the database, the customer wants run a validation, which will checks if the associated account is active or not, this validation should be active for all UI as well as integration requests. Which design accomplish this

  1. a) A custom Web service
  2. b) A before insert trigger
  3. c) A custom Visualforce controller
  4. d) A client-side 5-control

Q.22. What types of element do list contains.

  1. a) Integer
  2. b) String
  3. c) Object
  4. d) Integer and string
  5. e) All of the above

Q.23. Which of the following code segments show a correct way of accessing data with Standard List Controllers?

  1. <apex:page standardController=”Account” recordSetVar—“accounts” >

<apex:pageBlock >

 <apex:pageBlockTable value=”{!accounts}” var=”a”>

 <apex:column value=”{!a.name}”/>

 </apex:pageBlockTable>

</apex:pageBlock>

 </apex:page>.

  1. <apex:page standardController=”Account” var=”accounts” >

<apex:pageBlock >

<apex:pageBlockTable value=”{!accounts}” var=”a”>

<apex:column value=”{!a.name}”/>

</apex:pageB1ockTabie>

</apex:pageBlock>

</apex:page>

  1. <apex:page standardListController=”Account” recordSetVar=”accounts” >

<apex:pageBlock >

<apex:pageBlockTable value=”{!accounts}” var=”a”>

<apex:column value=”f!a.namer>

</apex:pageBlockTable>

<apex:pageBlock>

<apex:page>

  1. <apex:page standardListController=” Account” var=”accounts” >

<apex:pageBlock >

<apex:pageBlockTable value=”{laccounts}” var=”a”>

<apex:column value=”a.name}”/>

</apex: pageBlockTable>

</apex:pageBlock>

</apex:page>.

Q.24. Which among these is a valid constructor for standard controller extension on Account?

  1. a) public myControllerExtension(ApexPages.Controller stdController){

this.acct= ( Account)stdController.getRecord();

}

  1. b) public myControllerExtension(ApexPages.StandardSetController stdController){

this.acct = (Account)stdController.getRecord();

  1. c) public myControllerExtension(ApexPages.StandardController stdController) {

this.acct = (Account)stdController.getRecord();

  1. d) None of the above.

The post Salesforce interview Questions Latest appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-interview-questions-latest/feed/ 5
Salesforce Interview Questions on Test Class https://salesforcenextgen.com/salesforce-interview-questions-test-class/ https://salesforcenextgen.com/salesforce-interview-questions-test-class/#comments Thu, 20 Jul 2017 12:28:30 +0000 http://salesforcenextgen.com/?p=836 Salesforce Interview Questions on Test Class here you will find interview questions related to Apex Test Class, this will help you in acing the interview. What is test class and why it is necessary? A test class is a class which helps in checking the quality of code before it can be deployed to Salesforce …
Continue reading Salesforce Interview Questions on Test Class

The post Salesforce Interview Questions on Test Class appeared first on Salesforce Next Gen.

]]>
Salesforce Interview Questions on Test Class

here you will find interview questions related to Apex Test Class, this will help you in acing the interview.

What is test class and why it is necessary?

A test class is a class which helps in checking the quality of code before it can be deployed to Salesforce Production. It helps in code coverage of an Apex class or Trigger.

What is code coverage and what is the minimum code coverage for class and trigger?

Code Coverage is the percentage number of lines covered by the test class by a total number of lines need to be covered.

Minimum code coverage for the trigger is at least 1% and for class, the overall code coverage of production should be above 75% before a new component can be deployed to the production.

Does Salesforce count calls to system.debug() against the code coverage?

No, Salesforce does not count it against the code coverage.

Q How is a class defined as a test class ?

We use annotation isTest before a class to declare it as a test class. By declaring it with isTest Annotation it is not counted against the org’s limit of 3MB of Apex Code.

how is a test method defined?

A test method is defined as mentioned below:-

Syntax: static testMethod void testMethodName(){….. Your Code here ……..}

What is seeAllData and why it is recommended to avoid using it?

Test classes run in a different context, i.e. a test class have no idea about the data stored in Salesforce, by setting seeAllData=true => @isTest(seeAllData = true)

Enabling this attribute exposes the data from the database to the test class.

It is recommended not to use as the code coverage of you apex class or trigger will now be dependent on the data which is present in org and depending upon that the code coverage may change.

What is the role of Test.start() and Test.Stop()?

Test class also abide by the governor limit of Salesforce and we often find ourself hitting governor limits in the test class. To avoid hitting this scenario Salesforce provided us with Test.start() and test.stop().

  • Code written between these methods receives a fresh set of governor limits.
  • It runs asynchronous methods synchronously.
  • These can be used only once per testMethod.

What is System.runAs() Method used for in a test Class?

Default execution mode of a test class is system mode, and if we want to run this test class as a specific user then we use system.runAs().

How many types of Assert Statements are there and what is their purpose?

Assert statements are used to compare expected value with the actual value.

There are three types of assert statements :

  1. assertEquals(expVal, actVal); returns true if expVal Matches actVal.
  2. assertNotEqual(expVal, actVal); returns true if expVal does not match actVal.
  3. assertEquals(expVal > actVal); returns true if the condition is satisfied.

What is @testVisible used for while testing an Apex class?

There could be a possibility that we need to access a private class member, but due to its accessibility, it is not visible to test method. To make them visible to test method we use @Testvisible before any private member in Apex class.

What are the best practices for test class?

There are many considerations while writing a test class few are mentioned below:-

Code coverage should not depend on the existing data in the org, i.e. sellAllData should not be true

For testing trigger and batch class we should do bulk testing with at least 200 records.

Testing should be done for the entire scenario not only for the code coverage.

************** more questions to come

The post Salesforce Interview Questions on Test Class appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-interview-questions-test-class/feed/ 8
Batch class : Salesforce Interview Question https://salesforcenextgen.com/salesforce-interview-question-batch-class/ https://salesforcenextgen.com/salesforce-interview-question-batch-class/#comments Mon, 17 Jul 2017 15:23:12 +0000 http://salesforcenextgen.com/?p=834 Salesforce Interview Question on Batch class What is Batch Apex? It is a class which is capable of accepting records in bulk and then depending upon the batch size the group of records are broken into Batches and are processed asynchronously. When should we use a batch class? We should batch apex when we are …
Continue reading Batch class : Salesforce Interview Question

The post Batch class : Salesforce Interview Question appeared first on Salesforce Next Gen.

]]>
Salesforce Interview Question on Batch class

What is Batch Apex?

It is a class which is capable of accepting records in bulk and then depending upon the batch size the group of records are broken into Batches and are processed asynchronously.

When should we use a batch class?

We should batch apex when we are dealing with records in bulk mainly the record size above 10000 and cannot be handled by the normal DML operations.

What is the basic structure of a Batch class?

the basic structure of a batch consists of three methods:

  1. Start
  2. Execute
  3. Finish

Describe each method of a batch class?

Start method:

Syntax: global Database.QueryLocator start(Database.BatchableContext BC)

This method receives the batchable context variable as an argument and returns a query locator variable.

Execute method:

Syntax:  global void execute(Database.BatchableContext BC, List<Account> scope)

This method receives the batchable context variable and an additional argument as scope which of list of subject type we are working with.

Finish method:

Syntax: global void finish(Database.BatchableContext BC)

This method receives the batchable context variable and is the last method which gets executed after all the batches have been processed, we can perform all the post execute logic in this method like sending an email etc.

What is a scheduler class?

A scheduler class implements the Schedulable interface and have to implement its execute method.

how to schedule a batch class ?

there are two ways to schedule a batch class:-

  1. Using developer console
  2. Using System Scheduler

By Developer console we have to pass a cron variable like below:-

AScheduleClass A = new AScheduleClass();

String schedule =  ’20 30 8 10 2 ?’; // cron object

String jobID = system.schedule(‘Merge Job’, schedule, A);

Via System Scheduler:

  1. Go to setup and in quick search bar type schedule. Then click on schedule apex.
  2. Select schedule created and set the time with help of the Salesforce UI.

Can we call a batch class from another batch class?

Yes, we can call one batch class from another batch class but only if it is called from its finish method.

Can we call a Future method from batch class?

no, we cannot directly call a future method from a batch class.

What is Database.Stateful used for in batch class?

As batch class runs asynchronously, to maintain the state of a variable across each batch we implement Database.Stateful.

How many can concurrent batch jobs be added to the queue?

At most, there can be 5 bath jobs queued at a time.

How can we track the status of the current running batch job?

The job Id returned by the batchable context variable helps us in finding the status of a batch through AsyncApexJob.Status.

Q . What is the purpose of start method in Batch Class?

Start object returns the list or group of records on which we are going to make changes.

What is database.getQuerylocator and what are its advantages?

It is used to fetch records from the database, if used in batch class it can fetch up to 50 millions records.

******* More questions to come

Want to learn more about batch Classes and Asynchronous Apex have a look at link below

Asynchronous Apex

The post Batch class : Salesforce Interview Question appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-interview-question-batch-class/feed/ 8
Salesforce Interview Questions on Trigger https://salesforcenextgen.com/salesforce-interview-questions-trigger/ https://salesforcenextgen.com/salesforce-interview-questions-trigger/#comments Thu, 13 Jul 2017 08:41:26 +0000 http://salesforcenextgen.com/?p=824 Salesforce Interview Questions on Trigger What is a Trigger? Trigger can invoke Apex code, they come in handy when we want to perform some custom task just before or after a record is either created updated or deleted. What are the various event on which a trigger can fire? A trigger is a set of …
Continue reading Salesforce Interview Questions on Trigger

The post Salesforce Interview Questions on Trigger appeared first on Salesforce Next Gen.

]]>
Salesforce Interview Questions on Trigger

What is a Trigger?

Trigger can invoke Apex code, they come in handy when we want to perform some custom task just before or after a record is either created updated or deleted.

What are the various event on which a trigger can fire?

A trigger is a set of statement which can be executed on the following events:

  1. Undelete
  2. Update
  3. Merge
  4. Delete
  5. Upsert
  6. Insert

 Broadly classify the Trigger?

Triggers can be broadly classified as before or after Trigger.

  • Before triggers are used to perform a task before a record is inserted or updated or deleted.
  • After triggers are used if we want to use the information set by Salesforce system and to make changes in the other records

What are the considerations while implementing the Triggers?

Consider the following before implementing the triggers.

  • Upsert trigger fires on 4 different events :- before(insert, update), after (insert, update)
  • Merge trigger are fired on both events on delete
  • Field history is updated after the trigger has successfully finished processing data.
  • Any callout should be asynchronous so that trigger does not have to wait for the response.
  • A trigger cannot have a static keyword in its code.
  • If a trigger completes successfully the changes are committed to the database and if it fails the transaction is rolled back.

Read the Apex Developer Guide for more detailed considerations.

Write the syntax of Apex Trigger?

Trigger TName On ObjName(name the events){

……. Apex code here ……..

}

What are context variables in regards to trigger?

Following are the context variable available in triggers. Please note variable’s availability varies according to the type of trigger events.

  1. isExecuting
  2. isInsert
  3. isUpdate
  4. isDelete
  5. isBefore
  6. isAfter
  7. isUndelete
  8. new
  9. newMap
  10. old (update and delete only)
  11. oldMap (update and delete only)
  12. size

How is Trigger.New Different from Trigger.newMap?

Trigger.New variable returns the list of sObject which has invoked the trigger and Trigger.NewMap returns the map of ID’s with the newly entered records. NewMap is only available in after insert, before and after the update and after undelete.

How is Trigger.new different from Trigger.old?

Trigger.New variable returns the list of sObject which has invoked the trigger and Trigger.old returns a list of the older versions of the records which have invoked the trigger. Trigger.Old is only available in update and delete events

Can a trigger call a batch class?

Yes, we can call a batch class in the trigger as we do in the normal apex code.

Can a trigger make a call to Apex callout method?

we can call a callout method in Apex Trigger but the only condition is that it has to be an asynchronous callout because the trigger flow cannot wait on the response received by the callout method.

Define Recursive Trigger and how to avoid it?

There is a possibility that the result of the trigger can end up calling the same trigger again and can run in a loop, this is known as a recursive trigger. To avoid this scenario we should create a static variable and check the value of this variable before we execute anything in the trigger.

What do you mean by the bulkifying trigger?

A trigger that can handle both single record and thousands of record. It is capable of handling mass action.

Is there any limit on number of triggers define on an object?

We can define as many triggers on an object as we want but it is recommended to have one trigger per object because the order of execution of different trigger is not guaranteed and any trigger can fire first.

Can you explain the order of execution in Triggers?

Following is the order of execution of events which Salesforce perform before a DML Event.

  1. The record is loaded from the database or is initialized in case of upset statement.
  2. New record’s field values are overwriting the old values, now depending on the origin of the request this flow varies: if the request is from a UI page then the following validations are performed by Salesforce:
    1. Any layout specific rules are checked
    2. All the required values are checked at layout and field level
    3. All the field formats are validated along with the maximum length of field values

If the request originates other than UI then Salesforce only checks for Validation of foreign keys.

  1. Now all the before triggers are executed at the database.
  2. Most of the validations are performed again to verify that all the required fields are holding some values and are not null, at this step user defined validations are also executed and the only validation which is not repeated in this step are the rules specific to the layout.
  3. After the success of the previous step, the record is reviewed for duplicate records, by running the duplicate rule. If a duplicate is found the flow is stopped and no further actions performed.
  4. In this step, record is saved to the database but it not committed yet.
  5. Now all the after Triggers are executed.
  6. In this step, assignment rules are executed.
  7. Now if there is any auto-response rule is present then they are executed.
  8. Next in the queues are the workflow, they are executed after the auto response.
  9. If the workflow was updating a field, then the fields updated in this step and the flow after this step varies if this was the case.
  10. If a field was updated then the before and after update triggers are fired once more and standard validation are also executed again. Custom validation escalation rule and duplicate rules are not required to run again.
  11. Once the execution has reached this stage, then process is fired if there are any declared on the object.
  12. Now the escalation rules are executed.
  13. Entitlement rules are executed if any.
  14. If there are any roll-up summary field, then they are calculated at this step and the parent object go through the save process.
  15. Now the sharing rules are executed.
  16. If we reach this stage, then that means no error has occurred and the data is ready to be committed to the database and is committed now.
  17. Now if there is any post-commit logic like email, then that is executed.

The post Salesforce Interview Questions on Trigger appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-interview-questions-trigger/feed/ 11
Salesforce Interview Question and Answers Part 2 https://salesforcenextgen.com/salesforce-interview-question-answers-part-2/ https://salesforcenextgen.com/salesforce-interview-question-answers-part-2/#comments Tue, 11 Jul 2017 16:16:32 +0000 http://salesforcenextgen.com/?p=814 Salesforce Interview questions on DML Q. How many types of DML statements does Salesforce supports? A. There are altogether 6 types of statements:- Insert Delete Update Merge Undelete Upsert Q. How many DML statements are allowed in on transactions? A. Salesforce allows 150 DML statements per transaction. Q. What is difference between insert and Database.insert()? …
Continue reading Salesforce Interview Question and Answers Part 2

The post Salesforce Interview Question and Answers Part 2 appeared first on Salesforce Next Gen.

]]>
Salesforce Interview questions on DML

Q. How many types of DML statements does Salesforce supports?

A. There are altogether 6 types of statements:-

  1. Insert
  2. Delete
  3. Update
  4. Merge
  5. Undelete
  6. Upsert

Q. How many DML statements are allowed in on transactions?

A. Salesforce allows 150 DML statements per transaction.

Q. What is difference between insert and Database.insert()?

A. The main difference between them is that Database.insert, lets one process partial record processing if an error is encountered during the processing of bulk records.

Q. How to undelete a record from recycle bin with the help of DML?

A. For this to work records should be deleted and present in the recycle bin:

For eg : List<contacts> cons= [select id from contact where isDelete = true ALL ROWS];

Undelete cons;

Q. What happens to the child record when we merge two records?

A. You can merge max 3 records in one time and Salesforce deletes the other records and reparent the child records.

Salesforce interview Questions SOQL

Q. What is SOQL?

A. It stands for Salesforce Object Query Language.

Q. How many SOQL we can perform per transaction?

A. We can perform 100 SOQL statements per transactions.

Q. How can we fetch top 5 opportunity according to the amount?

A. Select Name, id from opportunity order by desc amount limit 5.

Q. How many records can we fetch using one SOQL query?

A. We can get upto 50000 rows of records per SOQL query.

Q. How can we fetch related contact records by querying on Account object?

A. We would have to use inner query to fetch all the child records using their relationship name.

Select Name, id, (select name from contacts) from account

Q. What is SOSL?

A. It stands for Salesforce Object search language.

Q. How it is different from SOQL?

A. We can search for a value in more than one object in one SOSL query. Its syntax is also different with respect to SOQL. We can only perform 20 SOSL per transaction and we can only see 2000 rows of returned records.

Q. How to use filter on Name field if only partial string value is known?

A. SELECT Name, id FROM Account WHERE Name LIKE ‘Z%’

Q. What is the correct way to use date in where clause?

A. For this we need to make sure that the field we are using in where clause is of type Date or DateTime as syntax for both are different.

For DateTime: SELECT Name, id FROM contact WHERE CreatedDate > 2017-04-26T10:00:00-08:00

For Date         : SELECT Name, id FROM contact WHERE CreatedDate > 2017-04-26

Q. How to filter Boolean field in SOQL?

A. The syntax of where clause would be something like this:- ’ Where BolleanFieldName = True ‘

Q. How to use Multi Select picklist as a filter while fetching data using SOQL?

A. For Exact match of ABC and EFG below statement is used

SELECT Id, Name, FieldNameMultiSelectPl__C FROM CustomObjectName__c WHERE FieldNameMultiSelectPl__C = ‘ABC;EFG’

Or for multiple values.

SELECT Id, Name, FieldNameMultiSelectPl__C FROM CustomObjectName__c WHERE FieldNameMultiSelectPl__C includes (‘ABC;EFG’ ,’CDE’  )

Q. How many characters are allowed in a where clause?

A. We are allowed to use maximum of 4000 characters in a where clause per SOQL.

Q. What are the considerations for using Group by clause?

A. There are some fields on sObject which are not supported in grouping.

If a query includes Group by clause then it cannot be used with queryMore() method.

Relationship queries cannot be used in conjunction with Group By clause.

***** more questions to come 

Next: 

The post Salesforce Interview Question and Answers Part 2 appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-interview-question-answers-part-2/feed/ 7
Salesforce Interview Questions and Answers Part 1 https://salesforcenextgen.com/salesforce-interview-questions-answers-part-1/ https://salesforcenextgen.com/salesforce-interview-questions-answers-part-1/#comments Sat, 08 Jul 2017 07:10:08 +0000 http://salesforcenextgen.com/?p=798 Salesforce Interview Questions and Answers What is Salesforce and what is the architecture of Salesforce? A. Salesforce is a Cloud based software made on Force.com platform, it has a pre-built feature to serve as a CRM,              but Salesforce is not limited to be called CRM, It has many out of …
Continue reading Salesforce Interview Questions and Answers Part 1

The post Salesforce Interview Questions and Answers Part 1 appeared first on Salesforce Next Gen.

]]>
Salesforce Interview Questions and Answers

  1. What is Salesforce and what is the architecture of Salesforce?

A. Salesforce is a Cloud based software made on Force.com platform, it has a pre-built feature to serve as a CRM,              but Salesforce is not limited to be called CRM, It has many out of the box features. Salesforce uses Multitenant            architecture

2. What is Multitenancy?

A. It is the methodology in which all users share IT related resources to make it cost effective even for a small business. It helps in reducing the initial cost of starting a new.

Salesforce interview question                                      Salesforce interview question

Images sourced from site https://developer.salesforce.com/page/Multi_Tenant_Architecture

3. Can you explain multi-tenant Data model?

A. To deal with a tremendous, constantly changing arrangement of the genuine database, Force.com implements it storage model with the help of metadata, data and pivot table as described in the diagram below.

Salesforce interview question

Images sourced from site https://developer.salesforce.com/page/Multi_Tenant_Architecture

4.  Describe an object in Salesforce? How many types of objects are there in Salesforce?

A. They are similar to database tables of an organization and are used to store a record in Salesforce. Salesforce has provided us with some predefined objects which are known as standard objects and Salesforce has provided us with the ability to create new objects which are known as the Custom object.

5. What is the distinguishing factor between the standard object and custom object?

A. API name of Custom objects contains a suffix of ‘__c’. It is added automatically by Salesforce. E.g customobjectName__c

6. What is a field and how many types of field are there in Salesforce?

A. There are 4 types of fields, 1) Compound Field 2) system Field 3) required Field 4) custom field

7. What is a relationship field in Salesforce and how many types of relationships are there in Salesforce?

A. A relationship field is the one which associates one object with another object. A relationship can be formed between standard objects, custom objects and also between custom and standard objects. Salesforce provides three type of relationships, 1) Lookup 2) Master-Detail Relationship 3) External Relationship, the first two are the most common relationship used throughout the Salesforce.

8. The difference between lookup and master-detail relationship?

A. There are fundamental differences in the behavior and record sharing that you need to read up on.

The most important difference is that master-detail has a direct dependency between the objects:

You cannot have a detail record without a master.
The detail record inherits sharing rules from the master.
The maximum number of master-detail relationships are limited to two.
All related detail objects are deleted if the master object is deleted.

Lookups are used when the behavior of the master-detail – particularly around sharing rules, profile permissions and cascade delete are not required.
when multiple parents need to be referenced then we use look-up

9. Define Self Relationship in Salesforce?

A. It is a look up Relation to the same object.

10. How many types of Object Relationships are supported by Salesforce?

A. Salesforce supports three types of object relationship: 1) one -to- one 2) one – to – many 3) many – to – many

11. What is a trigger, when do we use before and after trigger?

A. A trigger is the flow of code which initiates before or after a DML Event. i.e. before insert or after update etc. We use before trigger if we want to process data before the record is committed and after trigger where we want to use the values from the committed record to change the value in other object’s record.

Salesforce interview Questions based Apex Collections

 Apex Collections are set of identical elements grouped together in a collection. A collection can be of three types list, set and map. Interview related questions as per the ones which I have faced during my interviews.

Q.What are the types of collections which are supported by salesforce?

A. Salesforce supports three types of collections

  1. List
  2. Set
  3. Map

Q. What are the difference between list, set and maps?

A. There are many differences between these collections.

  1. List is ordered, it allows duplicate values, values entered can be indexed. Sort method is available and contains methods is not available.
  2. Set is unordered, it does not allow duplicates and values entered cannot be indexed. Sort Method is not available and contains method is available in set.
  3. Map is a key value pair collection. It uses containsKey method, keyset() to get only the keys, values() to fetch all the values.

Q. what is the difference between add() and addAll() method?

A add() is used to add only one element in the collection and addAll() is used to add a collection to another similar collection.

Q. how to check whether a list is null or empty?

A. We check a list is empty or null by checking following condition/

If((listObj != null)&&(list.size()>0))

****More Questions to come 

Next: 

The post Salesforce Interview Questions and Answers Part 1 appeared first on Salesforce Next Gen.

]]>
https://salesforcenextgen.com/salesforce-interview-questions-answers-part-1/feed/ 4