Skip to content
Get started free

Test

java test 1

By Tamilarasi.R · java · Professional development · Published Nov 3, 2026 · New

A copy is added to your account. Change it however you like.

Questions

  1. 1Which component is responsible for executing Java bytecode?
  2. Which data type is used to store a single character?
  3. 3.Which operator is used to check whether two conditions are true?
  4. 4.Which statement is used to make decisions in Java?
  5. 5.Which loop executes at least once?
  6. What is the index of the first element in a Java array?
  7. Which keyword is used to terminate a loop?
  8. Which statement is used to skip the current iteration?
  9. How many indexes are required to access an element in a 2D array?
  10. Which property is used to find the length of an array?
  11. What is the difference between JDK, JRE and JVM?
  12. Differentiate between while and do-while loops.
  13. What is the difference between break and continue?
  14. What is a two-dimensional array? Give an example.
  15. Predict the Output int a = 10; int b = 5; System.out.println(a + b); System.out.println(a * b);
  16. Predict the Output int age = 16; if (age >= 18) { System.out.println("Eligible"); } else { System.out.println("Not Eligible"); }
  17. Predict the Output for (int i = 1; i <= 5; i++) { System.out.println(i); }
  18. Predict the Output int i = 1; while (i <= 3) { System.out.println(i); i++; }
  19. Predict the Output int[] numbers = {10, 20, 30, 40}; System.out.println(numbers[2]); System.out.println(numbers.length);
  20. Find the Error for (int i = 1; i >= 5; i++) { System.out.println(i); }
  21. Find the Error int[] numbers = {10, 20, 30}; System.out.println(numbers[3]);
  22. Programming Questions public class Main { public static void main(String[] args) { int number = 10; if (number % 2 == 0) { System.out.println("Even Number"); } else { System.out.println("Odd Number"); } } }
  23. Print numbers from 10 to 1. public class Main { public static void main(String[] args) { for (int i = 10; i >= 1; i--) { System.out.println(i); } }}
  24. Print five student names using enhanced for loop. public class Main { public static void main(String[] args) { String[] students = { "Anu", "Priya", "Kavi", "Ravi", "Tamil" }; for (String name : students) { System.out.println(name); } } }
  25. Create and print a 2D array. public class Main { public static void main(String[] args) { int[][] numbers = { {10, 20, 30}, {40, 50, 60} }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { System.out.print(numbers[i][j] + " "); } System.out.println(); } } }
  26. Write a Java program to: Create an integer array containing five marks. Print all five marks. Calculate and print the total. Calculate and print the average.

More like this