[Go to site: main page, start]

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

Java Problem Set: 1 to 10 Difficulty Levels

The document outlines a comprehensive Java problem set categorized by difficulty levels from 1 to 10. Each level contains a variety of programming tasks that cover fundamental concepts such as syntax, loops, object-oriented programming, exception handling, collections, multithreading, Java 8 features, and advanced design patterns. This structured approach aids learners in progressively enhancing their Java programming skills.

Uploaded by

unkwnoronno2389
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)
8 views3 pages

Java Problem Set: 1 to 10 Difficulty Levels

The document outlines a comprehensive Java problem set categorized by difficulty levels from 1 to 10. Each level contains a variety of programming tasks that cover fundamental concepts such as syntax, loops, object-oriented programming, exception handling, collections, multithreading, Java 8 features, and advanced design patterns. This structured approach aids learners in progressively enhancing their Java programming skills.

Uploaded by

unkwnoronno2389
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

Java Problem Set (Difficulty 1 → 10)

Level 1 (Beginner Warmups — Syntax & Basics) [1/10 → 2/10]


----------------------------------------------------------
1. Print “Hello, Java!” (test environment setup).
2. Take user input (name, age) and print a formatted message.
3. Swap two numbers without using a third variable.
4. Calculate area and circumference of a circle given radius.
5. Check whether a number is even or odd.
6. Convert temperature from Celsius to Fahrenheit and vice versa.
7. Find the largest of three numbers (using if-else).
8. Simple interest calculator (take principal, rate, time).
9. Check whether a character is vowel or consonant.
10. Calculate factorial of a number using loops.
11. Reverse digits of an integer.
12. Sum of digits of an integer.
13. Generate multiplication table for a number.
14. Check leap year.
15. Find greatest common divisor (GCD) using loop.
Level 2 (Strings & Loops) [2/10 → 3/10]
---------------------------------------
16. Check palindrome string (case-insensitive).
17. Count vowels, consonants, digits, spaces in a string.
18. Remove all whitespace from a string.
19. Count word frequency in a string (basic split).
20. Replace all vowels in a string with *.
21. Reverse words in a sentence individually.
22. Find longest word in a sentence.
23. Convert string to uppercase without using .toUpperCase().
24. Find ASCII value of each character in a string.
25. Find if two strings are anagrams.
26. Check if a substring exists in a string without using .contains().
27. Count occurrences of a character in a string.
28. Capitalize first letter of each word in a string.
29. Print all substrings of a string.
30. Remove duplicate characters from a string.
Level 3 (Arrays & Basic Collections) [3/10 → 4/10]
---------------------------------------------------
31. Find largest element in an array.
32. Find smallest element in an array.
33. Calculate average of array elements.
34. Reverse an array in place.
35. Rotate an array left by k positions.
36. Count frequency of each element in an array.
37. Remove duplicates from an array.
38. Merge two arrays into one.
39. Find missing number in a sequence (1 to n).
40. Find common elements between two arrays.
41. Find second largest element in an array.
42. Check if array is sorted.
43. Print array in wave form (up-down pattern).
44. Move all zeros to end of an array.
45. Implement linear search.
Level 4 (OOP Basics) [4/10 → 5/10]
----------------------------------
46. Create a Student class with fields and methods, then print details.
47. Create a BankAccount class with deposit, withdraw, balance check.
48. Create a Rectangle class with methods to calculate area & perimeter.
49. Create a Car class with fields (brand, speed), and methods (accelerate, brake).
50. Create a Library class with method to add and search for books.
51. Create a Person class and extend it into Employee with salary info.
52. Create a Circle class using encapsulation (private radius, getters/setters).
53. Design a Calculator class with overloaded methods for different operations.
54. Create a ComplexNumber class with add, subtract operations.
55. Create a Fraction class with simplify and add methods.
Level 5 (Inheritance, Polymorphism, Interfaces) [5/10 → 6/10]
--------------------------------------------------------------
56. Create Shape interface with area() and perimeter() implemented by Circle, Square.
57. Create Animal superclass with Dog, Cat subclasses implementing sound().
58. Demonstrate method overloading vs method overriding.
59. Implement multiple interfaces in a single class.
60. Use abstract class Vehicle with subclasses Car, Bike.
61. Implement Payment interface for CreditCard, UPI, PayPal.
62. Show dynamic polymorphism (runtime method binding).
63. Implement interface inheritance (interface extends another).
64. Create a program to demonstrate casting (upcasting/downcasting).
65. Design Employee hierarchy with Manager, Developer, Intern.
Level 6 (Exception Handling & File I/O) [6/10 → 7/10]
------------------------------------------------------
66. Handle division by zero using try-catch.
67. Create a custom exception InvalidAgeException.
68. Read a file and print its contents line by line.
69. Write a string to a file.
70. Count number of lines, words, characters in a text file.
71. Append text to an existing file.
72. Copy contents of one file into another.
73. Serialize and deserialize an object.
74. Handle NullPointerException gracefully.
75. Handle multiple exceptions in one block.
Level 7 (Collections Framework) [7/10]
--------------------------------------
76. Store names in an ArrayList and sort them alphabetically.
77. Remove duplicates from a list using HashSet.
78. Find frequency of words in a sentence using HashMap.
79. Implement a simple phone book using HashMap.
80. Sort HashMap by values.
81. Use TreeMap to store and print sorted key-value pairs.
82. Demonstrate use of Iterator to traverse an ArrayList.
83. Use LinkedHashMap to preserve insertion order.
84. Implement a priority queue (min-heap) using PriorityQueue.
85. Demonstrate Stack operations (push, pop, peek).
Level 8 (Multithreading & Concurrency) [8/10]
---------------------------------------------
86. Create a thread by extending Thread class.
87. Create a thread by implementing Runnable.
88. Print even and odd numbers using two threads.
89. Simulate producer-consumer problem using wait() and notify().
90. Demonstrate deadlock situation with two threads.
91. Use ExecutorService to run multiple tasks.
92. Use Callable and Future to return value from thread.
93. Synchronize a method to prevent race conditions.
94. Demonstrate thread priorities.
95. Use ReentrantLock for explicit locking.
Level 9 (Java 8 Features & Streams) [9/10]
------------------------------------------
96. Use lambda expression to sort a list of strings by length.
97. Filter even numbers from a list using Streams.
98. Map a list of names to uppercase using Streams.
99. Count frequency of characters in a string using Streams.
100. Find average of numbers using Streams.
101. Flatten a list of lists using flatMap().
102. Use Optional to avoid NullPointerException.
103. Group employees by department using [Link]().
104. Find max salary from employee list using Streams.
105. Parallelize a stream to process faster.
Level 10 (Advanced Java & Design Patterns) [10/10]
--------------------------------------------------
106. Implement Singleton design pattern for a Logger.
107. Implement Factory design pattern for Shape creation.
108. Implement Observer pattern (e.g., Weather updates).
109. Use Reflection API to print methods of a class.
110. Connect to a database using JDBC and fetch rows.
111. Insert data into database using JDBC.
112. Implement Builder pattern for creating complex objects.
113. Create a socket program (client-server chat).
114. Implement Decorator pattern (coffee shop example).
115. Demonstrate Dependency Injection using constructors.

You might also like