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.21Easy

Which of the following is a valid method name in Java?

Q.22Easy

Which keyword is used to create a constant variable in Java that cannot be modified after initialization?

Q.23Easy

What will be the result of: int a = 10; int b = 20; System.out.println(a + b + "Java");?

Q.24Easy

Consider the following code: int x = 5; x += 3; System.out.println(x); What is the output?

Q.25Easy

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

Q.26Easy

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

Q.27Easy

Which of the following is true about the 'break' statement?

Q.28Easy

Which of the following is NOT a Java keyword?

Q.29Easy

What is the output of: System.out.println(5 > 3 ? "Yes" : "No");?

Q.30Easy

Consider the following code snippet. What is the primary purpose of the 'final' keyword when applied to a class in Java?

Q.31Easy

Which of the following statements about Java's garbage collection is TRUE?

Q.32Easy

What will happen when you execute the following code? int[] arr = new int[5]; System.out.println(arr[5]);

Q.33Easy

Consider the following code. What will be printed? String s = "Java"; s = s.concat(" Programming"); System.out.println(s.length());

Q.34Easy

Which of the following is a valid declaration of a two-dimensional array in Java that can store 3 rows and 4 columns of integers?

Q.35Easy

Which of the following is NOT a pillar of Object-Oriented Programming?

Q.36Easy

Which access modifier allows a member to be accessed only within the same package?

Q.37Easy

What will be the output? class Parent { void show() { System.out.println("Parent"); } } class Child extends Parent { void show() { System.out.println("Child"); } } parent obj = new Child(); obj.show();

Q.38Easy

What is the purpose of the 'super' keyword in Java?

Q.39Easy

Which interface in Java represents a collection that does not allow duplicate elements?

Q.40Easy

Which of the following correctly describes the 'this' keyword?