Java 8(Engineering > Computer Science And Engineering ) Questions and Answers
Question 1. Which of the following does not belong: If a class inherits from some other class, it should
Make use of the parent class's capabilities
Over-ride or add the minimum to accomplish the derived class' purpose
Over-ride all the methods of its parent class
Make sure the result IS-A-KIND-OF" its base class
Explanation:-
Answer: Option C. -> Over-ride all the methods of its parent class
Question 2. How many methods are there in a functional interface in Java 8?
0
1
2
3
Explanation:-
Answer: Option B. -> 1
Question 3. PermGen space has been replaced with which of these in Java 8
PermSpace
PermSpaceGen
Metaspace
MetaGenSpace
Explanation:-
Answer: Option C. -> Metaspace
Question 4. Example of functional interfaces
java.util.concurrent.Callable
java.lang.Runnable
All
None
Explanation:-
Answer: Option C. -> All
Question 5. Using which keyword we can access a value of the instance variables and class variables of that class inside the method of that class itself.
Super
Final
This
Either super or this
Explanation:-
Answer: Option C. -> This
Question 6. Which of these does Stream map() operates on
Class
Interface
Predicate
Function
Explanation:-
Answer: Option D. -> Function
Question 7. Which is aggregate operation in Java 8
filter
map
forEach
All
Explanation:-
Answer: Option C. -> forEach
Question 8. Which of the following are not valid lambda expressions?
() -> {}
() -> Raoul"
() -> {return Mario";}
(Integer i) -> return Alan" + i;
Explanation:-
Answer: Option C. -> () -> {return Mario";}
Question 9. Functional interfaces can be annotated as
Function
FunctionalInterface
Functional
Interface
Explanation:-
Answer: Option B. -> FunctionalInterface
Question 10. Given a class named student, which of the following is a valid constructor declaration for the class?