Sockets Questions MCQs


sockets Questions

Total Questions : 69

Page 1 of 4 pages
Question 1. Which of the following is a stateless protocol?
  1.    HTML
  2.    XHTML
  3.    HTTP
  4.    All of the mentioned
Answer: Option C
Question 2. What does the value 2 of the WebSocket attribute Socket.readyState indicate?
  1.    Closed connection
  2.    Handshake connection
  3.    Unestablished connection
  4.    Established connection and communication is possible
Answer: Option B
Question 3. How many WebSocket events are available?
  1.    2
  2.    3
  3.    4
  4.    5
Answer: Option C
Question 4. Which method is used to close the WebSocket?
  1.    Socket.flush()
  2.    Socket.close()
  3.    Socket.Close()
  4.    Socket.dispose()
Answer: Option B
Question 5. How does the client and the server communicate following the rules defined by the WebSocket protocol?
  1.    Long-lived TCP Socket
  2.    Short-lived TCP Socket
  3.    UDP Socket
  4.    HTTP Socket
Answer: Option A
Question 6. Which of the following are not a socket property?
  1.    onopen
  2.    readyState
  3.    onmessage
  4.    ready
Answer: Option D
Question 7. How can we check the subprotocol being used by the client?
  1.    subprotocol property
  2.    protocol property
  3.    clientprotocol property
  4.    none of the mentioned
Answer: Option B
Question 8. How will you transmit data using the connection?
  1.    send(data)
  2.    Socket.send(“data”)
  3.    Socket.send(data)
  4.    Socket(data)
Answer: Option C
Question 9. Which of the following is not a WebSocket event?
  1.    open
  2.    close
  3.    error
  4.    deny
Answer: Option D
Question 10. What does an History object contain?
  1.    URL
  2.    Parameters
  3.    Attribute values
  4.    Property
Answer: Option A
Question 11. The history object is a part of which object?
  1.    Property
  2.    Window
  3.    Location
  4.    Screen
Answer: Option B
Question 12. How many methods are there in the History object?
  1.    3
  2.    4
  3.    5
  4.    6
Answer: Option A
Question 13. What is the purpose of the method forward()?
  1.    Loads any random URL in the history list
  2.    Loads the previous URL in the history list
  3.    Loads a specific URL from the history list
  4.    Loads the next URL in the history list
Answer: Option D
Question 14. How do you add a particular state to the browsing history?
  1.    pushState()
  2.    replaceState()
  3.    state()
  4.    none of the mentioned
Answer: Option A
Question 15. How will you update the URL displayed in the location bar?
  1.    location
  2.    location.URL
  3.    location.hash
  4.    url
Answer: Option C
Question 16. What does the pushState() method do?
  1.    Removes the state
  2.    Adds new state
  3.    Replaces the state
  4.    None of the mentioned
Answer: Option B
Question 17. Which of the following method is used to replace the current history state instead of adding a new state to the browsing history?
  1.    replaceState()
  2.    replace(state)
  3.    replace()
  4.    none of the mentioned
Answer: Option A
Question 18. How many parameters does the replaceState() method take?
  1.    2
  2.    3
  3.    4
  4.    5
Answer: Option B
Question 19. What is the purpose of the event window.onpopstate?
  1.    When a state object is replaced
  2.    When a state object is added
  3.    When a state object is removed
  4.    None of the mentioned
Answer: Option C
Question 20. R is an extension of which of the following language?
  1.    C
  2.    C++
  3.    S
  4.    None of the mentioned
Answer: Option C