| Computer Networks Assessment | Online Test |
A. Datagram socket(int port)
B. Datagram socket(int port, int address address)
C. Datagram socket()
D. Datagram socket(int address)
Explanation: Datagram Socket (int port, Int Address address) is used to create a datagram socket. A datagram socket is created for connection-less communication between the server and the client. There is no accept() method in this class.
A. Ip address of server
B. Port number
C. Both ip address of server & port number
D. Only its own ip address
Explanation: The client in socket programming must know IP address of Server as it has to use that IP address in order to initialize the socket class constructor. That is how the client requests a connection to the server.
A. True
B. False
C.
D.
Explanation: The URL Connection class can be used to read and write data to the specified resource referred by the URL. A connection to the URL is initialized by the OpenConnection() method of the class.
A. True
B. False
C.
D.
Explanation: Datagram is basically some information travelling between the sender and the receiver, but there is no guarantee of its content, arrival or arrival time. A Datagram socket class object is created to make a datagram connection between the server and the client.
A. Socket
B. Ip address
C. Protocol
D. Mac address
Explanation: TCP, FTP, Telnet, SMTP, POP etc. are examples of Protocol. Out of them, TCP is a transport layer protocol and FTP, TELNET, SMTP and POP are application layer protocols.
A. Socket
B. Ip address
C. Protocol
D. Mac address
Explanation: The java.net.InetAddress class represents IP Address of a particular specified host. It can be used to resolve the host name from the IP address or the IP address from the host name.
A. True
B. False
C.
D.
Explanation: The flush () method of Print Stream class flushes any un cleared buffers in memory.
A. Datagram socket
B. Datagram packet
C. Both datagram socket & datagram packet
D. Server socket
Explanation: Datagram is basically some information travelling between the sender and the receiver, but there is no guarantee of its content, arrival or arrival time. Datagram Socket, Datagram Packet are used for connection-less socket programming, while Server Socket is used for connection-oriented socket programming.
A. Public string get hostname()
B. Public string gethostaddress()
C. Public static inetaddress get localhost()
D. Public getbyname()
Explanation: In Inet Address class public String getHostname() method returns the host name of the IP Address. The getHostAddress() method returns the IP address of the given host name.