Friday, March 16, 2018

Salesforce Lightning Interview Questions & Answers

------------------------------------------------
Q. what is use of Lightning component framework ?
A. Lightning component framework helps to design out of box components with rich ecosystem and high performance. It is also Event-Driven architecture
Q. what are component in Salesforce Lightning ?
A. Components is a piece of code which helps to reusable to anywhere we want.
Q.Which Framework Lightning Supports ?
A. Lightning Supports component-based framework.
Q. How many types of events available ?
A. Component Event are managed by the component itself.
Application Event are handled by all components that are applying to the event. These events are essentially a traditional publish-subscribe model.
Q.What is Aura ?
A. Aura framework is builts Lightning Component framework and it helps to by apps
Q.what is SLDS stands for ?
A. Salesforce Lightning Design System
Q.What is Lightning Bundle ?
A.Lightning Bundle contains Component,Controller,Helper,style,documentation,rerender,design,SVG with it.
Q. To design Lightning components, Do we need to create a custom domain ?
A. Yes, we need to custom domain to built lightning component. By using custom domain helps use to make our organization more secure while authentication.
Q.Is it mandotary to create custom namespaces to develop lightning components ?
A. No, It’s Optional
Q. Can we access one lightning component on another lightning component in salesforce ?
A. Yes, We can able to access by using
Q. Can we access one javascript controller method on another controller method in salesforce lightning component ?
A. No, we can’t able to access
Q. Can we access one javascript helper method on another helper method in lightning Component ?
A. Yes,We can able to access
Q. Can we use external libraries in components ?
A. Yes, Lightning component supports various libraries such as Bootstrap,Gruntjs,angularJS ….
Q.By which interface helps us to show component in lightning Tabs ?
A. by adding implements=”force:appHostable”.It helps us to a component display in lightning Tabs.
Q.By which interface helps us to show component in lightning Record home page ?
A. by ading implements=”flexipage:availableForRecordHome,force:hasRecordId” and access=”global”
we can use record home page in Lightning Experience.
Q. How to make quick lightning action ?
A. with embedding script into our code implements=”force:lightningQuickAction”
Q.What are component Naming Rules in Salesforce Lightning ?
A These are Naming Rules in Salesforce Lightning
• Must begin with a letter
• Must contain only alphanumeric or underscore characters
• Must be unique in the namespace
• Can’t include whitespace
• Can’t end with an underscore
• Can’t contain two consecutive underscores
Q.How to use static resources in Lightning Application ?
A. we need show name which is stored in our static resource.
01<aura:component controller="FullCalendarController" implements="force:appHostable">
02      <ltng:require styles="{!$Resource.FullCalendarCSS + '/fullcalendar.css'}"
03         scripts="{!join(','
04          $Resource.FullCalendarJS + '/fullcalendar.js'
05          $Resource.jQuery + '/jquery.min.js',
06          $Resource.MomentJS + '/moment.min.js')}"
07         afterScriptsLoaded="{!c.scriptsLoaded}"/>
08      <aura:attribute name="events" type="Events[]" />
09      <div id="calendar"></div>
10  </aura:component>

Q. What are value providers in Salesforce Lightning ?
A. 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
Q. List of Global value providers ?
A. globalID
$Browser
$Label
$Locale
$Resource
Q.what is Custom Label ?
A. Custom Label helps to create multilingual applications by user language
Syntax : $A.get(“$Label.namespace.labelName”)
Q. How to add a button in Salesforce Lightning ?
A. lightning:button
Here's an example that creates a button with the brand variant, which displays a label on the button.
1<aura:component>
2    <lightning:button variant="brand" label="Submit" onclick="{! c.handleClick }" />
3</aura:component>
Here's another example that creates a button with the brand variant, which displays a label and icon on the button.
1<aura:component>
2    <lightning:button variant="brand" label="Download" iconName="utility:download" iconPosition="left" onclick="{! c.handleClick }" />
3</aura:component>
Q. How to make button to work on click in Salesforce Lightning ?
A. ui:button
Here is the simplest way.
1<input type="button" value="click" onclick="window.open('/apex/YOURVFPAGENAME')" />

