Knockout

 20 Minutes
 10 Questions


This test is designed to assess a student's knowledge of the basics of technology and Knockout. It will cover topics such as the fundamentals of Knockout, how to use it in web development, and how to integrate it with other technologies. The test will also include questions about the different types of Knockout components and their uses.


Example Question:

Multiple-Choice
Consider the following code, what will be displayed in the HTML page inside the table?
//test2.js JS file
function ProductOrder(name, initProduct) {
var self = this;
self.name = name;
self.product = ko.observable(initProduct);
}
function ProductsViewModel() {
var self = this;
self.products = [
{ productName: "Football", price: 110 },
{ productName: "Basketball", price: 12 },
{ productName: "Rugby ball", price: 15 }
];
self.productOrders = ko.observableArray([
new ProductOrder("Steve", self.products[0]),
new ProductOrder("Bert", self.products[1])
]);
}
ko.applyBindings(new ProductsViewModel(),document.getElementById('thePage'));
//HTML page
<html>
<script type='text/javascript' src='knockout-3.2.0.js'></script>
<script type='text/javascript' src='test2.js' defer="defer"></script>
<h2>Product Orders</h2>
<table>
<thead id="thePage"><tr>
<th>Customer name</th>
</tr>
</thead>
<tbody data-bind="foreach: productOrders">
<tr>
<td data-bind="text: name" ></td>
</tr>
</tbody>
</table>