Java Distributed Computing - Multiple Choice Questions
1. What is Java Networking?
A) A GUI tool
B) A way to compile Java code
C) Connecting computing devices to share resources
D) A method of data encryption
Answer: C
2. Which Java package supports networking?
A) java.io
B) java.util
C) java.net
D) java.lang
Answer: C
3. What is a peer-to-peer network?
A) Clients connect to a central server
B) All nodes are functionally equal
C) Data is only sent to one node
D) It requires a switch
Answer: B
4. Which of the following is true about a client-server network?
A) Server acts as client
B) Client provides service
C) Server waits for client requests
D) Client binds ports
Answer: C
5. What uniquely identifies a node on a network?
A) Port number
B) IP address
C) MAC address
D) Protocol
Answer: B
6. Which protocol is connection-oriented?
A) UDP
B) HTTP
C) TCP
D) FTP
Answer: C
7. Which class is used to create a client socket?
A) ServerSocket
B) DatagramSocket
C) Socket
D) Stream
Answer: C
8. What does ServerSocket's accept() method do?
A) Sends data
B) Listens for connection
C) Encrypts message
D) Breaks loop
Answer: B
9. Which method is used to read/write to socket?
A) Scanner()
B) InputStream/OutputStream
C) PrintWriter()
D) Reader()
Answer: B
10. Which two classes are used for UDP?
A) Socket and ServerSocket
B) DatagramSocket and DatagramPacket
C) PrintWriter and Scanner
D) Reader and Writer
Answer: B
11. What is RMI?
A) Remote Method Interpreter
B) Remote Method Invocation
C) Remote Memory Interface
D) Real-time Method Invocation
Answer: B
12. What does a stub do in RMI?
A) Sends parameters to skeleton
B) Handles graphics
C) Logs system errors
D) Runs on the server only
Answer: A
13. Which object handles method call on the server side in RMI?
A) Client
B) Interface
C) Skeleton
D) JVM
Answer: C
14. What must a remote interface extend?
A) Serializable
B) Runnable
C) Remote
D) Object
Answer: C
15. What must each method in a remote interface declare?
A) IOException
B) NullPointerException
C) RemoteException
D) TimeoutException
Answer: C
16. What tool starts the RMI registry?
A) javac
B) rmiregistry
C) javadoc
D) rmic
Answer: B
17. Which class is used to register remote objects?
A) Naming
B) File
C) Registry
D) Connection
Answer: A
18. In socket programming, what does the client need to know?
A) Server hostname and port
B) Only IP
C) File path
D) Protocol only
Answer: A
19. Which constructor creates a DatagramPacket to be received?
A) DatagramPacket(byte[], int)
B) DatagramPacket()
C) newPacket()
D) getPacket()
Answer: A
20. What port number is default for HTTP servers?
A) 22
B) 21
C) 80
D) 8080
Answer: C