Home » Backbone.js MCQ (Multiple Choice Questions)

Backbone.js MCQ (Multiple Choice Questions)

by Online Tutorials Library

Backbone.js MCQ

1) Which of the following are the main components of Backbone.js?

  1. Model
  2. View
  3. Collection
  4. All of the above

Answer: D is the correct option. All of the above are the main components of Backbone.js.


2) What are the key points of Backbone.js?

  1. js has a hard dependency with underscore.js to make it more functional and supporting.
  2. With jQuery, Backbone.js has a soft dependency.
  3. When the model changes, it can update the HTML of your application automatically.
  4. All of the above.

Answer: D is the correct option. All of the above are the key points of Backbone.js.


3) What is the usage of ModelBinder in Backbone.js?

  1. The ModelBinder class is used to make a synchronization process of views and models together.
  2. The ModelBinder class is used to handle routers.
  3. The ModelBinder class is used to hide the models and views.
  4. None of the above.

Answer: A is the correct option. The ModelBinder class is used to make a synchronization process of views and models together.


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

  1. InitialCopyDirection
  2. ModelSetOptions
  3. Change Triggers
  4. All of the above.

Answer: D is the correct option. All of the above are the configuration options available in Backbone.js.


5) How does Backbone.js decide if it should use POST/GET/ Request to the Server and what methods Backbone has reserved for these Operations?

  1. If we instantiate a model with an id, Backbone.js automatically performs a GET request to the urlRoot + ‘/id’ using the fetch() method.
  2. If the id attribute of the model is null, Backbone.js sends a POST request to the urlRoot of the Server using the save() method.
  3. If the id attribute of the model is not null, Backbone.js sends a PUT request instead of a POST request using the save() method.
  4. All of the above.

Answer: D is the correct option because all of the above statements are true.


6) What are the Events in Backbone.js?

  1. The events are modules in Backbone.js that can be mixed into any object.
  2. They give the object the ability to bind and trigger custom-named events.
  3. Events reflect the state of the model.
  4. All of the above.

Answer: D is the correct option.


7) Which of the following models can be created by extending Backbone.js?

  1. var Todo = Backbone.Model.extend({}); var todo1 = new Todo(); console.log(JSON.stringify(todo11)); var todo = new Todo({ title: ‘Check the attributes of both model instances in the console.’, completed: true }); console.log(JSON.stringify(todo2));
  2. var Todo = Backbone.Model.extend({}); var todo1 = new Todo(); console.log(JSON.stringify(todo1)); var todo2 = new Todo({ title: ‘Check the attributes of both model instances in the console.’, completed: true }); console.log(JSON.stringify(todo2));
  3. var Todo = Backbone.Model.extend({}); var todo1 = new Todo(); console.log(JSON.stringify(todo11)); var todo = new Todo({ title: ‘Check the attributes of both model instances in the console.’, completed: true }); console.log(JSON.stringify(todo2)); =
  4. All of the above.

Answer: B is the correct option.


8) What is the view in Backbone.js?

  1. Views are not HTML.
  2. It is a description of a model.
  3. The HTML code comes from templates.
  4. All of the above.

Answer: D is the correct option. All of the above options specify the view in Backbone.js.


9) What are the three js files that are required to set up Backbone.js?

  1. jQuery, Backbone.js, Underscore
  2. JavaScript, jQuery, js
  3. Underscore, JavaScript, jQuery
  4. None of the above.

Answer: A is the correct option. The three js files required to set up Backbone.js are jQuery, Backbone.js, Underscore, etc.


10) What is the usage of Backbone.sync?

  1. When Backbone.js wants to save or read a model to the Server, it calls out a function called Backbone.sync.
  2. When Backbone wants to save or read a view to the Server, it calls out a function called Backbone.sync.
  3. When Backbone wants to save or read an event to the Server it calls out a function called Backbone.sync.
  4. All of the above.

Answer: A is the correct answer. When Backbone.js wants to save or read a model to the Server, it calls out a function called Backbone.sync.


11) What are the most powerful functionalities of Modelbinder in Backbone.js?

  1. Modelbinder allows the developer to define the scope when binding is created using J-Query.
  2. In some of the cases, we can rely on the default scoping rules based on the name attribute of HTML.
  3. The scoping rules can be redefined if the views are complex.
  4. All of the above.

Answer: D is the correct option. All of the above are the most powerful functionalities of Modelbinder in Backbone.js.


12) What is Converter in Backbone.js?

  1. 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 a converter in Backbone Js.
  2. The converter is an interface describing a Java class that can perform Object-to-String and String-to-Object conversions between model data objects and a String representation of those objects.
  3. Converters are the type of compilers that are used to convert one programming language into another.
  4. None of the above.

Answer: A is the correct option. 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 a converter in Backbone Js.


13) Which of the following code should we use to define a root route?

  1. Route = Backbone.Router.extend({ route: { “: ‘index’ }, index: function(){ $(document.body).append(“root index route”); } });
  2. Router = Backbone.Router.extend({ routes: { “: ‘index’ }, index: function(){ $(document.body).append(“root index route”); } });
  3. Router = Backbone.Route.extend({ route: { “: ‘index’ }, index: function(){ $(document.body).append(“root index route”); } });
  4. All of the above.

Answer: B is the correct option.


14) Which of the following are the functions of Tojson?

  1. Tojson returns a shallow copy of the model’s attribute for JSON stringification.
  2. The Tojson function is used for persistence, serialization, and for augmentation before being sent to the server.
  3. Tojson does not return a JSON string.
  4. All of the above.

Answer: D is the correct option. All of the above are the functions of Tojson.


15) The sync method is called with the following parameters?

  1. Model
  2. Method
  3. Options
  4. All of the above.

Answer: D is the correct option. The sync method is called with all of the above parameters.


16) Which of the following are the built-in events in Backbone.js?

  1. map
  2. every
  3. sort
  4. each

Answer: C is the correct option. The sort is the built-in events in Backbone.js.


17) What are the typical problems you might face with the Backbone.js view code?

  1. The application models don’t change very often.
  2. Application pages are frequently refreshed from scratch from the server.
  3. Models are not shared between different views.
  4. All of the above.

Answer: D is the correct option. All of the above are typical problems you might face with the Backbone.js view code.


18) Which of the following code is used to fetch with sending id?

  1. var Type = Backbone.Model.extend({ url : “/api/SomeRoute” });
  2. var Type = Backbone.Model.extend({ urlRoot : “/api/SomeRoute” });
  3. Both of the above.
  4. None of the above.

Answer: B is the correct option.


19) Which of the following code is used when the model or collection is synchronized successfully with the server?

  1. “change:[attribute]”(model, value, options)
  2. “destroy”(model, collection, options)
  3. “request”(model_or_collection, xhr, options)
  4. “sync”(model_or_collection, resp, options)

Answer: D is the correct option.


20) Which of the following code should you use to get only the first 20 items in a backbone collection?

  1. first(20)
  2. first(collection, 20)
  3. collection(20)
  4. All of the above.

Answer: A is the correct option.


Next Topic#

You may also like