Home > Java Programming > Quizzes > Java Basics Practice Test: Java 8 Features, Hibernate, & Liskovs Principle
Java Basics Practice Test: Java 8 Features, Hibernate, & Liskovs Principle
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 0% Most missed: “What will be the output of the following Java code?”
Java 8 is a major release of the Java programming language that was released in March 2014.  Hibernate is an object-relational mapping (ORM) library that allows you to map Java objects to relational database tables. It is one of the most popular ORM libraries for Java, and it is used in a wide variety of applications. The Liskov Substitution Principle (LSP) is a principle of object-oriented programming that states that objects in a program should be replaceable with instances of their subtypes without altering the correctness of the program. Relationship between Java 8 features, Hibernate,... Show more
Java Basics Practice Test: Java 8 Features, Hibernate, & Liskovs Principle
Time left 00:00
25 Questions

1. What will be the output of the following Java code snippet?
public class Shape
{
public int area()
{
return 1;
}
}
public class Square extends Shape
{
public int area()
{
return 2;
}
}
class Main()
{
public static void main(String[] args)
{
Shape shape = new Shape();
Square square = new Square();
shape = square;
System.out.println(shape.area());
}
}
2. What does SAM stand for in the context of Functional Interface?
3. Which is the new method introduced in java 8 to iterate over a collection?
4. Which of the following is not a core interface of Hibernate?
5. SessionFactory is a thread-safe object.
6. What does Files.lines(Path path) do?
7. In which file database table configuration is stored?
8. What does Liskov substitution principle specify?
9. What will be the output of the following Java code?
public class Shape
{
public int area()
{
return 1;
}
}
public class Square extends Shape
{
public int area()
{
return 2;
}
}
public class Rectangle extends Shape
{
public int area()
{
return 3;
}
}
public static void main(String[] args)
{
Shape square = new Square();
Shape rect = new Rectangle();
square = rect;
System.out.println(square.area());
}
10. Which of the following methods hits database always?
11. Which of the following method is used inside session only?
12. What will be the output of the following Java code?
public class Shape
{
public int area()
{
return 1;
}
}
public class Square extends Shape
{
public int area()
{
return 2;
}
}
class Main()
{
public static void main(String[] args)
{
Shape shape = new Shape();
Square square = new Square();
square = shape;
System.out.println(square.area());
}
}
13. What will be the correct option of the following Java code snippet?
interface ICust
{
}
class RegularCustomer implements ICust
{
}
class OneTimeCustomer implements ICust
{
}
14. What is the purpose of BooleanSupplier function interface?
15. What are the two types of Streams offered by java 8?
16. Which of the following is not an advantage of Hibernate Criteria API?
17. What will be the output of the following Java code snippet?
public class Shape
{
public int area()
{
return 1;
}
}
public class Rectangle extends Shape
{
public int area()
{
return 3;
}
}
class Main()
{
public static void main(String[] args)
{
Shape shape = new Shape();
Rectangle rect = new Rectangle();
shape = rect;
System.out.println(shape.area());
}
}
18. What is the substitute of Rhino javascript engine in Java 8?
19. What is Optional object used for?
20. Which of the following is not an advantage of using Hibernate Query Language?
21. What will be the output of the following Java code?
public class Shape
{
public int area()
{
return 1;
}
}
public class Square extends Shape
{
public int area()
{
return 2;
}
}
public class Rectangle extends Shape
{
public int area()
{
return 3;
}
}
public static void main(String[] args)
{
Shape shape = new Square();
shape = new Rectangle();
System.out.println(shape.area());
}
22. Which of the following is not introduced with Java 8?
23. Which of the following is not a state of object in Hibernate?
24. Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?
25. Which of the following methods returns proxy object?