Given the following code snippet: `class A { public void methodA() throws Exception { System.out.println("A"); } } class B extends A { public void methodA() { System.out.println("B"); } } public class Main { public static void main(String[] args) { A a = new B(); try { a.methodA(); } catch (Exception e) { System.out.println("Exception"); } } }`. What will be the output?
Question 2
2 / 10
Which of the following statements is true regarding the Java Memory Model (JMM)?
Question 3
3 / 10
Consider the following code snippet: `Integer i1 = 100; Integer i2 = 100; Integer i3 = 200; Integer i4 = 200; System.out.println(i1 == i2); System.out.println(i3 == i4);`. What will be the output?
Question 4
4 / 10
Which of the following is the most accurate description of the difference between `HashMap` and `ConcurrentHashMap`?
Question 5
5 / 10
What is the primary purpose of the `volatile` keyword in Java?
Question 6
6 / 10
Which of the following statements correctly describes the difference between Checked and Unchecked Exceptions in Java?
Question 7
7 / 10
What is the output of the following code snippet: `String s1 = "abc"; String s2 = new String("abc"); System.out.println(s1 == s2); System.out.println(s1.equals(s2));`?
Question 8
8 / 10
Which of the following is the correct way to implement a thread-safe counter using `AtomicInteger` in Java?
Question 9
9 / 10
What is the purpose of the `transient` keyword in Java?
Question 10
10 / 10
Given the following code: `interface I1 { default void method() { System.out.println("I1"); } } interface I2 { default void method() { System.out.println("I2"); } } class MyClass implements I1, I2 { public void method() { I1.super.method(); } } public class Main { public static void main(String[] args) { new MyClass().method(); } }`. What will be printed?
Total Questions
10
Answered
Marked
Not Visited
Instructions:
Navigation between questions is allowed.
Your answers are auto-saved instantly.