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?
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());
}
}
2. What is the substitute of Rhino javascript engine in Java 8?
3. What does Liskov substitution principle specify?
4. Which of the following methods hits database always?
5. What are the two types of Streams offered by java 8?
6. 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());
}
7. Which of the following is not a state of object in Hibernate?
8. Which of the following is not introduced with Java 8?
9. 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());
}
}
10. Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?
11. Which of the following is not an advantage of using Hibernate Query Language?
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;
}
}
public class Rectangle extends Shape
{
public int area()
{
return 3;
}
}
class Main()
{
public static void main(String[] args)
{
Shape shape = new Shape();
Square square = new Square();
Rectangle rect = new Rectangle();
rect = (Rectangle)square;
System.out.println(square.area());
}
}
13. Which is the new method introduced in java 8 to iterate over a collection?
14. Which of the following is not an advantage of Hibernate Criteria API?
15. 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());
}
}
16. SessionFactory is a thread-safe object.
17. What does SAM stand for in the context of Functional Interface?
18. Which of the following is not a core interface of Hibernate?
19. 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;
}
}
class Main()
{
public static void main(String[] args)
{
Shape shape = new Shape();
Square square = new Square();
Rectangle rect = new Rectangle();
rect = (Rectangle)square;
System.out.println(square.area());
}
}
20. What is the purpose of BooleanSupplier function interface?
21. Which of the following method is used inside session only?
22. What is the return type of lambda expression?
23. Which of the following is not an inheritance mapping strategies?
24. 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;
}
}
class Main()
{
public static void main(String[] args)
{
Shape shape = new Shape();
Square square = new Square();
Rectangle rect = new Rectangle();
rect = (Rectangle)shape;
System.out.println(square.area());
}
}
25. 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());
}