0 votes
in Handlebars by

Read Top 30 Handlebars.js Interview Questions and Answers on below: 

  • Logical operator in a handlebars
  • Handlebars.js Interview questions
  • Handlebars js Questions and answers
  • What is Handlebars
  • What is handlebars used for?
  • What is better than handlebars?
  • What are partials in handlebars?
  • Are handlebars framework?

1 Answer

0 votes
by
Ques#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

Answer:-  All the options

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

a) Underscore

b) EJS

c) Mustache

d) jTemplates

Answer:-  Mustache

Ques#3 How do you add Templates in your HTML?

Select the correct option from below

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

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

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

Select the correct option from below

a) expressions

b) context

c) helper

d) template

Answer:-  expressions

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

Select the correct option from below

a) True

b) False

Answer:-  False

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

Select the correct option from below

a) True

b) False

Answer:-  False

Ques#7 Which helper iterates over each object in an array?

Select the correct option from below

a) while

b) do-while

c) for

d) each

Answer:-  each

Ques#8 Custom Helpers can be created in Handlebars using _________.

Select the correct option from below

a) Handlebars.regHelper()

b) Handlebars.registerHelper()

c) Handlebars.createHelper()

d) Handlebars.loadHelper()

Answer:-  Handlebars.registerHelper()

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

Select the correct option from below

a) Custom

b) Built-in

c) Library

d) All the options

Answer:-  Built-in

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

Select the correct option from below

a) {{> customPartial }}

b) {{< customPartial }}

c) {{/> customPartial }}

d) {{# customPartial }}

Answer:-  {{> customPartial }}

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

Select the correct option from below

a) Subexpression

b) Partials

c) Expressions

d) Multi-helpers

Answer:-  Partials

Ques#12 Partials in Handlebars can be created using _________.

Select the correct option from below

a) Handlebars.includePartial()

b) Handlebars.registerPartial()

c) Handlebars.loadPartial()

d) Handlebars.addPartial()

Answer:-  Handlebars.registerPartial()

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

a) True

b) False

Answer:-  False

Ques#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

Answer:-  True

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

Select the correct option from below

a) True

b) False

Answer:-  True

Ques#16 handlebars-v2.0.0.js is lighter than handlebars.runtime.js

Select the correct option from below

a) True

b) False

Answer:-  False

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

Select the correct option from below

a) True

b) False

Answer:-  False

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

Select the correct option from below

a) True

b) False

Answer:-  False

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

Select the correct option from below

a) None of the options

b) fn()

c) f()

d) fun()

Answer:-  fn()

Ques#20 Precompilation increases the ______.

a) Performance of the application

b) Page loading time

c) Both the options

Answer:-  Both the options

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

Select the correct option from below

a) Yes

b) No

Answer:-  No

Ques#22 Handlebars can be classified as a __________.

Select the correct option from below

a) Library

b) Framework

c) Both the options

Answer:-  Library

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

Select the correct option from below

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>

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

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

Select the correct option from below

a) True

b) False

Answer:-  False

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

Select the correct option from below

a) True

b) False

Answer:-  True

Ques#26 Handlebars allows you to write JavaScript directly within templates.

Select the correct option from below

a) True

b) False

Answer:-  False

Ques#27 How Handlebars.js is different from Mustache.js?

Select the correct option from below

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

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

Ques#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

Answer:-  options

Ques#30 __________ is a JSON object that contains the values of variables used in the template.

a) Model data

b) Template data

c) Content

d) Context

Answer:-  Context

Ques#31 Partials in Handlebars can be created using _________.

Select the correct option from below

a) Handlebars.includePartial()

b) Handlebars.registerPartial()

c) Handlebars.loadPartial()

d) Handlebars.addPartial()

Answer:-  Handlebars.registerPartial()

Ques#32 In Subexpressions, the results of outer helpers will be passed as arguments to the inner helpers.

a) True

b) False

Answer:-  False
...