java-quiz

Java, a versatile and powerful programming language, has been a cornerstone in the world of software development for decades. This quiz is designed to assess your grasp of Java’s fundamental principles, syntax, and advanced features. Each question is crafted to enhance your learning experience and deepen your understanding of Java. Ready to put your Java skills to the test? Let’s get started!
We recommend that you do not leave the page that you are taking this quiz in. Stay honest 🙂
Java Quiz
0% Complete
1 of 10
1. What is the default value of a boolean variable in Java?
This question tests your knowledge of default values in Java.

Java Quiz Questions Overview

1. What is the default value of a boolean variable in Java?

true
false
0
null

2. Which of the following is not a Java keyword?

static
Boolean
void
private

3. Which method is used to start a thread execution in Java?

init()
start()
run()
resume()

4. What is the size of an int variable in Java?

4 bytes
8 bytes
2 bytes
1 byte

5. Which of the following is a marker interface?

Runnable
Serializable
Comparator
Cloneable

6. Which of these cannot be used for a variable name in Java?

identifier
keyword
variable
constant

7. Which statement is used to stop a loop in Java?

exit
break
stop
end

8. Which of the following is a valid declaration of a package in Java?

package mypackage;
package: mypackage;
pkg mypackage;
package = mypackage;

9. Which exception is thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted?

InterruptedException
IOException
ThreadException
RuntimeException

10. Which method must be implemented by all threads in Java?

start()
stop()
run()
main()
We recommend that you do not leave the page that you are taking this quiz in. Stay honest 🙂
We have chosen the next challenge for you. Take the next test:

Can Your Friends Do Better Than You in This Quiz?

Share this quiz with your friends and compare results.

Was this page helpful?