You can also use standard component <ui:button> like below,
1<ui:button label="click" press="{!c.openVisualForcePage}" />
In this case, you need to controller.js like below,
1({
2    openVisualForcePage : function(component, event, helper) {
3        window.open('/apex/YOURVFPAGENAME');
4    }
5})
Q. What are list of tools are avaliable in salesforce lightning ?
A. Lightning Connect
Lightning Component Framework
Lightning Schema Builder
Lightning Process Builder
Lightning App Builder
Q.what is locker service in Salesforce Lightning ?
A. LockerService is a powerful security architecture for Lightning components. It enhances security by isolating Lightning components in their own namespace.
Q. What is @AuraEnabled ?
A. @AuraEnabled is helps to access methods in Lightning.
The AuraEnabled annotation is overloaded, and is used for two separate and distinct purposes.
  • Use @AuraEnabled on Apex class static methods to make them accessible as remote controller actions in your Lightning components.
  • 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.
Q. what is Lightning Data Service in Salesforce Lightning?
A. Lightning Data Service helps to create, edit, delete and loads in component without help of apex and it shares filed level security and sharing rules to us.
Q. What is Lightning Container in Salesforce Lightning ?
A. By Lightning Container, we can access third party framework such as angularJS , reactJS. To access those developed app need to store in static resource.
Q.Which chorme extenstion helps us to debug lightning applications ?
A. Salesforce Lightning Inspector
------------------------------------------------
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
.appApplication
.cmpComponent
.designDesign
.evtEvent
.intfInterface
.jsController, Helper, or Renderer
.svgSVG image
.cssStyle
.auradocDocumentation
.tokensTokens 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.
-----------------------------------------------------------------------------------------
1. What are the different types of Lightning events?
  • Browser: browser notifications that are triggered by user interaction with an element. Eg. onClick
  • System: fired by LC framework during LC lifecycle. They notify component states. Eg. init, render, afterRender
  • Navigation: force:navigateToURL, force:createRecord, force:editRecord
  • Component: A component event is fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.
  • Application: Application events follow a traditional publish-subscribe model. An application event is fired from an instance of a component. All components that provide a handler for the event are notified.


2. How to register, fire and handle a component and application event?
<aura:registerEvent name="componentEventFired" type="c:compEvent"/>
<aura:registerEvent name="appEvent" type="c:appEvent"/>

var compEvents = cmp.getEvent("componentEventFired");
compEvents.setParams({ "context" : parentName });
compEvents.fire();

var appEvent = $A.get("e.c:appEvent");
appEvent.setParams({ "context" : parentName });
appEvent.fire();
...
...
...
...
...
<aura:handler event="c:appEvent" action="{!c.handleApplicationEventFired}"/>
<aura:handler name="componentEventFired" event="c:compEvent" 
 action="{!c.handleComponentEventFired}"/>

{
 handleComponentEventFired : function(cmp, event) {
  var context = event.getParam("context");
 },

 handleApplicationEventFired : function(cmp, event) {
  var context = event.getParam("context");
 }
}
For more details, check the link below:
http://hellosnl.blogspot.in/2017/06/lightning-advanced-events-example.html


3. 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?
Answer: ui:button, ui:myCmp, and myApp.app.


4. Why do we use @AuraEnabled annotation?
  • Use @AuraEnabled on Apex class static methods to make them accessible as remote controller actions in your Lightning components.
  • 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

5. 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.


6. What is Namespace?
It is used to group related components together.


7. What is LockerService?
It enhances security by isolating Lightning components in their own namespace. A component can only traverse the DOM and access elements created by a component in the same namespace.


8. Examples of how to use some of the out-of-the-box events to enable component interation within your Lightning components?
$A.get("e.force:refreshView").fire(): reloads all data for the view.

createRecord : function (component, event, helper) {
    var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "Contact"
    });
    createRecordEvent.fire();
}

editRecord : function(component, event, helper) {
    var editRecordEvent = $A.get("e.force:editRecord");
    editRecordEvent.setParams({
         "recordId": component.get("v.contact.Id")
   });
    editRecordEvent.fire();
}


9. What is Lightning CLI?
It is a Heroku Toolbelt plugin that lets you scan your code for general JavaScript coding issues and lightning-specific issues.


