0% found this document useful (0 votes)
67 views3 pages

Java Programming Unit 5 Question Bank

The document is a question bank for a Java programming unit focused on network programming. It includes 2-mark, 4-mark, and 6-mark questions covering topics such as sockets, protocols, URL handling, and programming tasks related to TCP and UDP communication. Additionally, it features programming questions that require the implementation of various networking functionalities in Java.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views3 pages

Java Programming Unit 5 Question Bank

The document is a question bank for a Java programming unit focused on network programming. It includes 2-mark, 4-mark, and 6-mark questions covering topics such as sockets, protocols, URL handling, and programming tasks related to TCP and UDP communication. Additionally, it features programming questions that require the implementation of various networking functionalities in Java.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

k·s

Diplomatech Academy
Java programming unit 5
Vviimp Question bank
:

✅ UNIT V – BASICS OF NETWORK PROGRAMMING

✅ 2 MARKS QUESTIONS (Total: 20)

1. Define a socket in Java networking.


2. What is a proxy server?
3. State the use of reserved sockets.
4. What is Internet Addressing?
5. List any two classes from java.net package.
6. State two factory methods of the InetAddress class.
7. What is the purpose of getByName() method?
8. Define port number with an example.
9. What is the difference between TCP and UDP sockets?
10. Write the syntax to create a TCP socket in Java.
11. Define URL class in Java networking.
12. What is the use of URLConnection class?
13. Name any two instance methods of InetAddress.
14. What does isReachable() method do?
15. What is a datagram socket?
16. Write the syntax to send a datagram packet.
17. List any two methods of URLConnection class.
18. Define the terms: client and server in socket programming.
19. What is the purpose of ServerSocket class?
20. Differentiate between InetAddress.getLocalHost() and InetAddress.getByName().

✅ 4 MARKS QUESTIONS (Total: 20)

1. Explain the client-server socket connection mechanism with diagram.


2. Write a short note on InetAddress class and its methods.
3. Differentiate between TCP and UDP protocols.
k·s

4. Write a Java code snippet to display the IP address of www.google.com.


5. Explain how proxy servers are used in networking.
6. Write the syntax and use of URL and URLConnection classes.
7. Describe the basic structure of a datagram packet communication.
8. Explain four methods of the InetAddress class.
9. What is the difference between Socket and ServerSocket?
10. Write a Java code to fetch local IP and host name using InetAddress.
11. Compare Socket vs DatagramSocket with suitable examples.
12. Explain how ports and IP addresses are used together in networking.
13. Write a short note on reserved ports with examples.
14. What is URLConnection? Explain any two of its methods.
15. Explain the importance of the java.net package.
16. Write a Java code to check if a website is reachable or not.
17. What is the use of DatagramPacket? Explain with an example.
18. State and explain the process of sending and receiving data using UDP.
19. Explain the different types of socket constructors in Java.
20. Write a short note on the role of IP addressing in socket communication.

✅ 6 MARKS QUESTIONS (Total: 20)

1. Write a Java program to implement a TCP Client-Server application.


2. Write a Java program to implement message transfer using DatagramSocket and
DatagramPacket.
3. Explain URLConnection class in detail with a program to read webpage content.
4. What are the various networking classes in Java? Explain with their hierarchy.
5. Write a program to fetch host name, IP, and check reachability of a website.
6. Compare TCP, UDP, and HTTP protocols in networking.
7. Explain the lifecycle of a socket connection using suitable diagrams.
8. Write a complete Java program to display header information of a URL using URLConnection.
9. What is the significance of port addressing in network programming? Explain with examples.
10. Explain in detail the working of TCP and UDP socket communication with examples.
11. Write a Java program using InetAddress to find the IP addresses of five different domains.
12. Explain all steps involved in sending data using UDP with code.
13. Describe the internal working of ServerSocket and how it accepts clients.
14. Explain IPv4 vs IPv6 addressing with diagrams and examples.
15. Write a Java program that simulates a basic HTTP client using URL.
16. Explain connection-oriented and connectionless socket communication.
17. Explain how Java handles DNS resolution using InetAddress.
18. Write a program to display all IPs associated with a domain using
InetAddress.getAllByName().
19. Describe how firewall and proxy servers affect socket connections.
20. Write a Java program to create an HTTP client that retrieves content using URLConnection.
k·s

✅ PROGRAMMING QUESTIONS (Total: 20)

1. Write a Java TCP server program that listens to a port and sends "Welcome Client".
2. Write the client-side TCP Java program that connects to server and receives message.
3. Develop a Java program using InetAddress.getLocalHost() to get system IP and hostname.
4. Write a Java program to display IP address of www.yahoo.com.
5. Create a Java program that sends and receives a UDP datagram.
6. Write a Java program that connects to a URL and prints page content using URLConnection.
7. Write a multi-threaded TCP server that handles multiple clients.
8. Develop a proxy-style Java program that receives a URL, fetches and displays the content.
9. Write a program to show URLConnection headers (content-type, length, etc.) of a webpage.
10. Create a Java class that checks whether a host is reachable or not using isReachable().
11. Write a UDP echo server and client in Java.
12. Write a TCP file transfer client-server program in Java.
13. Develop a chat application using TCP sockets between two Java clients.
14. Write a Java program using getAllByName() to fetch all IPs of a domain.
15. Write a program that connects to multiple servers using sockets and retrieves basic data.
16. Create a simple InetAddress utility that verifies if IP/hostname is valid.
17. Simulate a mini DNS resolver in Java using InetAddress.
18. Create a TCP server-client program to transfer student record data.
19. Write a Java program using UDP that receives a number and sends its square.
20. Create a basic web crawler using Java’s URL and URLConnection classes.

You might also like