Welcome to our Java Quiz! If you’re looking to test your knowledge of Java, one of the most popular programming languages in the world, you’ve come to the right place. Our quiz covers a wide range of topics, from Java basics to advanced features, libraries, and frameworks. Whether you’re a beginner or an experienced Java developer, our quiz will challenge you and help you hone your skills. Plus, taking our quiz is a great way to prepare for job interviews or certification exams. So, get ready to put your Java knowledge to the test and see how well you do!

77

Java Quiz

Test your knowledge of Java, one of the most popular programming languages in the world, with our comprehensive Java Quiz.

1 / 30

What is the purpose of implementing keywords?

2 / 30

Which of the code will print output 10?

3 / 30

What will be the output of the code below? public class Main {
public static void main(String[] args) {
final int myNumber = 30;
myNumber = 28;
System.out.println(myNumber);
}
}

4 / 30

What is the function of mkdir () method?

5 / 30

Which of these are enum constants?

6 / 30

Which package allows us to work with files?

7 / 30

What will be the output of the code below? public class Main {
public static void main(String[] args) {
String r = “21”;
int s = 11;
String t = r + s;
System.out.println(t);
}
}

8 / 30

Java HashSet can be used for

9 / 30

What will be the output of the code below? public class Main {
public static void main(String[] args) {
int x = 9;
int y = 2;
System.out.println(x == y);
}
}

10 / 30

What is another word for iterator?

11 / 30

What will be the output of the below code? public class Main {
public static void main(String[] args) {
int m = 7;
int n = 3;
System.out.println(m % n);
}
}

12 / 30

What is the function of this “s” meta character in java?

13 / 30

What will be the output of the below code?
public class Main {
public static void main(String[] args) {
long myNumber = 180000000L;
System.out.println(myNumber);
}
}

14 / 30

How can we import regular expressions in java?

15 / 30

In the code below, in which part is the constructor created? public class Main {
int p;
public Main() {
p = 29;
}
public static void main(String[] args) {
Main myObj = new Main();
System.out.println(myObj.p);
}
}

16 / 30

Why Alive() method is used?

17 / 30

What will be the output of the following code? public class Main {
static int myMethod(int p) {
return 10 + p;
}

public static void main(String[] args) {
System.out.println(myMethod(7));
}
}

18 / 30

A java threads

19 / 30

The below code is an example of? public class Main {
public static void main(String[] args) {
int result = sum(10);
System.out.println(result);
}
public static int sum(int k) {
if (k > 0) {
return k + sum(k – 1);
} else {
return 0;
}
}
}

20 / 30

A ________ is a block of code that takes in a parameter and returns a value and is similar to methods.

21 / 30

Which of the following code will print output as “I live in London”?

22 / 30

Which of the following are types of casting in java?

23 / 30

What will be the output of below code? public class Main {
public static void main(String[] args) {
String[] fruits = {“mango”, “apple”, “banana”, “watermelon”};
fruits[0] = “kiwi”;
System.out.println(fruits[0]);
}
}

24 / 30

What are examples of primitive data types?

25 / 30

What will be the output of following code? public class Main {
public static void main(String[] args) {
for (int i = 0; i < 7; i++) { if (i == 3) { continue; } System.out.println(i); } } }

26 / 30

What will be the output of following code? public class Main {
public static void main(String[] args) {
String txt = “My name is Julie”;
System.out.println(“The length of the string is: ” + txt.length());
}
}

27 / 30

What is the correct naming of variables in java?

28 / 30

The below code is an example of? public class Main {
public static void main(String[] args) {
int myInt = 7;
double myDouble = myInt;

System.out.println(myInt);
System.out.println(myDouble);
}
}

29 / 30

Which of the following code will print output as “John Doe”?

30 / 30

Java is programming language in which every line of code must be inside a ___________.

Author

  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.


Comments

2 responses to “Java Quiz”

  1. The quiz is not worth your time. Questions are not clear, and sometimes there are 2 possible answers (but only 1 is correct).
    In case of question about creating Threads- answer “It can be created by overriding run() method” is marked as correct. I don’t know if the translation or my understanting failed – but overriding run() method is not enough to create a new thread!

    1. Barry Allen Avatar
      Barry Allen

      Hi Andy,
      Thanks for your feedback, we will improve the questions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.