Books
Learn HTML
Learn CSS
Learn Git
Learn Javascript
Learn PHP
Learn python
Learn Java
Exercises
HTML
JavaScript
Git
CSS
PHP
Courses
Quizzes
Snippets
Tools
General Tools
Password Generator
HTML Editor
HTML Encoder
Base 64
Code Diff
JSON Beautifier
CSS Beautifier
Markdown Convertor
Find the Closest Tailwind CSS Color
Phrase encrypt / decrypt
Browser Feature Detection
Number convertor
CSS Maker
CSS Maker
CSS Maker text shadow
CSS Maker Text Rotation
CSS Maker Out Line
CSS Maker RGB Shadow
CSS Maker Transform
CSS Maker Font Face
Color Tools
Color Picker
Colors CMYK
Colors HWB
Colors HSL
Color Hex
Color mixer
Color Converter
Colors RGB
Color Contrast Analyzer
Color Gradient
String Tools
String Length Calculator
MD5 Hash Generator
Sha256 Hash Generator
String Reverse
URL Encoder
URL Decoder
Base 64 Encoder
Base 64 Decoder
Extra Spaces Remover
String to Lowercase
String to Uppercase
Word Count Calculator
Empty Lines Remover
HTML Tags Remover
Binary to Hex
Hex to Binary
Rot13 Transform on a String
String to Binary
Duplicate Lines Remover
Change theme
Dark
Light
System
Books
Learn HTML
Learn CSS
Learn Git
Learn Javascript
Learn PHP
Learn python
Learn Java
How To
How To NodeJs
How To Linux
How To AngularJs
How To PHP
How To HTML
How To CSS
How To Symfony
How To Git
How To Apache
How To JavaScript
How To Java
How To Vue.js
How To Python
Java Basics
1/25
Which interface in Java is used for sorting and ordering?
List
Set
Comparable
Comparator
Next >
2/25
Which of the following is true about a 'final' class in Java?
It can be extended by other classes
It cannot be instantiated
It can have final methods only
It cannot be extended by other classes
Next >
3/25
What is the significance of the 'main' method in a Java application?
It's the method that runs when a class is instantiated
It's used to define variables
It's the entry point of a Java application
It's used to clean up resources before exiting the application
Next >
4/25
What is the function of the 'extends' keyword in Java?
To inherit methods from an interface
To extend a method's functionality
To inherit properties and methods from a superclass
To extend the memory allocation for an object
Next >
5/25
In Java, what is the difference between '==' and 'equals()'?
'==' checks for value equality, 'equals()' checks for reference equality
'==' checks for reference equality, 'equals()' checks for value equality
There is no difference
'equals()' is used only for strings
Next >
6/25
What does the 'abstract' keyword signify in a Java class?
The class can't be instantiated directly
The class is fully implemented
The class is optimized for performance
The class can be instantiated multiple times
Next >
7/25
How do you declare a constant variable in Java?
Using the 'constant' keyword
Using the 'static final' keywords
Using the 'immutable' keyword
Declaring without initialization
Next >
8/25
In Java, what is the purpose of the Collections.sort() method?
To sort elements of a collection in descending order
To randomly shuffle elements of a collection
To sort elements of a collection in ascending order
To reverse the order of elements in a collection
Next >
9/25
Which of the following is a checked exception in Java?
NullPointerException
ArrayIndexOutOfBoundsException
IOException
RuntimeException
Next >
10/25
Which collection interface represents a key-value pair in Java?
List
Set
Map
Queue
Next >
11/25
What does the 'synchronized' keyword ensure in a multi-threaded environment?
Faster execution of threads
That only a single thread can access the method or block at a time
That multiple threads can execute the method concurrently
That the method will always be executed by the main thread
Next >
12/25
What is the primary difference between 'StringBuffer' and 'StringBuilder' in Java?
StringBuffer is mutable, while StringBuilder is immutable
StringBuilder is faster as it is not synchronized
StringBuffer can store characters, while StringBuilder cannot
StringBuilder is thread-safe, while StringBuffer is not
Next >
13/25
In Java, which method you must override to use an object as a key in a HashMap?
hashKey()
mapKey()
equals() and hashCode()
getKey()
Next >
14/25
How do you create a thread-safe singleton in Java?
Using double-checked locking
By making all methods synchronized
By declaring all variables as volatile
By using a static class
Next >
15/25
What is the difference between 'static' and 'non-static' methods in Java?
Static methods can be called without creating an instance of the class
Non-static methods are always synchronized
Static methods are faster
Non-static methods can access any class variable
Next >
16/25
In Java, what is 'reflection' used for?
To modify the behavior of a program at runtime
To duplicate objects
To analyze the performance of applications
To convert primitive types into objects
Next >
17/25
Which method in the Object class is used to obtain a unique hash code for the object?
uniqueCode()
hashCode()
identityHashCode()
getObjectHash()
Next >
18/25
How can you achieve thread safety in Java?
By using synchronized blocks or methods
By avoiding the use of multiple threads
By using the 'volatile' keyword
By making all methods and variables private
Next >
19/25
In Java, what does the 'transient' keyword do when applied to a class field?
Makes the field non-serializable
Marks the field as temporary and not part of the class's persistent state
Indicates that the field value can change rapidly
Makes the field volatile
Next >
20/25
What is the use of the 'implements' keyword in Java?
To inherit from an abstract class
To include an interface in a class
To mark a method as mandatory to override
To declare a class as abstract
Next >
21/25
In Java, what is the function of the 'super' keyword?
To call a method of the superclass
To declare superior variables
To access the superclass's static methods
To create an object of the superclass
Next >
22/25
What is 'polymorphism' in the context of Java?
The ability of a variable to hold objects of different types
The ability of Java to run on different platforms without modification
The ability of a method to perform different tasks based on the object
Changing the behavior of an object at runtime
Next >
23/25
In Java, which method would you use to compare two String objects for content equality?
compareTo()
equals()
match()
equalContent()
Next >
24/25
In Java, what is the default value of a boolean variable in a class?
true
false
null
0
Next >
25/25
What does the 'static' keyword signify when applied to a block of code in Java?
The code block is related to the static members of the class
The code block cannot be modified
The code block is executed when the JVM loads the class
The code block is executed immediately after the class is instantiated
Next >
To get the result of the quiz, please provide your email address (optional)..
Get Certificate
It seems you haven't answered any questions yet. Please provide your answers to proceed.