BackBone.js MCQs

BackBone.js MCQs

Our team has conducted extensive research to compile a set of BackBone.js MCQs. We encourage you to test your BackBone.js knowledge by answering these multiple-choice questions provided below.
Simply scroll down to begin!

1:

In Backbonejs, which of the following Options is the correct syntax of creating 8 Fruit Object having default attributes name with value Mango, and season with value Summer are also added, and the message “Fruits are healthy!" is written to console?


A.  

Fruit = Backbone.Model.extend({

initialize.function()[

console.log(

B.  

Fruit = Backbone.Model.extend({

initialize: function0[

console.log('Fruits are healthy!‘);

l.

defaults:{

name: 'Mango',

season: 'Summer'

I

1):


C.  

Fruit = Backbone.Model.extend({

lunction:initialize0[

console.log('Fruits are healthy!');

],

defaults: [

name: 'Mango',

season = 'Summer'

}

1):


D.  

None of the above.

2:

In relation to RequireJS configuration options, which of the following is the correct option that is used for setting the baseUrl to point to the app directory?


A.  

require.config({

baseUrl:

B.  

require.config({

baseUrl=

C.  

require.config({

baseUrl

D.  

None of the above.

3: Which of the following commands is used for installing the JavaScript tool. Yeoman?

A.   npm install -g yeoman

B.   npm install -g yo

C.   npm install -g yeo

D.   npm install -g y

4: While using Backbone.js, which of the following functions is used for binding events?

A.   set

B.   for

C.   on

D.   this

5: Which of the following options is the correct syntax of command that is used for installing the Grunt command-line interface globally?

A.   npm install grunt -g -cli

B.   npm install -g grunt-cli

C.   npm install grunt-cli —g

D.   npm install -g —cli-grunt

6: In relation to Backbone.ModeI, which of the following options is NOT a valid callback parameter of the request event?

A.   model

B.   xhr

C.   value

D.   options

7: While using JavaScript, which of the following string functions is used for extracting a subString from the string that begins at the start position through the specif‌ied number of characters?

A.   subString

B.   substr

C.   Split

D.   trim

8:

In relation to running QUnit without a browser. which of the following options is the correct command that is entered to the command line for obtaining the PhantomJS Runner plug-in for QUnit?


A.  

phantomjs.runner.js [timeout-in-seconds] [url-of-your-qunit-testsuite]  

B.  

phantomjs runner.js [url—of—your-qunit-testsuite] [timeout—in-seconds]


C.  

QUnit phantomjs.runner.js [url-of-your-qunit—testsuite]


D.  

QUnit phantomjs runner.js [timeout-in-seconds] [urI-of-your-qunit-testsuite]


9:

Which of the following options is the correct OUnit callback that runs after each assertion and provides the result of the test case (either error or log) along with the message?


A.  

QUnitJog = function(results, message)[

];


B.  

QUnitJog = function(name, failure, results, message)[

};


C.  

QUnit.testDone = function(name, failures, message)[

}:


D.  

QUnit.testDone = function(result, failures, message)[

];


10: In relation to Jasmine-jOuery matchers. which of the following options is the correct syntax of the matcher that is used for checking if an event was triggered on the element?

A.   toHaveBeenTriggered( event, handler)

B.   toHaveBeenTriggered( name. event)

C.   toHaveBeenTriggered( event)

D.   toHaveBeenTriggeredO

11: In relation to RequireJS configuration options, which of the following options is used for specifying an array of dependencies to load immediately after processing of the configuration of RequireJS?

A.   map

B.   shim

C.   deps

D.   conf‌ig

12: In relation to the attribute changes in Backbonejs models, which of the following Options is used for providing a global change handler that is used for responding to any attribute changing in the model?

A.   on('change',)

B.   on('function','change')

C.   on('change', )

D.   on('function', 'change', )

13: Which of the following options is NOT a CollectionView Life-Cycle Event callback?

A.   onBeforeltemAdded

B.   onRender

C.   onClose

D.   onBeforeRender

14: Which of the following Backbonejs collection methods is used for adding a model at the beginning of a collection?

A.   collection.at(begin. model)

B.   collection.get(id. model, [options])

C.   collection.unshift(model. [options])

D.   collection.push(model, [options])

15: While using Handlebars with Backbone.js, which of the following helpers is used for allowing the context to be changed within a template for ensuring the use of a particular object?

A.   Log

B.   with

C.   unless

D.   if else

16: In relation to Jasmine-jQuery matchers, which of the following arguments is passed to the toContain matcher that is used for checking the internals of an element for the presence of other elements?

A.   name

B.   string

C.   jOuerySelector

D.   className

17: Which of the following Backbone.js model methods is used for communicating with the server and for representing the state of a model?

A.   fetch

B.   Sync

C.   validate

D.   Set

18: While using Backbone.js, which of the following attributes is used for binding the View class to an HTML page?

A.   data

B.   template

C.   model

D.   el

19:

While using Backbonejs, which of the following syntaxes is used for extending any basic objects with the Backbone event capability?

A.  

var object = {j;

_.extend(object. route. Backbone.Events); 


B.  

var object = {};

_.extend(object, Backbone.Events);


C.  

var object = {};

_.extend(Backbone.Events);


D.  

var object = {};

_.extend(route. Backbone.Events);


20: Which of the following statements is/are NOT correct about the Backbone.js views?

A.   Backbone.js View is used for specifying how to display from application.

B.   Backbone.js View contains HTML markup for the application.

C.   Backbone.js View presents model's data to the user.

D.   Both the statements a and b are incorrect.

21: Which of the following options is used for setting a new set of events and handlers for the View and removing the previous events?

A.   delegateEvents()

B.   events

C.   undelegateEvents()

D.   setElement()

22: Which of the following options is the correct syntax of QUnit Assertions named deequual that is used for performing a deep recursive comparison assertion working on all primitive types such as arrays,objects and dates, etc.?

A.   deequual(actual. expected. condition. message)

B.   deequuallactual, expected. condition)

C.   deequual(actual, expected)

D.   deequual(actual. expected. message)

23: In relation to Marionette, which of the following CollectionView Life-chle Event callback is used for allowing custom code to be added to manipulate the view‘s el further?

A.   onBeforeRender

B.   onRender

C.   onBeforeltemAdded

D.   None of the above.

24:

Select if True or False.

Backbone.trackit cannot be applied to individual model objects, using the startTracking function.


A.  

True

B.  

False

25:

Which of the following modules are the parts of Backbone.js?

i) Events

ii) HTTPS Request

iii) Router

iv) HTTP Request


A.  

Only options i). ii) and iii).

B.  

Only options i). iii) and iv).

C.  

Only options ii), iii) and iv).

D.  

All options i). ii). iii) and iv).

