ExamVeda
Login
Home
1
Which of the following is a stateless protocol?
Discuss
Answer & Solution
Answer: Option C
Solution:
HTTP is a stateless protocol. A stateless protocol does not require the server to retain information or status about each user for the duration of multiple requests.
2
What does the value 2 of the WebSocket attribute Socket.readyState indicate?
Discuss
Answer & Solution
Answer: Option B
Solution:
The readonly attribute readyState represents the state of the connection. It can have the following values:
1. A value of 0 indicates that the connection has not yet been established.
2. A value of 1 indicates that the connection is established and communication is possible.
3. A value of 2 indicates that the connection is going through the closing handshake.
4. A value of 3 indicates that the connection has been closed or could not be opened.
3
How many WebSocket events are available?
Discuss
Answer & Solution
Answer: Option C
Solution:
There are fourWebSocket events namely :
1. open
2. close
3. message
4. error
4
Which method is used to close the WebSocket?
Discuss
Answer & Solution
Answer: Option B
Solution:
The Socket.close() is used to close the WebSocket.
5
How does the client and the server communicate following the rules defined by the WebSocket protocol?
Discuss
Answer & Solution
Answer: Option A
Solution:
The client and server communicate over a long-lived TCP socket following rules defined by the WebSocket protocol.
6
Which of the following are not a socket property?
Discuss
Answer & Solution
Answer: Option D
Solution:
There is no Socket property called ready.
7
How can we check the subprotocol being used by the client?
Discuss
Answer & Solution
Answer: Option B
Solution:
Once the connection is established, the client can determine which subprotocol is in use by checking the protocol property of the socket.
8
How will you transmit data using the connection?
Discuss
Answer & Solution
Answer: Option C
Solution:
The Socket.send(data) method transmits data using the connection.
9
Which of the following is not a WebSocket event?
Discuss
Answer & Solution
Answer: Option D
Solution:
There is no WebSocket event named deny. The four WebSocket events are
1. open
2. close
3. essage
4. error
10
What does an History object contain?
Discuss
Answer & Solution
Answer: Option A
Solution:
The history object contains the URLs visited by the user (within a browser window).