Angular 1 and Angular 2 Integration

KnockoutJs Interview Questions and Answers

1. What is Knockout JS?
Knockout is a pure JavaScript library and with the help of knockoutJS we can create rich and responsive applications. In knockoutJS, UI (DOM) is directly linked with data model.

If data source of the data model is getting update any time, at the same time the UI (DOM) sections will also get updated automatically.

KnockoutJs is a MVVM design 
pattern. The MVVM basically know as Model View ViewModel.

By the help of KO, we can implement all functionality more simply manner and works with any server or client-side technology.

Feature of KnockoutJs

  • Dependency Tracking
    • In the dependency tracking, Knockout js automatically update the UI (DOM) when your data model is change.
  • Declarative Binding
    • In the declarative binding, your UI (DOM) is connected to your data model in a    simply manner using data-bind control.
2. What is the main features of Knockout JS?

       The features of KnockoutJs

    • dependency tracking
    • declarative binding
    • template binding                                                                                          [<ul data-bind="template:{ name:'myViewItem',foreach: myItems }"></ul>]
3. How Knockout js different from MVC ? (Answers)

           ·   Knockout js is a MVVM pattern.

           ·   MVC is a design pattern.

           ·   Knockout js work like connected mode.
           ·   MVC work like disconnected mode.

           ·   Knockout js supported two types of binding
o   One-way binding
           ·   MVC supported only one-way binding.

           ·   In Knockout js, UI part automatically update when your data model update.
           ·   In MVC, not update UI automatically when your data model update. Need event to call data model and update it.

           ·   In MVC, model part directly bind with the view page.
           ·   In Knockout js, model part is not directly bind with the view page. Model directly bind with the view-model and view-model directly with the view page.

4. How Knockout js different from jQuery?
5. What is the KO and why we use, explain in details?
KO is a heart and soul of knockoutJS that provides interdependent way to link the ViewModel to Model and ViewModel to UI. 

Th KO doese not depend on the jQuery library, but we can use jQuery at the same time. Using KO you can handle client and server side application in simply manner.

6. What is observable in Knockout JS?
    Observable is a knockout js property that contain the view model and this property is bind with UI (View) in two way binding.

7. What is observable Arrays in Knockout JS?
      Observable array is a knockout js property that contain the item collection in the view model and this property is bind with UI (View) in two way binding. 

8. What is computed observable?
      Computed observable is a knockout js function which are depends on the other observable properties. Computed function are automatically update when any changes on these dependencies.


    //count total draft entries and display on submit button.

    self.countTotalDraftEntries = ko.computed(function () {
        var sum = 0;
        ko.utils.arrayForEach(TimeEntries(), function (key) {
            if (key.Status() === 'Draft') {
                sum += 1;
        return sum;

9. What is dependency tracking in Knockout Js?
  • In the dependency tracking, KnockoutJS automatically update the UI (DOM) when your data model is change.

10. What is indexOf? (Answers)

11. What type of manipulating in the observable Array

      There are different type of obervableArray manipulations

    • pop()
    • push()
    • shift()
    • unshift()
    • reverse()
    • sort()
    • splice()
    • remove() 
    • removeAll()

12. What types of data binding are available in knockout JS?

      There are different type of data bindings

13. What is template binding?
 [<ul data-bind="template: { name: 'myViewItem', foreach: myItems }"></ul>]

14. How to creating custom bindings in knockout JS?

15. How to get row index in knockout Js ?
   We can get the row index using $.index()


Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
Post a Comment Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book