NPTEL Programming in Java Week 10 Assignment Answers 2024
1. What will be the output of the following Java program?
a. Protocol: https
b. Host Name: nptel.ac.in
c. Port Number: -1
d. All of the mentioned
Answer :- For Answers Click Here
2. What will be the output of the following Java program?
a. nptel
b. nptel.ac.in
c. www.nptel.ac.in
d. none of the mentioned
Answer :- For Answers Click Here
3. Which class provides methods to work with URLs?
a. URLConnection
b. HttpURL
c. NetURL
d. URL
Answer :- For Answers Click Here
4. Which exception is thrown when a connection cannot be established with a remote server?
a. IOException
b. UnknownHostException
c. ConnectionException
d. NetworkException
Answer :-
5. Which class provides methods to create a client-side socket in Java?
a. ServerSocket
b. NetSocket
c. Socket
d. ClientSocket
Answer :-
6. Which of the following statement is TRUE?
a. With stream sockets there is no need to establish any connection and data flows between the processes are as continuous streams.
b. Stream sockets are said to provide a connection-less service and UDP protocol is used
c. Datagram sockets are said to provide a connection-oriented service and TCP protocol is used
d. With datagram sockets there is no need to establish any connection and data flows between the processes are as packets.
Answer :- For Answers Click Here
7. The server listens for a connection request from a client using which of the following statement?
a. Socket s = new Socket(ServerName, port);
b. Socket s = serverSocket.accept()
c. Socket s = serverSocket.getSocket()
d. Socket s = new Socket(ServerName);
Answer :-
8. Which of the following is/are application layer protocol(s)?
a. TCP
b. UDP
c. ARP
d. SMTP
Answer :-
9. In the following URL, identify the Resource name?
https://nptel.ac.in
a. https
b. nptel.ac.in
c. ac.in
d. nptel
Answer :-
10. What does this Java code snippet do?
a. Just prints the IP address of the local machine
b. Prints the IP address and host name of the local machine
c. Prints the IP address and host name of “nptel.ac.in”
d. Just prints the IP address of “nptel.ac.in”
Answer :- For Answers Click Here