Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Knockout Online Skills Assessment Test

Topics Covered

  • Data Binding Syntax
  • Creating a View Model
  • ViewModels with Parameters
  • Event Data Bindings
  • Extending Observables
  • Binding Knockout Template
  • Showing and Hiding Elements

Useful for hiring

  • KnockoutJS Developer (0-3 years experience)
  • UI Developer - KnockoutJS 
  • Javascript Developer - KnockoutJS

Start hiring job-fit candidates using this assessment

GET A DEMO

"The best part of Interview Mocha is they have topic wise questions available. The skill wise extensive reports and advanced analytics lets us measure & benchmark the proficiency level of employees in that particular skill."

Cheryl Tolkinen, Securian, USA,
Learning & Development Manager
Question

You need to provide binding true / false to radio buttons in Knockout JS. Which of the following codes will work?
  
 

Note: There can be multiple correct answers to this question.

Answer
    • <label>Male
      <input type="radio" name="IsMale" value="1" data-bind="checked:IsMale"/>
      </label>
      <label>Female
      <input type="radio" name="IsMale" value="0" data-bind="checked:IsMale"/>
      </label>
      <div data-bind="text: !!+IsMale()"/>
      var vm = {
      IsMale: ko.observable(false)
      };
      ko.applyBindings(vm);

    • var ViewModel = function() {
      this.IsMale = ko.observable(true);
      this.IsMale.ForEditing = ko.computed({
      read: function() {
      return this.IsMale().toString();
      },
      write: function(newValue) {
      this.IsMale(newValue === "true");
      },
      owner: this
      });
      };

    • <label>Male
      <input type="radio" name="IsMale" value="true" data-bind="checked:IsMale"/>
      </label>
      <label>Female
      <input type="radio" name="IsMale" value="false" data-bind="checked:IsMale"/>
      </label>

    • <label>Male
      <input type="radio" name="IsMale" value="true" data-bind="checked:IsMale()"/>
      </label>
      <label>Female
      <input type="radio" name="IsMale" value="false" data-bind="checked:IsMale()"/>
      </label>

Question

Person {
 int Id;
 string Name;
 Book[] Books;
 }
 Book {
 int Id;
 string Name;
 }
 function viewModel() {
 var self = this;
 self.persons = ko.observableArray();
 // persons are retrieved via AJAX...
 ko.mapping.fromJS(persons, {}, self.persons);
 }
 jQuery(function( $ ) {
 ko.applyBindings(new viewModel());
 });

How can you extend persons observableArray to set validation rules and message?

Note: There can be multiple correct answers to this question.

Answer
    • Use the mapping options to attach the validation rules when certain properties are created.
      <input data-bind="value: name" />
      var data = { name: "Joe Shmo" };
      var validationMapping = {
      // customize the creation of the name property so that it provides validation
      name: {
      create: function(options) {
      return ko.observable(options.data).extend( {required: true} );
      }
      }
      };
      var viewModel = ko.validatedObservable(ko.mapping.fromJS(data, validationMapping)); ko.applyBindings(viewModel);

    • Use HTML5 attributes. This is only supported for some validations (i.e. required, pattern).
      <input data-bind="value: name" required />
      ko.validation.configure({
      parseInputAttributes: true
      });
      var data = { name: "Joe Shmo" };
      var viewModel = ko.validatedObservable(ko.mapping.fromJS(data));
      ko.applyBindings(viewModel);

    • function viewModel() {
      var self = this;
      self.persons = ko.observableArray();
      // persons are retrieved via AJAX...
      ko.mapping.fromJS(persons, {}, self.persons);
      self.Name.extend({ required: true });
      }

    • function viewModel() {

      var self = this;
      self.persons = ko.observableArray();
      // persons are retrieved via AJAX...
      ko.mapping.fromJS(persons, {}, self.persons);
      self.Name.extend({ required: false });
      }

Question

In your app you need to show validation messages for user, which of the following ways is correct for this?

Note: There can be multiple correct answers to this question.

Answer
    • Set ko.validation.configure to use deep grouping because the default value is false.
      and implement logic validation in viewmodel. for example
      viewmodel.save = function(){
      var result = ko.validation.group(viewModel, {deep: true});
      if (!viewModel.isValid())
      {
      alert("Please fix all errors before preceding");
      result.showAllMessages(true);
      return false;
      }}

    • Set ko.validation.configure to use deep grouping because the default value is false.
      and implement logic validation in viewmodel. for example
      viewmodel.save = function(){
      var result = ko.validation.group(viewModel, {deep: true});
      if (result().length > 0)
      {
      alert("Please fix all errors before preceding");
      result.showAllMessages(true);
      return false;
      }}

    • Use jquery validate plugin for it.

    • Implement viewModel.errors.showAllMessages() function to viewModel;

Test details:

This Knockout JS interview test enables employers and recruiters to identify & hire right fit Knockout.JS Developer by evaluating working skills and job readiness. For this reason, the emphasis is laid upon evaluating the knowledge of applied skills gained through real work experience, rather than theoretical knowledge. 

Test Duration: 20 minutes 

15 Application Oriented Questions

05 Theory Questions 


The combination on Application and Theory questions helps to evaluate Technical as well as practical Skills of Candidates

Test description:

Knockout Test helps Hiring Managers & Recruiting Teams to validate the KnockoutJS coding skills of Knockout JS Developer. Knockout.JS is a language which is written under Javascript and helps to develop rich and responsive website. Knockout JS is independent of any other framework and provides easy way to handle complex data-driven interfaces. It gives easy templates to create high level UI structures and also gives easy custom. Knockout.JS online test is specially designed to check application, practical skills of an KnockoutJS developer – as per Industry Standards.
 
Knockout.JS assessment test contains questions on following Topics:
 

  • Data Binding Syntax

  • Creating a View Model

  • ViewModels with Parameters

  • Event Data Bindings

  • Extending Observables

  • Binding Knockout Template

  • Showing and Hiding Elements  


Knockout JS skills test is designed by our subject matter experts to evaluate knowledge of Knockout JS developer before hiring. Using powerful reporting, you can have a detailed analysis of the test results to help you make a better hiring decision and predict the candidate’s performance.

The test contains MCQ's (Multiple Choice Questions), MAQ's (Multiple Answer Questions), Fill in the Blank, Descriptive, True or False.

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at support@interviewmocha.com to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO