Most Important Frequently Asked Backbone.js Interview Questions
-
Question 1. Explain What Is Backbone.js?
Answer :
Backbone.js is a JavaScript client-side (front end) framework, which helps to organize your code and makes it easier to develop single page applications. It allows you to structure JavaScript code in an MVC (Model, View , Controller) fashion.
Model: It is a part of your code that populates and retrieves the data.
View: It is the HTML representation of this model.
Controller: It enables you to save your javascript application via a hashbang URl.
-
Question 2. What Are The Main Components Of Backbone.js ?
Answer :
The main component of Backbone.js are:
- Model
- View
- Collection
- Router
- Event class object
HTML Interview Questions -
Question 3. Explain What Is Backbone.js Collections?
Answer :
An ordered set of models are represented by Backbone.js collections. Any event in model will trigger 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.
-
Question 4. Explain What Is Backbone.js Router Is Used For?
Answer :
When ever an application want to change their URL fragment in order to provide bookmarkable and shareable URLs for an Ajax heavy application, backbone.js router is used.
HTML Tutorial -
Question 5. What Is Backbone Events?
Answer :
Backbone events is a module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events. Events are not declared before they are bound to any object . Events reflects the state of the model.
Java Script Interview Questions -
Question 6. What Are The Keypoints Of Backbone?
Answer :
- It has hard dependency with underscore.js to make it more functional and supporting a range of useful collection based operations With jQuery it has a soft dependency
- When the model changes it can update the HTML of your application automatically
- It uses client-side rendering framework or Javascript templating to render html which avoid you to embed HTML code inside JavaScript code.
- For UI updates and DOM manipulations if offers a significantly clean and elegant way.
-
Question 7. Why You Have To Use Backbone ? Advantages?
Answer :
- By using JavaScript with the minimal set of data-structuring ( models & collections) and user interface (views & URLs) it enables you to develop a web application
- Backbone is best useful to develop 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
- Provides key value binding and custom events
- API with tons of functions
- Robust event handling
- API connetion over a RESTful JSON interface
Java Script Tutorial PHP Interview Questions -
Answer :
you are required following three js files to setup a working environment for backbone
- jQuery
- Backbone
- Underscore
In your application put these files within js folder and use it in your index.html page
-
Question 9. Explain When You Require Backbone.js?
Answer :
Backbone.js is required in following condition:
- When 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.
AJAX Interview Questions -
Question 10. Explain What Is View In Backbone.js?
Answer :
Backbone view is a Javascript object that manages a specific DOM element and descendants.
- Views are not HTML
- It is a description of a model
- The HTML code comes from templates
- Works with any template system
PHP Tutorial -
Question 11. Explain What Is Backbone.js Models?
Answer :
Backbone.js models are object and core of backbone.js. It contains an array of attributes and listens for events. To represent your data, Backbone provides a model object. For example, you have a to do list, you would have a model representing each item on that list.
MySQL Interview Questions -
Question 12. Explain How You Can Use Backbone.js For Multiple Page Web App?
Answer :
For multiple page web app in backbone.js there are lots of consideration but here are two which can be useful.
Serving the page : In this, where you want to have your web server route everything to the server route everything to serve the same static page. That means that everything in http://wisdomjobs.com/* will serve /var/www/wisdomjobs.com/index.html. once the static page is loaded, the JS on that page will decide what to do given the url
Push State : You can still use backbone routing to do your routing, but don’t use hashbangs. This will allow you to navigate to URLs without actually needing a page refresh.
HTML Interview Questions -
Question 13. Explain What Is Modelbinder In Backbone.js ?
Answer :
To make synchronization process of views and models together, ModelBinder class is used.
AJAX Tutorial -
Question 14. What Is The Most Powerful Capabilities Of The Modelbinder ?
Answer :
The most powerful capabilities of ModelBinder class is that 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.
-
Question 15. Explain What Is Converter In Backbone.js?
Answer :
A function is called when model’s attribute is copied to an html element or when an html element value is copied into a model’s attribute, this function is referred as Converter in Backbone.js
Java Servlets Interview Questions -
Question 16. What Is Model.attributes?
Answer :
The attributes property is the internal hash containing the model’s state, usually a form of the JSON object representing the model data on the server. It is often a straightforward serialization of a row from the database.
MySQL Tutorial -
Question 17. What Is The Function Of Tojson?
Answer :
It returns a shallow copy of the model’s attribute for JSON stringification. This function is used for persistence, serialization and for augmentation before being sent to the server. This does not return a JSON string.
JMS(Java Message Service) Interview Questions -
Question 18. Explain When You Can Use Unbinding Function In Backbone.js?
Answer :
When you want to remove the validation binding on the model or all models , removing all events hooked up on the collection, you can use Unbinding function.
For example : Backbone.Validation.Unbind(view) [ This will remove the validation binding]
Java Script Interview Questions -
Question 19. What Are The Configuration Options Available?
Answer :
The configuration options available are:
- InitialCopyDirection
- modelSetOptions
- change Triggers
- boundAttribute
- suppressThrows
- converter
Java Servlets Tutorial -
Question 20. Mention What Are The Typical Problems You Might Face With The Backbone View Code?
Answer :
- Application models don’t change very often
- Application pages are frequently refreshed from scratch from the server
- Between different view models are not shared
JavaServer Faces (JSF) Interview Questions -
Question 21. What Is The Function Of Escape?
Answer :
It gets the current value of an attribute from the model but returns the HTML-escaped version of a model’s attribute. It is helpful in preventing XSS attacks, if you are interpolating data from the model into HTML.
-
Question 22. Explain What Is The Function Of Parse?
Answer :
When ever a model’s data is returned by the server, in fetch and save , this data is called parse. It is called by Backbone whenever a collection’s models are returned by server, in fetch.
JavaServer Faces (JSF) Tutorial -
Question 23. What Is Backbone.sync Is Used For?
Answer :
When Backbone wants to save or read a model to the server it calls out a function called as Backbone.sync.
Node.js Interview Questions -
Question 24. In Backbone View, What Is The Use Of Setelement?
Answer :
setElement function is used when Backbone view has to be applied to a different DOM element.
PHP Interview Questions -
Question 25. Explain What Is Model.cid?
Answer :
Model.cid works as a unique identifier. It is a special property of models, the cid or client id is automatically assigned to all models when they are first created. This property is useful when the model is not saved to the server, but needs to be visible in the UI. It takes the from c1,c2….
Node.js Tutorial -
Question 26. What Is Backbone.js? How Does It Help Developers?
Answer :
BackboneJs is a JavaScript framework which allows the developers to make their life easier by providing the below features:
Model:– Store data
Model can have listeners bound to them to detect changes to their values
Collection: Group of models
View: Represents UI
Routing: Manages how to show appropriate view when request through URL
Topic: Backbone.js Interview Questions
No comments:
Post a Comment