Unit-4 Questions
The Collections Framework
Collections Overview, Collection Interfaces, The List Interface, The ArrayList Class, The LinkedList Class
Part A: Framework Fundamentals
- What is the Java Collections Framework? Discuss its advantages and key interfaces.
Part B: The ArrayList
Develop a program to demonstrate common ArrayList operations (e.g., adding, removing, and accessing elements). Explain the scenarios where an ArrayList is the preferred choice.
Illustrate with an example of how to obtain a standard array from an ArrayList.
Part C: The LinkedList
Develop a program that demonstrates LinkedList operations, including adding and removing elements from both the first and last positions. Explain the scenarios where LinkedList is preferred over ArrayList.
Using the LinkedList class, write a Java program to implement a Queue (First-In, First-Out).
Networking
Networking Basics, Client-Server Communication using TCP and UDP
Part A: High-Level Networking Concepts
What is a URL? Explain each of its components.
Discuss any four network classes in Java.
Explain the purpose of the Java
URL
andInetAddress
classes.
Part B: TCP/IP Socket Programming (Connection-Oriented)
What are TCP/IP Sockets? Briefly explain the information they hold.
Explain the steps involved in establishing a TCP connection between a client and a server.
Write and explain a complete Java program for client-server communication using
Socket
andServerSocket
.Write a client program to connect to the ‘whois’ service (port 43) to demonstrate a real-world socket connection.
Part C: UDP Datagram Programming (Connectionless)
- Explain the roles of
DatagramSocket
andDatagramPacket
in UDP communication.
Lambda Expressions
Introducing Lambda Expressions, Block Lambda Expressions
What is a Lambda Expression in Java? Provide an example.
Write a program that uses a lambda expression to implement a simple event handler. Explain how lambda expressions simplify the code.
Write a program to compute the factorial of an integer value using a block lambda expression.
Design Patterns
Introduction to Common Design Patterns: Singleton, Factory, Observer, Strategy