Wednesday, March 9, 2016

MCQ Questions & Answers – Networking – Datagrams

This set of Java Multiple Choice Questions & Answers (MCQs) focuses on “Networking – Datagrams”.

1. Which of these is a bundle of information passed between machines?
a) Mime
b) Cache
c) Datagrams
d) DatagramSocket
View Answer

Answer: c
Explanation: The Datagrams are the bundle of information passed between machines.

2. Which of these class is necessary to implement datagrams?
a) DatagramPacket
b) DatagramSocket
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: None.

3. Which of these method of DatagramPacket is used to find the port number?
a) port()
b) getPort()
c) findPort()
d) recievePort()
View Answer

Answer: b
Explanation: None.

4. Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?
a) getData()
b) getBytes()
c) getArray()
d) recieveBytes()
View Answer

Answer: a
Explanation: None.

5. Which of these methods of DatagramPacket is used to find the length of byte array?
a) getnumber()
b) length()
c) Length()
d) getLength()
View Answer

Answer: d
Explanation: getLength returns the length of the valid data contained in the byte array that would be returned from the getData () method. This typically is not equal to length of whole byte array.

6. Which of these class must be used to send a datagram packets over a connection?
a) InetAdress
b) DatagramPacket
c) DatagramSocket
d) All of the mentioned
View Answer

Answer: d
Explanation: By using 5 classes we can send and receive data between client and server, these are InetAddress, Socket, ServerSocket, DatagramSocket, and DatagramPacket.

7. Which of these method of DatagramPacket class is used to find the destination address?
a) findAddress()
b) getAddress()
c) Address()
d) whois()
View Answer

Answer: b
Explanation: None.

8. Which of these is a return type of getAddress() method of DatagramPacket class?
a) DatagramPacket
b) DatagramSocket
c) InetAddress
d) ServerSocket
View Answer

Answer: c
Explanation: None.

9. Which API gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.
a) getSocketAddress()
b) getAddress()
c) address()
d) none of the mentioned
View Answer

Answer: a
Explanation: getSocketAddress() is used to get the socket address.


No comments:

Post a Comment

Configure LOG4J in INTELLIJ in Windows.

IntelliJ debugger for temporary logging In this video, it is shown how to use Log4j in Intellij. Sorry for the audio quality :) Log4j zip fi...