Java Question Bank (25 Questions)
1. Given a string `Mysore`, remove all vowels and print the resultant string.
2. Calculate the ASCII value of each character in a string, find the sum, and print if the sum
is divisible by both 4 and 5; otherwise, print "NA".
3. Write a program to reverse the string `Bangalore` without using built-in functions.
4. Check if the given string `Java` is a palindrome (ignore case).
5. Count the number of vowels and consonants in the string `Technology`.
6. Find the first non-repeating character in the string `developer`.
7. Replace every occurrence of `a` in the string `Karnataka` with `@` and print the result.
8. Convert the string `learning` into uppercase and reverse the result.
9. Write a method to check if two strings are anagrams. For example, `listen` and `silent`.
10. Extract all digits from the string `abc123xyz456` and return their sum.
11. Find the most frequent character in the string `management`. If there’s a tie, return the
smallest lexicographically.
12. Write a program to remove all duplicate characters from the string `Mississippi`.
13. Check if the string `Programming` contains only unique characters.
14. From the string `hello123world456`, extract numbers, concatenate them, and find their
sum (`123 + 456`).
15. Reverse the words in the sentence `Hello World from Java` to produce `Java from World
Hello`.
16. Find the length of the longest substring in `abcabcbb` that has no repeating characters.
17. Check if the string `abcd1234` is alphanumeric.
18. Replace spaces in the string `open ai chat` with underscores (`_`) to produce
`open_ai_chat`.
19. Write a program to count the occurrence of each character in the string `statistics`.
20. Write a function to toggle the case of each character in `AbCdeF` (e.g., convert to
`aBcDEf`).
21. Find the lexicographically smallest and largest substring of length 3 in the string
`welcometojava`.
22. Write a method to check if a string `Abcdef` starts with a vowel and ends with a
consonant.
23. From the string `level12345`, separate letters and numbers into two different strings and
print them.
24. Find all substrings of the string `abc` and print them.
25. Given a string `HelloWorld`, shift all characters by 2 positions in the ASCII table (e.g., `H`
becomes `J`).