1. Which of the following statements regarding
WebSockets is true?
Answers:
• It communicates with the
server with only the data required by the application.
• It lowers the latency of
connections for interactive web applications.
• It scales better and
consumes less server resources than HTTP AJAX/long-poll.
• All of
the above.
2. Assuming that some text needs to be written on an HTML5 canvas, select a replacement for the commented line below:
<canvas id="e" width="200" height="200"></canvas>
<script>
var canvas = document.getElementById("e");
//insert code here
context.fillStyle = "blue";
context.font = "bold 16px Arial";
context.fillText("Zibri", 100, 100);
</script>
Answers:
• var context =
canvas.getContext();
• var context =
canvas.getElementById("context");
• var
context = canvas.getContext("2d");
• var context =
canvas.getElementById("2d");