This Portion of Computer Networking contains Computer Networking Socket Programming In Java MCQs (Multiple Choice Questions and Answers).
This Section covers below lists of topics.
1 INTRODUCTION
• Addresses and Ports
• Client-Server Paradigm
2 PROGRAMMING WITH UDP
• Iterative Approach
• Concurrent Approach
3 PROGRAMMINGWITH TCP
• Iterative Approach
• Concurrent Approach
1. Network programming in any language definitely needs to deal with ____________ and _______________.
- user names; port numbers
- IP addresses; link-layer address
- IP addresses; port numbers
- None of the choices are correct.
C. IP addresses; port numbers
2. In Java, an IP address is defined as an object, the instance of _______ class.
- InetAddress
- SocketAddress
- IPAddress
- None of the choices are correct.
A. InetAddress
3. In Java, which of the following statement is true?
- To create IPv4 address we must use Inet4Address class.
- To create IPv6 address we must use Inet6Address class.
- We can use InetAddress class to create both IPv4 and IPv6 addresses.
- None of the choices are correct.
C. We can use InetAddress class to create both IPv4 and IPv6 addresses.
4. A port number in Java is defined as ________________ integer.
- a 16-bit integer
- a 24-bit integer
- a 48-bit integer
- None of the choices are correct.
B. a 24-bit integer
5. The class used in Java network programming for socket address is the ______________ class.
- InetAddress
- SocketAddress
- InetSocketAddress
- None of the choices are correct.
C. InetSocketAddress
6. A server in a client-server paradigm can be designed either as an _______ server or a _________ server.
- asynchronous; concurrent
- iterative; concurrent
- simultaneous; intermittent
- None of the choices are correct.
B. iterative; concurrent
7. A concurrent server can server ___________.
- one client at a time
- only two clients simultaneously
- several clients simultaneously
- None of the choices are correct.
C. several clients simultaneously
8. An iterative server handles _________________.
- one client at a time
- two clients simultaneously
- several clients simultaneously
- None of the choices are correct.
A. one client at a time
9. Java implementation of UDP uses ____________________.
- only one type of socket objects
- two types of socket objects
- many types of socket objects
- None of the choices are correct.
A. only one type of socket objects
10. The DagramSocket class is used to create sockets ________________.
- in the UDP client
- in the UDP server
- in both the UDP client and UDP server
- None of the choices are correct.
C. in both the UDP client and UDP server
11. The ________________ class is used to create datagram packets.
- DatagramPacket
- DagramSocket
- DagramSocket or DatagramPacket
- None of the choices are correct.
C. DagramSocket or DatagramPacket
12. Java implementation of TCP uses _______________ types of socket objects.
- only one
- only two
- Many types
- None of the choices are correct.
B. only two
13. In Java implementation of TCP, a client uses _________; a server uses __________.
- ClientSocket object; ServerSocket object
- Socket object; ServerSocket objec
- Socket object; ServerSocket object and Socket object
- None of the choices are correct.
C. Socket object; ServerSocket object and Socket object
14. ServerSocket is sometimes called the ________ and or the ______ socket.
- passive socket; listen socket
- active socket; listen socket
- waiting socket; listen socket
- None of the choices are correct.
A. passive socket; listen socket
15. _______________ is responsible for establishing a connection.
- Socket
- ServerSocket
- ClientSocket
- None of the choices are correct.
C. ClientSocket
16. In Java two methods, getOutputStream and getInputStream, are provided in the ________ class.
- ServerSocket
- Socket
- Stream
- None of the choices are correct.
B. Socket