iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.1Medium

Which of the following is NOT a primitive data type in Java?

Q.2Medium

What is the size of 'char' data type in Java?

Q.3Medium

Which of the following will compile without error? public static void main(String args[]) { int x = 10; final int y = 20; y = 30; }

Q.4Medium

What is the output of: System.out.println();

Q.5Medium

Which operator has the highest precedence in Java?

Q.6Medium

What is the output of: System.out.println(5 > 3 ? 'A' : 'B');

Q.7Medium

Which statement is correct about Java variables?

Q.8Medium

Identify the output: System.out.println("Java".length());

Q.9Medium

Which of the following is the correct way to declare and initialize an array in Java?

Q.10Medium

What will be the output: System.out.println('A' + 'B');

Q.11Medium

What is the output of: int x = 5; System.out.println(++x + x++);

Q.12Medium

Which of the following correctly represents a long literal in Java?

Q.13Medium

What is the result of: System.out.println(true && false || true);

Q.14Medium

Which of the following statements will compile successfully?

Q.15Medium

What is the output of: System.out.println(10 * * 2);

Q.16Medium

What is the output of: System.out.println("5" + 3 + 2);

Q.17Medium

Which of the following correctly initializes a 2D array in Java?

Q.18Medium

What will be the output: int a = 10; int b = 20; System.out.println(a > b ? "A" : "B");

Q.19Medium

What is the output of: double d = 5.7; int i = (int) d; System.out.println(i);

Q.20Medium

Which statement about Java's 'this' keyword is correct?