Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Backbone.js Interview Questions

A list of top frequently asked Backbone.js interview questions and answers are given below.

1) What is Backbone.js?

Backbone.js is a JavaScript client-side framework, which facilitates you to organize your code and make it easier to develop single page applications and reduce the development time. It supports the MVC (Model, View, Controller) architecture.

2) In which language, Backbone.js is written?

backbone.js is written in JavaScript.

3) What was the initial release date of Backbone.js?

Backbone.js was initially released on October, 13, 2010.

4) Which is the latest stable version of Backbone.js and what is its released date?

The latest stable version of Backbone.js is 1.2.2 and it is released on August, 19, 2015.

5) What are the main components of Backbone.js?

Main components of Backbone.js:

  • Model
  • View
  • Collection
  • Router
  • Event class object

6) Explain the architecture of Backbone.js.

Backbone.js follows the MVC architecture:

  • Model: It is a part of your code that is used to retrieve the data from the server.
  • View: It specifies the HTML representation of this model.
  • Controller: It facilitates you to save your JavaScript application and write application logic.

7) When do you require Backbone.js?

Backbone.js is required in following conditions:

  • When you are developing a web application that requires a lot of JavaScript.
  • It is required when you want to give structure to your code, if your application needs to be scalable.
  • Backbone is useful when a web application has to work with jQuery to traverse the DOM or give animations.

8) What is collection in Backbone.js?

In Backbone.js, collection is used to represent ordered set of models. Any event in model triggers an event in collection directly. For example, you can bind “change” event to be notified in a case when any model in the collection has been modified.

9) Which are the three js files that are required to setup Backbone.js?

Following are the three js files that you require to setup Backbone.js:

  • jQuery
  • Backbone
  • Underscore

10) What is the use of Backbone.js router?

The Backbone.js router is used to change the URL fragment of an application in order to provide bookmarkable and sharable URLs for an AJAX heavy application.

11) What is Backbone event?

Backbone event is a module that can be mixed into any object and provides the object the ability to bind and trigger custom named events. Events are not declared before they are bound to any object. Events reflect the state of the model.

12) What is view in Backbone.js?

In Backbone.js, view is a JavaScript object that manages a specific DOM element and descendants:

  • Views are not HTML.
  • View is a description of a model.
  • The HTML code comes from templates.
  • View can work with any template system.

13) What is Modelbinder in Backbone.js?

In Backbone.js, modelbinder class is used to make synchronization process of views and models together.

14) What are the most powerful capabilities of the ModelBinder?

The most powerful capabilities of ModelBinder class are:

  • It enables you to define scope when you create your bindings using jQuery.
  • If your views are simple, you can rely on default scoping rules that are based off of the html “name” attribute.
  • You can define scoping with jQuery selectors if your views are complex.

15) What are the advantages of Backbone.js?

Advantages of Backbone.js:

  • You can develop a web application with Backbone.js by using JavaScript with the minimal set of data-structuring (models & collections) and user interface (views & URLs).
  • It is best for developing MVC like web applications, single page web applications or complex JavaScript web applications in an organized and structured manner without JavaScript code mixing with HTML.
  • It provides API with lot of functions.
  • It provides a key value binding and custom events.
  • It facilitates you to abstract your data into models and your DOM application into views and bind the two together using events.

16) What is converter in Backbone.js?

When a model’s attribute is copied to an html element or when an html element’s value is copied into a model’s attribute, a function is called, this function is known as converter in Backbone.js.

17) When can you use Unbinding function in Backbone.js?

Unbinding function is used to remove the validation binding on the model and removing all events hooked up on the collection.

18) What are the configuration options available in Backbone.js?

The configuration options available are:

  • InitialCopyDirection
  • modelSetOptions
  • change Triggers
  • boundAttribute
  • suppressThrows
  • converter

19) What is the function of parse in Backbone.js?

Whenever data of a model is returned by the server while fetching or storing, this data is called parse. It is called by Backbone whenever a collection’s models are returned by server.

20) What is the use of setElement function in Backbone view?

The setElement function is used in Backbone view when it has to be applied to a different DOM element.