Handlebars.js Interview Question-Answer

By Smart Answer

Updated on:


Q.1 How can you add reference of Handlebars in your project?

       A. All the options

       B. Using Bower package manager

       C. Using CDN

       D. Using local reference

       E. Using npm package manager

Ans : All the options

Q.2 Handlebars.js is an extension to the ________ templating language.

       A. Underscore

       B. EJS

       C. Mustache

       D. jTemplates

Ans : Mustache

Q.3 How do you add Templates in your HTML?

       A. By including templates in <script> tags with type text/x-handlebarsjs-template

       B. By including templates in <script> tags with type text/x-handlebars-template

       C. By including templates in <script> tags with type javascript/x-handlebarsjs-template

       D. By including templates in <script> tags with type javascript/x-handlebars-template

Ans : By including templates in <script> tags with type text/x-handlebars-template

Q.4 The variables written in double curly braces {{}} are known as _______.

       A. expressions

       B. context

       C. helper

       D. template

Ans : expressions

Q.5 Handlebars is a fully logic-less templating engine written entirely in JavaScript.

       A. True

       B. False

Ans : False

Q.6 Expression is a JavaScript object that you pass to the compiled template.

       A. True

       B. False

Ans : False

Q.7 Which helper iterates over each object in an array?

       A. while

       B. do-while

       C. for

       D. each

Ans : each

Q.8 Custom Helpers can be created in Handlebars using _________.

       A. Handlebars.regHelper()

       B. Handlebars.registerHelper()

       C. Handlebars.createHelper()

       D. Handlebars.loadHelper()

Ans : Handlebars.registerHelper()

Q.9 {{#each}}, {{#if}}, {{#unless}} are some of the __________ helpers.

       A. Custom

       B. Built-in

       C. Library

       D. All the options

Ans : Built-in

Q.10 You can call the partial named customPartial in your template using ___________.

       A. {{> customPartial }}

       B. {{< customPartial }}

       C. {{/> customPartial }}

       D. {{# customPartial }}

Ans : {{> customPartial }}

Q.11 ________ allow(s) you to invoke multiple helpers in a single mustache.

       A. Subexpression

       B. Partials

       C. Expressions

       D. Multi-helpers

Ans : Partials

Q.12 Partials in Handlebars can be created using _________.

       A. Handlebars.includePartial()

       B. Handlebars.registerPartial()

       C. Handlebars.loadPartial()

       D. Handlebars.addPartial()

Ans : Handlebars.registerPartial()

Q.13 In Subexpressions, the results of outer helpers will be passed as arguments to the inner helpers.

       A. True

       B. False

Ans : False

Q.14 You can improve the execution of the application if you precompile templateScript and then send the compiled version to the customer.

       A. True

       B. False

Ans : True

Q.15 With custom block helpers, we can change current context temporarily.

       A. True

       B. False

Ans : True

Q.16 handlebars-v2.0.0.js is lighter than handlebars.runtime.js

       A. True

       B. False

Ans : False

Q.17 Mustache is a fully logic-based templating engine that dynamically generates your HTML view.

       A. True

       B. False

Ans : False

Q.18 The {{$ if}} helper allows you to implement an if condition block in your code.

       A. True

       B. False

Ans : False

Q.19 Options in custom block helper has a ________ method that allows you to change the context of the object temporarily.

       A. None of the options

       B. fn()

       C. f()

       D. fun()

Ans : fn()

Q.20 Precompilation increases the ______.

       A. Performance of the application

       B. Page loading time

       C. Both the options

Ans : Both the options

Q.21 Do you need to use <script id=”template-id” type=”text/x-handlebars-template”> tag in precompiled template?

       A. Yes

       B. No

Ans : No

Q.22 Handlebars can be classified as a __________.

       A. Library

       B. Framework

       C. Both the options

Ans : Library

Q.23 You can add compiled template in your HTML page using __________.

       A. <template url=”path/to/templatesCompiled.js”></template>

       B. <script src=”path/to/templatesCompiled.js”></script>

       C. <template src=”path/to/templatesCompiled.js”></template>

       D. <script url=”path/to/templatesCompiled.js”></script>

Ans : <script src=”path/to/templatesCompiled.js”></script>

Q.24 The {{#unless}} helper only outputs the contained block if the given expression is true.

       A. True

       B. False

Ans : False

Q.25 Templates can contain HTML and text, mixed with Handlebars expressions.

       A. True

       B. False

Ans : True

Q.26 Handlebars allows you to write JavaScript directly within templates.

       A. True

       B. False

Ans : False

Q.27 How Handlebars.js is different from Mustache.js?

       A. Mustache.js is fully logic-less, where as Handlebars.js add minimal logic

       B. Handlebars.js uses helpers like if, with, unless and each

       C. Handlebars.js is an extension of Mustache.js with a few added features

       D. All the options

Ans : Mustache.js is fully logic-less, where as Handlebars.js add minimal logic

Q.28 In custom block helper, Handlebars automatically adds __________ object as the last parameter to the callback function.

       A. options

       B. params

       C. choices

       D. args

Ans : options

Q.29 __________ is a JSON object that contains the values of variables used in the template.

       A. Model data

       B. Template data

       C. Content

       D. Context

Ans : Context

Smart Answer


Related Post

Workflow Automation with Gulp Interview Question-Answer

Q.1 The default task representation in gulp is _________.        A. ABgulp.call(‘default’,function(){ ‘d’,void});        B. gulp.task(‘default’,function(){ });        C. gulp.call(‘default’,function(){ ‘default’});   ...

Bundling with Webpack Interview Question-Answer

Q.1 The distinct feature of Webpack is ___________.        A. Code-Splitting        B. Bundling        C. Modularity        D. Reusability ...

Vue JS – Efficacy Interview Question-Answer

Q.1 How to initialize the root instance in Vue JS (using the CDN method)?        A. var app = Vue new({…});        B. var ...

Styling with CSS3 Interview Question-Answer

Q.1 To make the width of a table adjust to the current width of the viewer’s browser window, you should specify a table width of _______.     ...

Leave a Comment