Computer Networks Questions & Answers – Socket
Programming
1. Which methods are commonly used
in Server Socket class?
a) Public Output Stream get Output Stream ()
b) Public Socket accept ()
c) Public synchronized void close ()
d) None of the mentioned
a) Public Output Stream get Output Stream ()
b) Public Socket accept ()
c) Public synchronized void close ()
d) None of the mentioned
Answer: b
Explanation: Public Socket accept () used in Server Socket class.
Explanation: Public Socket accept () used in Server Socket class.
2. Which constructor of Datagram
Socket class is used to create a datagram socket and binds it with the given
Port Number?
a) Datagram Socket(int port)
b) Datagram Socket(int port, Int Address address)
c) Datagram Socket()
d) None of the mentioned
a) Datagram Socket(int port)
b) Datagram Socket(int port, Int Address address)
c) Datagram Socket()
d) None of the mentioned
Answer: b
Explanation: Datagram Socket (int port, Int Address address) is use data create a datagram socket.
Explanation: Datagram Socket (int port, Int Address address) is use data create a datagram socket.
3. The client in socket programming
must know which information?
a) IP address of Server
b) Port number
c) Both IP address of Server & Port number
d) None of the mentioned
a) IP address of Server
b) Port number
c) Both IP address of Server & Port number
d) None of the mentioned
Answer: c
Explanation: The client in socket programming must know IP address of Server.
Explanation: The client in socket programming must know IP address of Server.
4. The URL Connection class can be
used to read and write data to the specified resource referred by the URL
a) True
b) False
a) True
b) False
Answer: a
Explanation: The URL Connection class can be used to read and write data to the specified resource referred by the URL.
Explanation: The URL Connection class can be used to read and write data to the specified resource referred by the URL.
5. Datagram is basically an
information but there is no guarantee of its content, arrival or arrival time.
a) True
b) False
a) True
b) False
Answer: a
Explanation: Datagram is basically an information but there is no guarantee of its content, arrival or arrival time.
Explanation: Datagram is basically an information but there is no guarantee of its content, arrival or arrival time.
6. TCP, FTP, Telnet, SMTP, POP etc.
are examples of?
a) Socket
b) IP Address
c) Protocol
d) MAC Address
a) Socket
b) IP Address
c) Protocol
d) MAC Address
Answer: c
Explanation: TCP, FTP, Telnet, SMTP, POP etc. are examples of Protocol.
Explanation: TCP, FTP, Telnet, SMTP, POP etc. are examples of Protocol.
7. What does the
java.net.InetAddress class represent?
a) Socket
b) IP Address
c) Protocol
d) MAC Address
a) Socket
b) IP Address
c) Protocol
d) MAC Address
Answer: b
Explanation: The java.net.InetAddress class represent IP Address.
Explanation: The java.net.InetAddress class represent IP Address.
8. The flush () method of Print
Stream class flushes any un cleared buffers in memory
a) True
b) False
a) True
b) False
Answer: a
Explanation: The flush () method of Print Stream class flushes any un cleared buffers in memory.
Explanation: The flush () method of Print Stream class flushes any un cleared buffers in memory.
9. Which classes are used for
connection-less socket programming?
a) Datagram Socket
b) Datagram Packet
c) Both Datagram Socket & Datagram Packet
d) None of the mentioned
a) Datagram Socket
b) Datagram Packet
c) Both Datagram Socket & Datagram Packet
d) None of the mentioned
Answer: c
Explanation: Datagram Socket, Datagram Packet are used for connection-less socket programming.
Explanation: Datagram Socket, Datagram Packet are used for connection-less socket programming.
10. In Int Address class which
method returns the host name of the IP Address?
a) Public String get Hostname()
b) Public String getHostAddress()
c) Public static IntAddress get Localhost()
d) None of the mentioned
a) Public String get Hostname()
b) Public String getHostAddress()
c) Public static IntAddress get Localhost()
d) None of the mentioned
Answer: a
Explanation: In Int Address class public String get Hostname() method returns the host name of the IP Address.
Explanation: In Int Address class public String get Hostname() method returns the host name of the IP Address.
ليست هناك تعليقات:
إرسال تعليق