Skip to content

Unit-4 Questions

The Collections Framework

Collections Overview, Collection Interfaces, The List Interface, The ArrayList Class, The LinkedList Class

Part A: Framework Fundamentals

  1. What is the Java Collections Framework? Discuss its advantages and key interfaces.

Part B: The ArrayList

  1. 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.

  2. Illustrate with an example of how to obtain a standard array from an ArrayList.

Part C: The LinkedList

  1. 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.

  2. 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

  1. What is a URL? Explain each of its components.

  2. Discuss any four network classes in Java.

  3. Explain the purpose of the Java URL and InetAddress classes.

Part B: TCP/IP Socket Programming (Connection-Oriented)

  1. What are TCP/IP Sockets? Briefly explain the information they hold.

  2. Explain the steps involved in establishing a TCP connection between a client and a server.

  3. Write and explain a complete Java program for client-server communication using Socket and ServerSocket.

  4. 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)

  1. Explain the roles of DatagramSocket and DatagramPacket in UDP communication.

Lambda Expressions

Introducing Lambda Expressions, Block Lambda Expressions

  1. What is a Lambda Expression in Java? Provide an example.

  2. Write a program that uses a lambda expression to implement a simple event handler. Explain how lambda expressions simplify the code.

  3. 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

Made with ❤️ for students, by a fellow learner.