26:

With regard to dealing with files in Grunt, which of the following Options is the correct property that is used to remove all path parts from the dest paths?

Note: The given options are the properties that can be used when expand = true.


A.  

ext

B.  

Flatten 

C.  

cwd

D.  

dest

27: in relation to Globbing patterns for f‌iles in Grunt, which of the following options is used for matching a single character but not I?

A.   *

B.   ?

C.   !

D.   &

28: While installing Backbone.js. which of the following options is required to be included for older internet explorer support?

A.   Node.js

B.   Angulanjs

C.   json2.js

D.   Underscore.js

29: In Backbone.js. which of the following options is/are handled by the Backbonehistory abstraction?

A.   hashchange events

B.   HTML5 pushState method

C.   Both Options a and b.

D.   Neither option a nor b.

30: Suppose you defined a new View named ExampIeView using Backbone.js. Which of the following commands is used for creating a new instance named myViewExample of this View?

A.   myViewExampIe = new ExampleView();

B.   var myViewExample =View ExampleView();

C.   myViewExample = new View ExampleView();

D.   var myViewExample = new ExampleView();

31:

Which of the following options is the correct syntax for creating a model object named  ExampleModel in Backbone.js?


A.  

ExampleModel = Backbone.Model.extend({

llobject properties

J): 


B.  

New ExampleModel = Backboneextend. Model ([

llobject properties

i);


C.  

ExampleModel = Model.extend({

llobject properties

1);


D.  

ExampleModel = Backbone.Model.new([

llobject properties

i);


32: In Backbone.js. which of the following options is used for monitoring changes in the hash fragments and invoking the appropriate events?

A.   Backbone.Router.extent();

B.   Backbone.View.extent();

C.   Backbone.Event.start0;

D.   Backbonehistorystartl);

33: Which of the following options is the correct syntax for using HTML5 pushState in an application for providing URLs without hash fragments?

A.   Backbone.history.start([pushState:true}):

B.   Backbone.Event.start([pushState:true});

C.   Backbone.history.start([pushState= 'true‘));

D.   Backbone.Router.extend([pushState= 'true'D;

34: In relation to adding a task for the Grunt build script. which of the following commands is used for adding the uglify task with the --save-dev f‌lag?

A.   npm install grunt —save-dev contrib-uglify

B.   npm install grunt— uglify "save-dev

C.   npm install grunt-uglify-contrib --save-dev

D.   npm install grunt-contrib-uglify --save-dev

35: In relation to File Array format. which of the following additional Grunt file properties when set to true. Is used for allowing the user to build the f‌ile object dynamically?

A.   Filter

B.   Dot

C.   expand

D.   nonuH

36: In relation to Sinon-QUnit, which of the following options is used for testing callbacks and functions throughout the code, and also used for determining that how many times a particular function has been executed?

A.   Stubs

B.   Mocks

C.   Test Spies

D.   Fake Servers

37: Which of the following Backbone.js options provides a local caching mechanism for the data so that if the app goes Offline, the data still continues to be stored and is synced with the server when connectivity is restored?

A.   Backbone.duaIStorage

B.   Backbone.localStorage

C.   Both Options a and b.

D.   Neither option a nor b.

38: While using BackbonelocalStorage, which of the following options is used for def‌ining a new localStorage parameter for the collection?

A.   localStorage : new libraryapp LocalStorage("MyLibrary").

B.   LocalStorage localStorage : new("|ibraryappzMyLibrary").

C.   localStorage : new Backbone.LocalStorage("libraryappzMyLibrary").

D.   var localStorage : new Backbone.LocalStorage(MyLibrary),

39: Which of the following options is used by Backbone for providing a set of user interface elements that are committed for displaying the data sets in a tabular fashion?

A.   Backbone Ul

B.   Backbonestickit

C.   Backgrid.js

D.   None of the above.

40: Which of the following plugins is used by Backbone for retrieving and setting attributes with a more concise, jQuery-Iike format?

A.   ModelAttrs

B.   qunit—report

C.   Jasmine-jQuery

D.   Grunt

41: In relation to Backbone UI, which of the following f‌iles that are contained in the source distribution of Backbone UI must be included to the HTML page?

A.   backbone-ui.js

B.   backbone-ui.css

C.   Both Options a and b.

D.   Neither option a nor b.

42: In relation to Backbone.js. which of the following functions is NOT performed by a model?

A.   Emitting events in case of data change.

B.   Arranging data and business logic.

C.   Loading and saving from the server.

D.   Handling user input and listening to changes.

43: In relation to Grunt uglily task, which of the following options is the correct tag that is used for allowing conf‌iguration properties to be included in the task?

A.   <%= %>

B.   <$: $>

C.   <@= @>

D.   <&= &>

44: In relation to Jasmine matchers. which of the following matchers compares using the === function?

A.   toEqual( value)

B.   toMatch( regularExpression )

C.   toBe( value)

D.   toBeCloseTo( e, value )

45: Which of the following Jasmine-jQuery matchers is used for checking, if an element on the page is correctly rendered?

A.   toBeSelected(name)

B.   toBe(jQuerySelector)

C.   toBeChecked( jQuerySelector)

D.   toHaveData ( name, jQuerySelector)

46: Which of the following QUnit Assertion is used to perform a boolean assertion that returns true if the first parameter returns true?

A.   equal(condition, message)

B.   ok(condition, message)

C.   strictEqual(condition. message)

D.   expect(condition. message)

47: Which of the following Backbone.js functions is used for switching the DOM element that the view is applied to during the application Iifecycle?

A.   render()

B.   .setEIement()

C.   $()

D.   .ono

48: In relation to the attribute changes in Backbonejs models, which of the following options is used to return true if an attribute has changed since the last change event?

A.   previous()

B.   hasChanged()

C.   hasChanged.previous()

D.   Changed()

49: In relation to Backbone.js collection methods. which of the following options is used for removing and returning the model at the beginning of the collection?

A.   at0

B.   push0

C.   fetcho

D.   shift()

E.   model()

50: In relation to Jasmine matchers, which of the following options is the correct syntax of the matcher which is used for the equality check for simple literals and variables?

A.   toEquaI( value)

B.   toMatch( value)

C.   toEqual( value. e)

D.   toMatch( e, value)