Skip to content
J2J Institute
Search
K
Main Navigation
Home
Jobs
Code here
Courses
Java
Core
Advanced
Python
SQL
PowerBI
Testing
Manual
Automation
Interview Questions
Java
Python
SQL
Manual
Automation
Quiz
Java
Python
SQL
Appearance
Menu
Return to top
On this page
Intermediate level java quiz
Which of the following statements about interfaces in Java is true?
An interface can extend multiple classes
An interface can extend multiple other interfaces
An interface can implement multiple classes
An interface can be instantiated directly
Which of the following is true about the `this` keyword in Java?
It refers to the current class instance
It refers to the current method
It refers to the superclass
It refers to the class itself
What will be the result of the following code? int[] arr = {1, 2, 3}; System.out.println(arr[3]);
1
2
3
ArrayIndexOutOfBoundsException
Which of the following is the correct way to handle multiple exceptions in a single `catch` block in Java 7 or later?
catch (IOException | SQLException e) {}
catch (IOException & SQLException e) {}
catch (IOException, SQLException e) {}
catch (IOException, SQLException | NullPointerException e) {}
Which of the following collection types is used to store key-value pairs in Java?
List
Set
Map
Queue
What is the purpose of the `clone()` method in Java?
To copy a class definition
To create a new instance of a class
To create a copy of an object
To make a class immutable
Which of the following statements about the `synchronized` keyword is true in Java?
It is used to lock a method or block of code for thread safety
It is used to make a method execute in parallel
It is used to execute multiple methods concurrently
It is used to synchronize data in a database
What is the output of the following code? String str = "Java"; str = str.concat(" Programming"); System.out.println(str);
Java Programming
JavaProgramming
Compilation error
Runtime exception
Which of the following is used to define a custom exception in Java?
Extend the `Exception` class
Implement the `Throwable` interface
Use the `CustomException` class
Extend the `RuntimeException` class
Which of the following is true about Java's `HashMap`?
It maintains the order of elements based on their keys
It allows duplicate keys
It allows duplicate values
It is synchronized
Submit