Java Quiz

Java Quiz

1 / 20

What is the main method signature in Java?

2 / 20

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

3 / 20

What is the size of an int variable in Java?

4 / 20

Which keyword is used to create a subclass in Java?

5 / 20

What is the output of the following code?

int x = 5;System.out.println(++x);

click on Extem for view full code

6 / 20

Which method is used to compare two strings for equality in Java?

7 / 20

Which of these is a checked exception?

8 / 20

What is the purpose of the final keyword in Java?

9 / 20

How do you declare an array in Java?

10 / 20

What is the output of the following code?

String str = "Hello";str.concat(" World");System.out.println(str);

click on Extem for view full code

11 / 20

What is the difference between StringBuilder and StringBuffer in Java?

12 / 20

Which of these statements is correct about Java 8 Stream API?

13 / 20

What is the use of the Optional class in Java?

14 / 20

How do you make a class immutable in Java?

15 / 20

What is the output of the following code?

int a = 10;int b = 20;int c = 30;a = b = c;System.out.println(a + " " + b + " " + c);

click on Extem for view full code

16 / 20

Which of the following is a valid functional interface in Java?

17 / 20

What is the significance of the @FunctionalInterface annotation?

18 / 20

Which feature of Java allows the use of methods that are not determined until runtime?

19 / 20

What is the difference between Callable and Runnable?

20 / 20

What is the purpose of the volatile keyword in Java?

Your score is

The average score is 60%

0%

Scroll to Top