Backbone.js Interview Questions and Answers
Q1. What is Backbone.Js ?
Backbone.Js offers shape to web programs by using presenting fashions with key-cost binding and custom activities, collections with a rich API of enumerable functions, perspectives with declarative occasion coping with, and connects all of it on your existing API over a RESTful JSON interface.
Q2. In which language, spine JS is writeen?
Q3. What are primary additives of Backbone Js?
Event elegance object
Q4. What are the three js documents which can be required to setup a running environment for Backbone.Js?
Ans: You are required following 3 js files to setup a operating environment for Backbone.Js
Q5. What are the keypoints of Backbone?
Ans: It has tough dependency with underscore.Js to make it extra practical and assisting.
With jQuery it has a smooth dependency.
When the model adjustments it could update the HTML of your application routinely.
Significantly smooth and stylish way for DOM manipulations and UI updates
In your utility positioned these files inside js folder and use it for your index.Html web page.
Q6. What is a set in Backbone.Js?
Ans: In Backbone.Js, the collection is used to symbolize ordered set of fashions. Any occasion in version triggers an occasion in collection without delay. For instance, you could bind “alternate” occasion to be notified in a case while any version inside the collection has been modified.
Q7. What is ModelBinder in Backbone.Js?
Ans: The ModelBinder class is used to make synchronization manner of views and models collectively.
Q8. What is Backbone.Sync?
Ans: When Backbone desires to store or examine a version to the server it calls out a function called as Backbone.Sync
Q9. What is the distinction among the houses “id” and “cid” on a version object?
Ans: The “id” property on a model is routinely assigned primarily based at the “identity” set inside the version’s attributes hash. Ideally, this is the ID which you get hold of from the rest API for the resource which you are querying. On the alternative hand, “cid” is an ID quickly assigned to every version and is useful till an real ID is decided for the object. For example, a model driven to a collection that has no longer but been endured may be addressed using “cid”, until it's miles stored in the database and an real ID is generated for it.
Q10. List Dependencies of the use of BackboneJs?
Ans: Backbone’s Js most effective difficult dependency is Underscore.Js ( >= 1.Eight.3). For RESTful persistence and DOM manipulation with Backbone.View, consist of jQuery ( >= 1.11.Zero), and json2.Js for older Internet Explorer guide. (Mimics of the Underscore and jQuery APIs, including Lodash and Zepto, can even generally tend to paintings, with varying stages of compatibility.)
Q11. List out configuration options to be had in Backbone Js?
Q12. What is a converter in Backbone Js ?
Ans: When a model’s attribute is copied to an HTML element or when an HTML detail’s cost is copied right into a model’s attribute, a characteristic is known as, this function is called a converter in Backbone Js.
Q13. How are models attributes stored in Backbone.Js?
Ans: In Backbone.Js models attributes stored in a hash.
Q14. What is Router in Backbone? How do you create a Router with Backbone?
Ans: Backbone Router is used for routing client-side packages and connects them to actions and activities the usage of URLs. Backbone.Router is used to create a Router with Backbone.
Q15. How to Create a Model In Backbone js?
Ans: Creating a Model in Backbone Js
Person = Backbone.Model.Amplify( initialize: characteristic() alert("Welcome to Backbone Js"); ); var character = new Person;
Q16. What is the characteristic of toJSON?
Ans: toJSON is used for persistence, serialization and for augmentation earlier than being sent to the server.
Q17. What Are “:params” And “*splats” In Dynamic Routing?
Backbone makes use of kinds of variables while imposing routes:
“:params” healthy any URL additives among slashes. You can specify single fragment the usage of “.Params”
“*splats” fit any quantity of URL fragments after the query.
Note that because of the nature of a “*splat”, it's going to usually be the closing variable for your URL as it will in shape any and all additives.
“*splats” or “:params” in path definitions are handed as arguments (in respective order) to the related function.
A route defined as “/:direction/:movement” will skip 2 variables (“route” and “action”) to the callback function.
Q18. What Is “el” Property Of Backbone.Js View?
Ans: The “el” property references the DOM object created within the browser. Every Backbone.Js view has an “el” belongings, and if it is not defined, Backbone.Js will construct its personal, which is an empty div detail.
Q19. What Are The Configuration Options Available?
Ans: The configuration alternatives available are:
Q20. What is Collection in Backbone?
Ans: A series is a fixed of fashions which binds activities whilst the version has been changed within the collection. Collection includes a listing of models that may be processed within the loop and supports sorting and filtering. When creating a set, we are able to outline what form of version that collection is going to have along side the instance of homes. Any occasion triggered on a model, so that it will also cause on the collection in the model.
Q21. In a Backbone View, what is the use of setElement?
Ans: setElement function is used whilst Backbone view has to be applied to a one-of-a-kind DOM detail.