72Laboratories

Basic Programming Questions

  1. Write a Java Program to find the biggest number among two numbers (Using if Statement).
  2. Find the biggest Number among three numbers (Using if Statement).
  3. Check the given number is even or odd without using modulo Operator.
  4. Check the given year is leap year or not.
  5. Write a Java program to print “Saju” if the given number is divisible by 3, “Geta” if divisible by 5, or “Saju Geta” if divisible by both 3 and 5, otherwise print “Breakup”.
  6. Write a Java program to find the smallest number among three numbers (Using if-else ladder).
  7. Write a Java program to find the biggest number among two numbers using the ternary operator.
  8. Write a Java program to find the smallest number among three numbers using the ternary operator.
  9. A customer has a bank account with a balance of 10000. Write a program to withdraw an amount from the account. The withdrawal should be successful if the balance is sufficient; otherwise, it should fail. If successful, show the remaining balance.
  10. Write a Java program to print all the even numbers present between 1 to 20.
  11. Write a Java program to print the factorial of a given number.
  12. Write a Java program to check if a user-entered number is a perfect number or not.
  13. Write a Java program to count how many digits are 0 in a user-entered number.
  14. Write a Java program to print the sum of each digit in a user-entered number.
  15. Write a Java program to print the product of each digit in a user-entered number.
  16. Write a Java program to check if a given number is a palindrome or not.
  17. Write a Java program to check if a given number is a Neon number or not.
  18. Write a Java program to find npnp (power of a number).
  19. Write a Java program to check if a given number is prime or not.
  20. Write a Java program to print all the prime numbers between 1 to 100.
  21. Write a Java program to print the sum of all prime numbers between 1 to 15.
  22. Write a Java program to print even/odd using a method with a boolean return type.
  23. Write a Java program to check if a given number is prime using a method with a boolean return type.
  24. Write a Java program to check if a given number is an Armstrong number.
  25. Write a Java program to print the first N prime numbers.
  26. Write a Java program to print the nearest prime number to a given number.
  27. Write a Java program to convert a decimal value into binary.
  28. Write a Java program to convert a decimal value into octal.
  29. Write a Java program to convert a decimal value into hexadecimal.
  30. Write a Java program to swap two numbers without using a temporary variable.
  31. Write a Java program to print the Fibonacci series.
  32. Write a Java program to find the factorial of a given number using recursion.
  33. Write a Java program to count how many digits are present in a given number using recursion.

Array Questions

  1. Write a Java program to print even index elements in an array.
  2. Write a Java program to print the sum of odd elements in an array.
  3. Write a Java program to print all the prime numbers present in an array.
  4. Write a Java program to take array input from the user and print the array elements.
  5. Write a Java program to replace every element in an array by the sum of its digits.
  6. Write a Java program to find the biggest element in an array.
  7. Write a Java program to find the smallest element in an array.
  8. Write a Java program to check if the sum of the smallest and biggest elements in an array is a prime number.
  9. Write a Java program to perform a linear search in an array.
  10. Write a Java program to sort array elements in ascending order.
  11. Write a Java program to sort array elements in descending order.
  12. Write a Java program to merge two arrays into a single array.
  13. Write a Java program to print the occurrence or frequency of each element in an array.
  14. Write a Java program to print unique elements in an array.
  15. Write a Java program to print duplicate elements in an array.
  16. Write a Java program to insert an element at a specified index in an array.
  17. Write a Java program to delete an element from a specified index in an array.
  18. Write a Java program to check if array elements are in ascending order.
  19. Write a Java program to print missing elements in an array.
  20. Write a Java program to find the second smallest element in an array.
  21. Write a Java program to print how many String elements are present in an Object array.
  22. Write a Java program to print double-type elements present in an Object array.

String Questions

  1. Write a Java program to reverse a given String.
  2. Write a Java program to count how many alphabets, digits, and special characters are present in a given String.
  3. Write a Java program to print the sum of digits in a String.
  4. Write a Java program to count how many vowels and consonants are present in a given String.
  5. Write a Java program to convert uppercase characters to lowercase and vice versa in a String.
  6. Write a Java program to count the number of words in a String.
  7. Write a Java program to convert the first character of each word to uppercase and the remaining characters to lowercase.
  8. Write a Java program to swap the first and last characters of each word in a String.
  9. Write a Java program to sort the characters in a String in ascending order.
  10. Write a Java program to find the occurrence or frequency of each character in a String.
  11. Write a Java program to print duplicate characters in a String.
  12. Write a Java program to print unique characters in a String.
  13. Write a Java program to check if two Strings are anagrams.
  14. Write a Java program to check if a String is a pangram.
  15. Write a Java program to reverse each word in a String.
  16. Write a Java program to reverse the sentence in a String.
  17. Write a Java program to check if a String is a palindrome.
  18. Write a Java program to check if a String is unique (all characters are distinct).
  19. Write a Java program to find the longest unique substring in a String.

2D Array Questions

  1. Write a Java program to print prime elements in a 2D array.
  2. Write a Java program to print the sum of diagonal elements in a 2D array.

Loop Questions

  1. Write a Java program to print all even numbers between 1 to 20 using a do-while loop.
  2. Write a Java program to iterate over an array using a for-each loop.

Bitwise and Shift Operators Questions

  1. Explain the use of bitwise AND, OR, and XOR operators with examples.
  2. Explain the use of left shift and right shift operators with examples.

Miscellaneous Questions