10. Difference between bound and unbound expressions.
Bound expression {!expression}
  • Any change to the value of the childAttr attribute in c:child also affects the parentAttr attribute in c:parent and vice versa.
  • When you use a bound expression, a change in the attribute in the parent or child component triggers the change handler in both components.
Unbound expression {#expression}
  • Any change to the value of the childAttr attribute in c:child doesn’t affect the parentAttr attribute in c:parent and vice versa.
  • When you use an unbound expression, the change is not propagated between components so the change handler is only triggered in the component that contains the changed attribute.
For more details, check this link: http://hellosnl.blogspot.in/2017/05/data-binding-between-components.html


11. Use of THIS CSS class?
This adds namespacing to CSS and helps prevent one component's CSS from blowing away another component's styling.


12. How to set the value of an inherited attribute?
Use the <aura:set> tag.


13. 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.


14. 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').
For more details, check this link http://hellosnl.blogspot.in/2017/04/lightning-using-static-resources.html


15. 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?
http://hellosnl.blogspot.in/2017/05/which-button-was-pressed.html


16. 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?
http://hellosnl.blogspot.in/2017/05/configuring-lightning-components.html


17. 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.


18. How to delete a design attribute for a component that implements the flexipage:availableForAllPageTypes or forceCommunity:availableForAllPageTypes interface?
First remove the interface from the component before deleting the design attribute. Then reimplement the interface. If the component is referenced in a Lightning page, you must remove the component from the page before you can change it.


19. How to add Lightning components to your Visualforce pages?
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm
----------------------------------------------------------------------------------------
  1. What Is Lightning ?

    Answer :
    Lightning is the collection of tools and technologies behind a significant upgrade to the Salesforce platform.
    Lightning includes:
    Experience: A set of modern user interfaces optimized for speed. This includes the Lightning Experience, Salesforce1 Mobile app and template-based communities.
    Lightning Component Framework: A JavaScript framework and set of standard components that allow you to build reusable components to customize the Lightning Experience, Salesforce1 Mobile app and template-based communities and build your own standalone apps.
    Visual Building Tools: Drag-and-drop technologies for fast and easy app building & customization’s. Use the Lightning App Builder to customize the Lightning Experience and Salesforce1 Mobile app. Use the Community Builder to customize template-based communities.
    Lightning Exchange: A section of the AppExchange where you can find 70+ partner components to jump-start your development.
    Lightning Design System: Style guides and modern enterprise UX best practices to build pixel perfect apps that match the look and feel of the Lightning Experience and Salesforce1 Mobile app.
  2. How Can We Use Lightning Components With The Salesforce1 Mobile App ?

    Answer :
    By Create a custom Lightning tab that points to our component and include that tab in our Salesforce1 Mobile navigation.
  3. Can We Make A Lightning Component That Shows Up In Both The Mobile And The Desktop User Interfaces ?

    Answer :
    We can use Lightning Components directly in Lightning Experience, the Salesforce1 Mobile app, template-based communities, and custom standalone apps. Additionally, we can include Lightning components in a Visualforce page, that allowing us to use them in Salesforce Classic, Console, and Visualforce-based communities.
  4. Is Lightning An Mvc Framework ?

    Answer :
    No, it’s a component-based framework.
  5. Which Parts Of Lightning Components Are Server-side And Which Are Client-side ?

    Answer :
    Lightning Components are use JavaScript on the client side and Apex on the server side.
  6. Can We Make One Component Inherit Styles/css From A Parent Component, Or Must We Always Define It In The Component ?

    Answer :
    Yes, we can inherit styles from parent. there is no need to always defined in the component.
  7. What Is The Use Of The Aura:method Tag In Lightning ?

    Answer :
    we can Use < aura:method > to define a method as part of a component’s API. This enables us to directly call a method in a component’s client-side controller instead of firing and handling a component event. Using simplifies the code needed for a parent component to call a method on a child component that it contains.
  8. Can We Include One Component To Another ?

    Answer :
    Yes, we can Include one lightning component to another lightning component
  9. Is There Any Limit On How Many Component To Have In One Application ?

    Answer :
    there is no limit.
  10. Is Lightning Components Replacing Visualforce ?

    Answer :
    No.

  11. What Is Aura? Why Do We Use The Aura: Namespace In The Code ?

    Answer :
    Aura is the open source technology that powers Lightning Components. The aura: namespace contains all of the basic building blocks for defining components and applications.
  12. Do We Need A Namespace To Develop Lightning Components ?

    Answer :
    No. Lightning Components used to require a namespace, but that is no longer a requirement.
  13. What Are The Tools Included In Lightning ?

    Answer :
    Lightning Component Framework – Components and extensions that allow you to build reusable components, customize the Salesforce1 Mobile App, and build standalone apps.
    • Lightning App Builder – A new UI tool that lets you build apps lightning fast, using components provided by Salesforce and platform developers.
    • Lightning Connect – An integration tool that makes it easier for your Force.com app to consume data from any external source that conforms to the OData spec.
    • Lightning Process Builder – A UI tool for visualizing and creating automated business processes.
    • Lightning Schema Builder – A UI tool for viewing and creating objects, fields, and relationships.
  14. What Is Difference Between Visualforce Components And Lightning Components ?

    Answer :
    Visualforce components are page-centric and most of the work is done on the server. Lightning is designed from the component up, rather than having the concept of a page as its fundamental unit. Lightning Components are client-side centric, which makes them more dynamic and mobile friendly.
  15. Does Lightning Work With Visualforce ?

    Answer :
    yes Lightning work with Visualforce.
  16. Are There Any Css (styles) Provided By Salesforce.com As Part Of The Supported Lightning Components ?

    Answer :
    Yes. Salesforce Lightning Design System.
  17. Are Lightning Components Intended Only For Mobile Apps ?

    Answer :
    Components have been built to be mobile first, but with responsive design in mind. With Lightning we can build responsive apps fast for desktop, mobile and tablets.
  18. What Are The Advantages Of Lightning ?

    Answer :
    The benefits include an out-of-the-box set of components, event-driven architecture, and a framework optimized for performance.
    Out-of-the-Box Component Set -: Comes with an out-of-the-box set of components to kick start building apps. You don’t have to spend your time optimizing your apps for different devices as the components take care of that for you.
     Rich component ecosystem-: Create business-ready components and make them available in Salesforce1, Lightning Experience, and Communities.
    Performance – :Uses a stateful client and stateless server architecture that relies on JavaScript on the client side to manage UI, It intelligently utilizes your server, browser, devices, and network so you can focus on the logic and interactions of your apps.
    Event-driven architecture -: event-driven architecture for better decoupling between components
    Faster development – : Empowers teams to work faster with out-of-the-box components that function seamlessly with desktop and mobile devices.
    Device-aware and cross browser compatibility – : responsive design,supports the latest in browser technology such as HTML5, CSS3, and touch events.
  19. Can We Integrate Lightning Components With Another Framework, Such As Angular?

    Answer :
    Yes. we can include the working 3rd party code inside a Visualforce Page, embed the Visualforce Page inside a Lightning Component. This Lightning Component can be used as any other Lightning Component in various environments.

  20. Can We Include External Javascript/css Libraries In Components ?

    Answer :
    Yes ! we can use multiple libraries in our lightning component like JQuery, Bootstrap, custom CSS and custom Javascript libraries from a local resource (static resource).
  21. What Happens With Existing Visualforce Pages In Lightning Experience ?

    Answer :
    They’ll continue to be supported in the current UI and Lightning Experience.
  22. Where We Can Display Lightning Component ?

    Answer :
    There are a number of possibilities for display lightning component..
    Lightning Experience: We can display component in the Lightning Experience using the App Builder.we can edit the home page, edit a record detail page or create/edit a new app page to include it.
    Salesforce1 Mobile app: We can display component in the Salesforce1 Mobile app by creating a custom Lightning tab that references it and adding that tab in mobile navigation.
    Template-based community: we can display component in template-based (e.g. Napili) community using the Community Builder.
    Standalone Lightning app: By create a standalone Lightning app (e.g. myapp.app) and include component in this app. Access Lightning app by URL.
  23. Do I Always Create An App Bundle First When Develop Lightning Component ?

    Answer :
    Not necessarily, We can start with a Component bundle.
  24. How Can We Deploy Components To Production Org ?

    Answer :
    we can deploy component by using managed packages, Force.com IDE, Force.com Migration Tool or Change Sets.
  25. What Is Lightning Experience?

    Answer :
    Lightning Experience is the name for the all new Salesforce desktop app, with over 25 new features, built with a modern user interface and optimized for speed.
------------------------------------------------
  1. What are the type of events into Salesforce Lightning component
    1. Application Event(Salesforce Document)
    2. Component Event
    3. System Event(Salesforce Document)
  2. What is the basic difference between Application Event and Component Event
    1. The major difference between application and component event is that component event is used in child to parent components and application event can be used through out the application.
  3. Which interface need to implement so that you can use lightning component as quick action.
    1. force:lightningQuickAction
  4. Which interface need to implement so that you can use lightning component as Tab like custom object and VF page.
    1. force:appHostable
  5. Can we use Lightning Component into VF page? If yes how?
    1. Yes, using lightning out functionality of salesforce lightning component.
    2. For more details see Here
  6. How can we call child component controller method from the parent component controller method?
    1. Yes, we can call using aura methods.
    2. Salesforce Document
  7. What are the different Lightning component bundles?
    1. Component
    2. Controller
    3. Helper
    4. Style
    5. Document
    6. Design
    7. SVG
    8. Rendrer
    9. More Info Here(Salesforce Document)
  8. What is the use of Document and Rendrer in lightning component?
    1. Document: – A description, sample code, and one or multiple references to example components
    2. Client-side renderer to override default rendering for a component.
  9. How to ensure FLS while working with Lightning Component?
    1. Lightning Data Services already ensures Field Level Security and we can also use into the Apex using isAccessible, isCreateable, isDeleteable, isCreateable and etc methods of Schema class.
  10. Why we should go for Lightning Component instead of VF pages?
--------------------------------------------------------------------------------------------

Salesforce lightning Interview Question and Answers

What is Salesforce Lightning?
  • Lightning is the umbrella term for the collection of tools and technologies e.g. Lightning component framework, lightning experience, lightning app builder etc.
  • Lightning  became available in October 2015 with the release of Winter ‘16


What are Lightning components?
  • Components are the self contained source and reusable units of an app.
  • UI Framework - Built on Open Aura Framework.
  • It is used for developing web apps - For mobile and desktop devices.
  • It is a client server framework.
  • It helps to accelerate the development.
  • It helps to improve application peformance. It has stateful client and stateless server.
  • It has several reusable out of the box components.
  • A Component can contain other components, JS, HTML and CSS.
  • Encapsulated, configured through attributes and communicate through events.
  • LC are device aware and have cross browser compatibility.

What is Aura? What is the relation of Aura with Salesforce Lightning?
  • It is a UI Framework for developing dynamic web apps for mobile and desktop devices.
  • It is totally independent of Salesforce.
  • It has several out of the box components like button,checkbox,datagrid etc.
  • It is available at https://github.com/forcedotcom/aura
  • The aura namespace contains components to simplify your app logic, and the ui namespace contains components for user interface elements like buttons and input fields.
  • The Lightning Component framework is built on the open source Aura framework.


What is Lightning Experience
  • Lightning Experience is the new, modern user experience and interface for using Salesforce.
  • It has a modern and responsive design. It is optimized for users so that they can work very fast and easily on records so that they are more productive.
  • Not every feature of Salesforce is supported in Lightning Experience yet. Because of this, Salesforce Classic – is still available, and users can switch between Lightning Experience and Salesforce Classic with ease.
  • It is not necessary for the entire org to move to Lightning Experience at the same time. Certain users can enable Lightning Experience, while others can continue using Salesforce Classic.
  • Admins can enable Lightning Experience access at the user, profile, and organization level.

What are Lightning Apps?

Lightning Apps are made of Lightning components.
  • Lightning App  is a special top-level component whose markup is in a .app resource.
  • You can Access app using url of this pattern https://.lightning.force.com//.app
  • Mark up starts with
  • Types
    • Standalone – can be hosted outside SF1 and LE, like lightning out and VF pages
    • Lightning Experience and SF1 – Can take advantage of record create and edit pages, among other benefits

What is pre-requisite for learning Lightning component development?
  • Learn JavaScript. You must have intermediate level of JavaScript knowledge.
  • Learn concept of web components like google polymer, react,etc
  • Learn Single page app concept.
  • CSS3 Knowledge.
  • JavaScript debugging.
  • Apex knowledge for server side logic coding.

What is a Lightning Component Bundle? OR What is a Lightning component made up of?

A component bundle contains a component or an app and all its related resources.
  • CSS Styles
  • Controller
  • Design
  • Documentation
  • Renderer
  • Helper
  • SVG File

What are the types of events in Lightning?
  • Component events are handled by the 
    • component itself or 
    • a component that instantiates or contains the component.
  • Application events are handled by 
    • all components that are listening to the event. These events are essentially a traditional publish-subscribe model.

What is @AuraEnabled annotation used for?
  • The @AuraEnabled annotation enables client side access to an Apex controller method.
  • Providing this annotation makes your methods available to your Lightning components.
  • Only methods with this annotation are exposed. 

What is Lightning Design System (SLDS)?
  • The Salesforce Lightning Design System includes the resources to create user interfaces consistent with the Salesforce Lightning principles, design language, and best practices. 
  • It helps to create an intuitive UI with less number of clicks which is modern and beautiful.

What is the use of access=“global”?
  • Mark your resources, such as a component, with access="global" to make the resource usable outside of your own org. For example, if you want a component to be usable in an installed package or by a Lightning App Builder user or a Community Builder user in another org.

What are Component Attributes?
  • Component attributes are like member variables on a class in Apex.
  • They are typed fields that are set on a specific instance of a component, and can be referenced from within the component's markup using an expression syntax. 
  • Attributes enable you to make components more dynamic.
  • Use the tag to add an attribute to the component or app.
  • All attributes have a name and a type.
  • Attributes may be marked as required by specifying required="true", and may also specify a default value.
  
What is Lightning Data Services?
  • It is data Layer for Lightning
  • Can be equated to Standard Controllers in Visualforce
  • Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code.
  • No SOQL required.
  • Lightning Data Service handles sharing rules and field-level security automatically.
  • Declarative CRUD operations
  • Auto notify on record changes
  • Offline Access for Salesforce1
  • Lightning Data Service improves performance and user interface consistency.

What is Salesforce Lightning CLI?
  • It is part of  Salesforce DX CLI Command that lets you scan your code for general JavaScript coding issues and Lightning-specific issues.
  • Useful for preparing your Lightning components code for LockerService enablement.
  • Based on ESLint project.

Is Namespace required for lightning component creation?
  • If you’re not creating managed packages for distribution then registering a namespace prefix isn’t required, but it’s a best practice for all but the smallest organisations.


What are Local and Global ids with respect to lightning component?
  • 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 ID is created by using the aura:id attribute.
  • example
  • To find the local ID for a component in JavaScript, use cmp.getLocalId()
  • Every component has a unique globalId, which is the generated runtime-unique ID of the component instance.
  • A global ID  is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on.

What is the requirement for a component to be used in a custom tab in lightning experience or Salesforce1?

  • Add the force:appHostable interface to a Lightning component to allow it to be used as a custom tab in Lightning Experience or Salesforce1.
  • Components that implement this interface can be used to create tabs in both Lightning Experience and Salesforce1.

What is FlexiPage?
  • FlexiPage Represents the metadata associated with a Lightning page. 
  • A Lightning page represents a customizable screen made up of regions containing Lightning components.
--------------------------------------------------------------------------------------------

1. WHAT IS AURA FRAMEWORK

Aura is an open-source UI framework built by Salesforce for developing dynamic web apps for mobile and desktop devices. Salesforce uses Aura to build apps, such as Lightning Experience and Salesforce1.

2. WHAT IS DIFFERENCE BETWEEN APPLICATION EVENT AND COMPONENT EVENT

Component event: Component event is used to communicate with parent component using bubble event.

Application event: Application events: to broadcast to other components and not exclusively ancestors. Applications events can talk to many components that can be interested by the event.

3. WHAT IS THE USE OF IMPLEMENTS IN LIGHTNING COMPONENT

implement is used to implement multiple interface in lightning component. e.g. flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId

4. WHAT IS AURA:REGISTEREVENT IN LIGHTNING COMPONENT

A component registers that it may fire an event by using <aura:registerevent>

5. HOW CAN WE SUBSCRIBED TO AN EVENT IN LIGHTNING COMPONENT.

Use  <aura:handler> in the markup of the handler component.

6. HOW CAN WE COMMUNICATE BETWEEN TWO COMPONENT.

Lightning component can communicate using event communication framework. Read more about component communication patterns

7. HOW TO ADD LIGHTNING COMPONENT IN VISUALFORCE PAGE.

Lightning component can be added to visualforce page using ltng:outApp

8. WHAT IS AURA DEFINITION BUNDLE

Aura definition bundle contains following items
Component : UI for lightning component
controller.js : Contains client-side controller methods to handle events in the component.
helper.js: JavaScript functions that can be called from any JavaScript code in a component’s bundle
style: Contains styles for the component.
design: File required for components used in Lightning App Builder, Lightning pages, or Community Builder.
renderer: Client-side renderer to override default rendering for a component.
documentation: A description, sample code, and one or multiple references to example components
SVG: Custom icon resource for components used in the Lightning App Builder or Community Builder.

9. WHAT IS AURA:ATTRIBUTE

Attributes are like member variables on a class in Apex. They are typed fields that are set on a specific instance of a component, and can be referenced from within the component’s markup using an expression syntax.

10. WHAT IS LIGHTNING: OR UI: IN ANY LIGHTNING COMPONENT?

lightning: and ui: are two namespaces for core lightning component. The lightning namespace components are optimized for common use cases. 

11. HOW CAN WE EXTEND ANY COMPONENT

Lighting component can be extended using extensible=”true” attribute in aura:component 
--------------------------------------------------------------------------------------------
  1. What is Lightning ?
Lightning is the collection of tools and technologies behind a significant upgrade to the Salesforce platform. Lightning includes:
  • Experience: A set of modern user interfaces optimized for speed. This includes the Lightning Experience, Salesforce1 Mobile app and template-based communities.
  • Lightning Component Framework: A JavaScript framework and set of standard components that allow you to build reusable components to customize the Lightning Experience, Salesforce1 Mobile app and template-based communities and build your own standalone apps.
  • Visual Building Tools: Drag-and-drop technologies for fast and easy app building & customization’s. Use the Lightning App Builder to customize the Lightning Experience and Salesforce1 Mobile app. Use the Community Builder to customize template-based communities.
  • Lightning Exchange: A section of the AppExchange where you can find 70+ partner components to jump-start your development.
  • Lightning Design System: Style guides and modern enterprise UX best practices to build pixel perfect apps that match the look and feel of the Lightning Experience and Salesforce1 Mobile app.

2. How can we use Lightning Components with the Salesforce1 Mobile App ?
By Create a custom Lightning tab that points to our component and include that tab in our Salesforce1 Mobile navigation.

3. Can we make a Lightning Component that shows up in both the mobile and the desktop user interfaces ?
 We can use Lightning Components directly in Lightning Experience, the Salesforce1 Mobile app, template-based communities, and custom standalone apps. Additionally, we can include Lightning components in a Visualforce page, that allowing us to use them in Salesforce Classic, Console, and Visualforce-based communities.

4. Is Lightning an MVC framework ?
No, it’s a component-based framework.

5. Which parts of Lightning Components are server-side and which are client-side ?
Lightning Components are use JavaScript on the client side and Apex on the server side.

6Can we make one component inherit styles/CSS from a parent component, or must we always define it in the component ?
Yes, we can inherit styles from parent. there is no need to always defined in the component.

7. What is the use of the aura:method tag in Lightning ?
we can Use < aura:method > to define a method as part of a component’s API. This enables us to directly call a method in a component’s client-side controller instead of firing and handling a component event. Using simplifies the code needed for a parent component to call a method on a child component that it contains.

8. Can we Include One component to another ?
Yes, we can Include one lightning component to another lightning component

9. Is there any limit on how many component to have in one Application ?
there is no limit.

10. Is Lightning Components replacing Visualforce ? 
No.

11. What is Aura? Why do we use the aura: namespace in the code ?
Aura is the open source technology that powers Lightning Components. The aura: namespace contains all of the basic building blocks for defining components and applications.

12. Do we need a namespace to develop Lightning Components ?
No. Lightning Components used to require a namespace, but that is no longer a requirement.

13.What are the tools included in lightning ?
  •  Lightning Component Framework – Components and extensions that allow you to build reusable components, customize the Salesforce1 Mobile App, and build standalone apps.
  • Lightning App Builder – A new UI tool that lets you build apps lightning fast, using components provided by Salesforce and platform developers.
  • Lightning Connect – An integration tool that makes it easier for your Force.com app to consume data from any external source that conforms to the OData spec.
  • Lightning Process Builder – A UI tool for visualizing and creating automated business processes.
  • Lightning Schema Builder – A UI tool for viewing and creating objects, fields, and relationships.

14.What is difference between Visualforce Components and Lightning Components ?
Visualforce components are page-centric and most of the work is done on the server. Lightning is designed from the component up, rather than having the concept of a page as its fundamental unit. Lightning Components are client-side centric, which makes them more dynamic and mobile friendly.

15. Does Lightning work with Visualforce ?
yes Lightning work with Visualforce.

16.Are there any CSS (styles) provided by salesforce.com as part of the supported Lightning Components ?
Yes. Salesforce Lightning Design System.

17. Are Lightning Components intended only for mobile apps ?
Components have been built to be mobile first, but with responsive design in mind. With Lightning we can build responsive apps fast for desktop, mobile and tablets.

18. What are the advantages of lightning ?
The benefits include an out-of-the-box set of components, event-driven architecture, and a framework optimized for performance.
  • Out-of-the-Box Component Set -: Comes with an out-of-the-box set of components to kick start building apps. You don’t have to spend your time optimizing your apps for different devices as the components take care of that for you.
  •  Rich component ecosystem-: Create business-ready components and make them available in Salesforce1, Lightning Experience, and Communities.
  • Performance – :Uses a stateful client and stateless server architecture that relies on JavaScript on the client side to manage UI, It intelligently utilizes your server, browser, devices, and network so you can focus on the logic and interactions of your apps.
  • Event-driven architecture -: event-driven architecture for better decoupling between components
  • Faster development – : Empowers teams to work faster with out-of-the-box components that function seamlessly with desktop and mobile devices.
  • Device-aware and cross browser compatibility – : responsive design,supports the latest in browser technology such as HTML5, CSS3, and touch events.

 19. Can we integrate Lightning components with another framework, such as Angular?
Yes. we can include the working 3rd party code inside a Visualforce Page, embed the Visualforce Page inside a Lightning Component. This Lightning Component can be used as any other Lightning Component in various environments.

20. Can we include external JavaScript/CSS libraries in components ?
Yes ! we can use multiple libraries in our lightning component like JQuery, Bootstrap, custom CSS and custom Javascript libraries from a local resource (static resource).

21. What happens with existing Visualforce Pages in Lightning Experience ?
They’ll continue to be supported in the current UI and Lightning Experience.

22. Where we can display lightning component ?
There are a number of possibilities for display lightning component..
  •  Lightning Experience: We can display component in the Lightning Experience using the App Builder.we can edit the home page, edit a record detail page or create/edit a new app page to include it.
  •  Salesforce1 Mobile app: We can display component in the Salesforce1 Mobile app by creating a custom Lightning tab that references it and adding that tab in mobile navigation.
  • Template-based community: we can display component in template-based (e.g. Napili) community using the Community Builder.
  • Standalone Lightning app: By create a standalone Lightning app (e.g. myapp.app) and include component in this app. Access Lightning app by URL.

23. Do I always create an app bundle first when develop lightning component ?
Not necessarily, We can start with a Component bundle.

24. How can we  deploy components to production org ?
we can deploy component by using managed packages, Force.com IDE, Force.com Migration Tool or Change Sets.

25. What is Lightning Experience?
Lightning Experience is the name for the all new Salesforce desktop app, with over 25 new features, built with a modern user interface and optimized for speed.