Test
java test 1
By Tamilarasi.R · java · Professional development · Published Nov 3, 2026 · New
java test 1
26 questions · 68 points
Question 1 · One correct answer · 1 point
1Which component is responsible for executing Java bytecode?- A. a) JDK
- B. b) JVM
- C. c) JRE
- D. d) JAR
Question 2 · One correct answer · 1 point
- Which data type is used to store a single character?
- A. a) String
- B. b) int
- C. c) char
- D. d) boolean
Question 3 · One correct answer · 1 point
3.Which operator is used to check whether two conditions are true?- A. a) ||
- B. b) &&
- C. c) !
- D. d) =
Question 4 · One correct answer · 1 point
4.Which statement is used to make decisions in Java?- A. a) for
- B. b) while
- C. c) if
- D. d) break
Question 5 · One correct answer · 1 point
5.Which loop executes at least once?- A. a) for
- B. b) while
- C. c) do-while
- D. d) enhanced for
Question 6 · One correct answer · 1 point
- What is the index of the first element in a Java array?
- A. a) 1
- B. b) 0
- C. c) -1
- D. d) 2
Question 7 · One correct answer · 1 point
- Which keyword is used to terminate a loop?
- A. a) continue
- B. b) return
- C. c) break
- D. d) exit
Question 8 · One correct answer · 1 point
- Which statement is used to skip the current iteration?
- A. a) break
- B. b) continue
- C. c) return
- D. d) switch
Question 9 · One correct answer · 1 point
- How many indexes are required to access an element in a 2D array?
- A. a) One
- B. b) Two
- C. c) Three
- D. d) Four
Question 10 · One correct answer · 1 point
- Which property is used to find the length of an array?
- A. a) size()
- B. b) length()
- C. c) length
- D. d) count()
Question 11 · Short answer · 2 points
- What is the difference between JDK, JRE and JVM?
Your answer:
Question 12 · Short answer · 2 points
- Differentiate between while and do-while loops.
Your answer:
Question 13 · Short answer · 2 points
- What is the difference between break and continue?
Your answer:
Question 14 · Short answer · 2 points
- What is a two-dimensional array? Give an example.
Your answer:
Question 15 · Short answer · 2 points
- Predict the Output
int a = 10;
int b = 5;
System.out.println(a + b);
System.out.println(a * b);
Your answer:
Question 16 · Short answer · 2 points
- Predict the Output
int age = 16;
if (age >= 18) {
System.out.println("Eligible");
} else {
System.out.println("Not Eligible");
}
Your answer:
Question 17 · Short answer · 2 points
- Predict the Output
for (int i = 1; i <= 5; i++) {
System.out.println(i);
}
Your answer:
Question 18 · Short answer · 2 points
- Predict the Output
int i = 1;
while (i <= 3) {
System.out.println(i);
i++;
}
Your answer:
Question 19 · Short answer · 2 points
- Predict the Output
int[] numbers = {10, 20, 30, 40};
System.out.println(numbers[2]);
System.out.println(numbers.length);
Your answer:
Question 20 · Short answer · 4 points
- Find the Error
for (int i = 1; i >= 5; i++) {
System.out.println(i);
}
Your answer:
Question 21 · Short answer · 4 points
- Find the Error
int[] numbers = {10, 20, 30};
System.out.println(numbers[3]);
Your answer:
Question 22 · One correct answer · 3 points
- 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");
}
}
}
- A. Even Number
- B. Odd Number
Question 23 · Short answer · 3 points
- 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); } }}
Your answer:
Question 24 · Short answer · 3 points
- 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);
}
}
}
Your answer:
Question 25 · Short answer · 3 points
- 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();
}
}
}
Your answer:
Question 26 · Short answer · 20 points
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.
Your answer:
How it works with your class
- 1. Copy it to your accountOne click. Change anything you want.
- 2. Share a link or codeStudents open it on any device, no accounts needed.
- 3. See the resultsScores and every answer, checked for you.
More like this
Test
MATHEMATICS EXAM SS 3
All grades · New · Nov 24, 2026
Test
MATHEMATICS EXAM SS 1
All grades · New · Nov 24, 2026
Test
BASIC PHYTON
Coding · Grade 7 – Grade 9 · New · Nov 3, 2026
Test
Basic Math ( +, - , x , / )
Mathematics · Grade 7 · New · Nov 22, 2026
Test
Test
All grades · New · Nov 10, 2026
Quiz
Numbers
Mathematics · Grade 1 · Used 1 time · Oct 27, 2026