NETWORKING MCQs
NETWORKING MCQs
4. Which class in Java is used to read and write data to a specified URL?
A)InetAddress
B)URLConnection
C)Socket
D)DatagramSocket
5. What does the term "port" refer to in computer networking?
A)12
B)8
C)16
D)4
7. Which of the following statements is true regarding the checksum field in IPv4 and IPv6?
A)Decimal
B)Binary
C)Hexadecimal
D)Alphanumeric
9. Which protocol is built into IPv6 for security purposes?
A)SNMP
B)IPSec
C)TCP
D)UDP
10. What is the maximum number of addresses that IPv4 can support?
A)2.3 billion
B)4.3 billion
C)10 billion
D)Infinite
A)Host identification
B)Location addressing
C)Data encryption
D)Routing information
13. What is the primary difference in addressing methods between IPv4 and IPv6?
15. Which of the following is a method to communicate between computers over a network?
19. Which of the following statements is true about TCP compared to UDP?
A)Datagram Socket
B)Stream Socket
C)Raw Socket
D)Broadcast Socket
21. Which class in the java.net package is used to represent the client side of a socket connection?
A)DatagramSocket
B)ServerSocket
C)Socket
D)RawSocket
A)FTP
B)Telnet
C)SMTP
D)HTTP
A)TCP connections
B)UDP packets
C)ICMP messages
D)HTTP requests
28. What is the main difference between a stream socket and a datagram socket?
31. Which of the following statements is true regarding error checking in UDP?
32. What happens when a client sends a request to a server in a socket connection?
34. Which constructor of the URL class creates an instance from a URL specifier?
35. What method would you use to get the protocol of a URL?
A)getHost()
B)getProtocol()
C)getFile()
D)getPort()
36. Which method of the URLConnection class returns the size of the content in bytes?
A)getContentType()
B)getContentLength()
C)getLastModified()
D)getExpiration()
37. What does the getExpiration() method return?
A)10
B)25
C)50
D)100
A)Socket
B)URL
C)ServerSocket
D)URLConnection
40. What does the ServerSocket constructor with parameters (int port, int maxQueue) specify?
A)toString()
B)equals(Object obj)
C)getHost()
D)getFile()
43. Which of the following methods would return the host name of a URL?
A)getPort()
B)getHost()
C)getFile()
D)getProtocol()
A)ServerSocket(int port)
B)ServerSocket(int port, int maxQueue)
C)ServerSocket(int port, int maxQueue, InetAddress localAddress)
D)ServerSocket(int port, String host)
48. When creating a ServerSocket, what does the localAddress parameter specify?
A)23
B)25
C)21
D)80
51. What does the Domain Naming Service (DNS) primarily help with?
A)getLocalHost()
B)getByName(String hostName)
C)getHostName()
D)getAllByName(String hostName)
53. What is the main advantage of using a caching proxy server?
54. Which of the following protocols is associated with port number 443?
A)FTP
B)HTTP
C)HTTPS
D)Telnet
55. What does the method getAddress() in the InetAddress class return?
58. What is the significance of port numbers greater than or equal to 1024?
59. Which method would you use to obtain the local host's InetAddress object?
A)getByName()
B)getLocalHost()
C)getAllByName()
D)getByAddress()
62. What is the purpose of the equals(Object other) method in the InetAddress class?
64. What is the optional component of a URL that specifies the server's listening port?
A)Protocol
B)Domain Name
C)Port Number
D)Filename
65. What is the primary function of SNMP (Simple Network Management Protocol)?
68. In the OSI model, what happens to data at the physical layer?
70. Which of the following protocols is an example of an application that requires a reliable communication
channel?
71. What distinguishes User Datagram Protocol (UDP) from Transmission Control Protocol (TCP)?
78. Which layer of the OSI model is responsible for the actual transfer of data?
A)Application layer
B)Transport layer
C)Network layer
D)Physical layer
82. Which of the following best describes the author's perspective on personal growth?
83. What role does the author attribute to mentorship in personal development?
84. How does the text suggest individuals can contribute to their communities?
A)Lack of ambition
B)Overreliance on technology
C)Isolation from community support
D)Excessive social interaction
86. According to the text, what is a significant benefit of engaging with a diverse community?
87. Which of the following strategies does the author recommend for effective self-reflection?
88. What does the text imply about the relationship between personal goals and community involvement?
90. What is one way the text suggests individuals can build resilience?
91. Which of the following is highlighted as a key factor in fostering a supportive community?
92. What does the author suggest about the role of feedback in personal development?
94. What does the author identify as a crucial element for sustaining motivation?
A)Financial incentives
B)A clear sense of purpose
C)Public recognition
D)Avoiding challenges
95. How does the text characterize the impact of technology on personal development?
A)setData()
B)setLength()
C)setAddress()
D)setPort()
99. Which constructor of DatagramSocket binds the socket to a specific port number and host address?
A)DatagramSocket()
B)DatagramSocket(int port)
C)DatagramSocket(int port, InetAddress address)
D)DatagramSocket(InetAddress address)
A)send()
B)receive()
C)getPort()
D)getData()
103. If you want to set the length of a datagram packet, which method would you use?
A)setData()
B)setLength()
C)setPort()
D)setAddress()
A)Connection-oriented socket
B)Connection-less socket
C)Stream socket
D)Secure socket
105. Which method retrieves the address to which the socket is connected?
A)getLocalAddress()
B)getInetAddress()
C)getPort()
D)getData()
A)IOException
B)SocketException
C)NullPointerException
D)ClassNotFoundException
108. Which method would you use to send a datagram packet from a socket?
A)receive()
B)send()
C)close()
D)getLocalPort()
109. What is the purpose of the setData(byte\[\] buf) method?
110. Which of the following methods would you use to get the local address of a DatagramSocket?
A)getInetAddress()
B)getLocalAddress()
C)getPort()
D)getData()
A)ServerSocket
B)DatagramSocket
C)Socket
D)ConnectionSocket
115. What does the method getInetAddress() return when the socket is not connected?
118. What does the method getPort() return when the socket is not connected?
A)\-1
B)0
C)The local port number
D)The remote port number
A)getOutputStream()
B)getInputStream()
C)getStream()
D)accessInput()
122. What does the method getLocalPort() return if the socket is not bound?
A)0
B)\-1
C)The local IP address
D)The remote port number
A)SocketTimeoutException
B)UnknownHostException
C)ConnectionRefusedException
D)DatagramException
127. When using the Socket class, what is the significance of the port number?
4. B) URLConnection
5. B) A communication endpoint
6. B) 8
8. D) Alphanumeric
9. B) IPSec
13. B) IPv4 uses numeric addresses separated by dots, while IPv6 uses alphanumeric addresses separated by
colons
16. C) To act as an intermediary for requests from clients seeking resources from other servers
21. C) Socket
22. B) They allow communication between any computers that support TCP/IP
25. C) SMTP
28. B) Stream sockets are connection-oriented, while datagram sockets are connectionless
33. B) A URL
35. B) getProtocol()
36. B) getContentLength()
38. C) 50
39. C) ServerSocket
43. B) getHost()
50. C) 21
52. C) getHostName()
54. C) HTTPS
59. B) getLocalHost()
71. C) UDP does not guarantee delivery of packets, while TCP does.
97. C) setAddress()
101. B) receive()
102. B) The port number on the local host to which the socket is bound
103. B) setLength()
105. B) getInetAddress()
106. B) SocketException
108. B) send()
110. B) getLocalAddress()
114. C) Socket
115. C) Null
118. B) 0
119. B) They are bundles of information passed between machines without delivery assurance.
121. B) getInputStream()
122. B) -1
126. B) UnknownHostException