HTML Questions & Answers – Web Socket Communications

This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Web Socket Communications”.

1. Which of the following is not associated with web socket communication?
a) https
b) wss
c) ws
d) http
View Answer

Answer: d
Explanation: For opening WebSocket we call WebSocket constructor. The syntax is

var conn=new WebSocket(‘ws://rtyyghj.websocket.org/echo’,[‘brush’, ‘xmpp’]);

for using secure HTTP connections use https: ,ws: is the new URL scheme for connecting WebSockets. There is wss: also.

advertisement
advertisement

2. Which of the following is the wire protocol for WebScoket?
a) RFC6455
b) RFC6477
c) RFC6567
d) RFC8967
View Answer

Answer: a
Explanation: Wire protocol is handshaking and data transferring between server and client. It is the RFC6455. Chrome for Android and Chrome are compatible with RFC6455. It includes binary messaging also. Firefox version 11 and Internet Explorer 10 is also compatible with this.

3. The maximum bytes for control frames is _______________
a) 100 bytes
b) 125 bytes
c) 130 bytes
d) 150 bytes
View Answer

Answer: b
Explanation: Control frames must be of 125 bytes or less than this. Control frames must not be fragmented. They have opcode of 0x02 (Ping), 0x01 (close) or 0x03 (Pong). Control frames help in communicating state about webSocket.

4. Which of the following is the server library for Node.js?
a) Caddy
b) SignalR
c) ws
d) jsonrpc
View Answer

Answer: c
Explanation: ws is server library and WebSocket client for Node.js. Caddy is used for proxying arbitrary commands. WebSocket under covers is used by SignalR. To use asynchronous RPC library with the bidirectional call we use JSONRPC.server.

5. In desktop which browser does not support WebSocket?
a) Chrome version 7
b) Chrome version 6
c) Chrome version 43
d) Internet Explorer 10
View Answer

Answer: a
Explanation: In desktops, WebSockets are supported by Chrome version-6, version-43, version-14. Edge-14 supports WebSockets. All the versions of firefox support WebSocket. Opera version-76 and version-7 do not support WebSocket. Safari version-5.0.1 and version-6.0 support WebSocket.
advertisement

6. Which one is not associated with Gecko?
a) Firefox
b) SeaMonkey
c) Thunderbird
d) Internet Explorer
View Answer

Answer: d
Explanation: Gecko 7.0 includes Firefox 7.0/SeaMonkey 2.4/Thunderbird 7.0. Gecko 8.0 includes Firefox 8.0/SeaMonkey 2.5/Thunderbird 8.0. In Gecko 11.0 WebSocket API is no longer used as a prefix. In Gecko 7.0 network.websocket.max-connections is used.

7. Messages from the server are received by ____
a) onmessage
b) send
c) arrayBuffer
d) blob
View Answer

Answer: a
Explanation: onmessage function is used for receiving messages from the server. E.g. memeDocket.onmessage = function (eve) { console.log(eve.data); }. For sending data as a string we use ArrayaBuffer and Blob.
advertisement

8. For duplex communication we can’t use ____________
a) Long Polling
b) HTML5
c) JavaScript
d) Streaming
View Answer

Answer: c
Explanation: There are some existing techniques for the communication between client and server known as duplex techniques. They are Streaming, HTML5, Postback and AJAX, Long Polling, Polling. For real-time transferring of data, Streaming is the best option. Polling performs periodic requests.

9. Which of the following is not the event of WebSocket API?
a) Close
b) Message
c) Send
d) Error
View Answer

Answer: c
Explanation: There are four WebSocket API, Close, Message, Error and Open. We can implement these events by using functions like onmessage, onopen, onerror, addEventListener and onclose. When there is an end of communication between client and server then onclose method is called.

10. Which one is not a very good developer support?
a) Opera
b) Internet Explorer
c) Firefox
d) Chrome
View Answer

Answer: b
Explanation: Firefox, Chrome and Opera are the very good browser in terms of developer support. They have various built-in tools for the interaction of client-side and resources. It is also very helpful for security purposes.

Sanfoundry Global Education & Learning Series – HTML.

To practice all areas of HTML, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.