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.61Medium

Which of the following is a feature of Java 8 that allows functional programming?

Q.62Hard

What will be the output? class Test { public static void main(String[] args) { int x = 10; { int x = 20; System.out.println(x); } System.out.println(x); } }

Q.63Hard

Which of the following will throw a NullPointerException? String s = null; System.out.println(s.length());

Q.64Hard

Consider: class Parent { Parent() { System.out.println("P"); } } class Child extends Parent { Child() { System.out.println("C"); } } public static void main(String[] args) { new Child(); }

Q.65Hard

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

Q.66Easy

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

Q.67Easy

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

Q.68Medium

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

Q.69Easy

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

Q.70Medium

Which of the following correctly demonstrates method overloading?

Q.71Easy

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

Q.72Medium

Which of the following statements about static methods is correct?

Q.73Medium

What will happen if you try to access an index out of bounds in an array?

Q.74Medium

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

Q.75Easy

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

Q.76Easy

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

Q.77Medium

What is the difference between 'break' and 'continue' in loop statements?

Q.78Medium

Which statement about constructors is INCORRECT?

Q.79Hard

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

Q.80Medium

Which of the following correctly represents variable declaration and initialization in Java?