A.
Questions based on Decision-Making, Iteration, Method
1. Write a java program to entered and check a number is Prime or Composite
2. Write a java program to entered and check a number is Armstrong or Not
3. Write a java program to entered and check a number is Palindrome or Not
4. Write a java program to entered a number and find its binary,octal, hexa-decimal values.
5. Write a java program to enter an email and count alphabets, numbers, symbols in it
6. Write a java program to entered and check a number is a Lucky number or Not
7. Write a java program to entered and check a number is a Spy number or Not
8. Write a java program to entered and check a number is an Evil number or Not
9. Write a java program to entered and check a number is a Duck number or Not
10. Write a java program to entered and check a number is an Automorphic number or Not
11. Write a java program to entered and check a number is a Mistery number or Not
12. Write a java program to entered and check a number is a Catalan number or Not
13. Write a java program to entered and check a number is a Happy number or Not
14. Write a java program to entered and check a number is a Buzz number or Not
15. Write a java program to entered and check a number is a Sublime number or Not
16.
B. Question Based on String:
1. Write a program to check whether the given string is Anagram or not
2. Write a program to check whether the given string is Pangram or not
3. Write a program to count the distinct characters in a string.
4. Write a program to check whether a given substring exists in a main string or not
5. Write a program to check whether the given string endswith 'ed' or 'ing' suffix.
C. Questions Based on Exception Handling
1. Write a Java program to create a method that takes an integer as a parameter and
throws an exception if the number is a multiple of both 5 and 7,otherwise not
2. Write a Java program that reads a list of integers from the user and throws an exception
if any numbers are duplicates.
D. Questions Based on Multi-Threading:
1)Write a program using thread to print all multiples of 3 between 1 to 100..
2)Write a Java program that demonstrates the basic concept of exception handling. Perform the
following steps:
• Create a method divideNumbers(int numerator, int denominator) that takes two integer
parameters: numerator and denominator.
• Inside the method, attempt to divide the numerator by the denominator.
• Use a try-catch block to handle any potential arithmetic exception that may occur (e.g.,
division by zero).
• If an exception occurs, print an appropriate error message.
• Test your method by calling it with different values and observe the output
• Input must be given using Command Line Argument.
3)Extend the previous program to handle multiple types of exceptions. Perform the following steps:
• Modify the divideNumbers method to also handle NumberFormatException as well as
ArrayIndexOutOfBoundsException
• Handle all Exceptions separately using multiple catch blocks.
• Print appropriate error messages for each type of exception.
• Test your method with different inputs to ensure all exceptions are handled correctly.
4)Write a Java program that demonstrates synchronization between multiple threads. Perform the
following steps:
• Create a counter variable(shared resource) that will be accessed by multiple threads.
• Define a method to increment the counter value.
• Create multiple threads that simultaneously attempt to increment the counter.
• Use synchronization to ensure that only one thread can increment the counter at a time.
• Print the updated counter value after each increment operation.