Test Java Functional Programming (Lambda & Stream) skills

180+ questions on Inner classes, Lambda expressions, Method References, Functional Interfaces & Stream API

3.60 (22 reviews)
Udemy
platform
English
language
Programming Languages
category
instructor
Test Java Functional Programming (Lambda & Stream) skills
275
students
182 questions
content
Apr 2024
last update
$39.99
regular price

What you will learn

Java Inner Class Concepts

Java Functional Programming including : Lambda, Method Reference and Built-in Interfaces

Stream API

Why take this course?

Learning is incomplete without challenging questions to assess the knowledge gained. There are courses and books available on Functional Programming & Stream API, which cover these topics in detail, but simply watching the video lectures or finishing the book will not give enough confidence unless the knowledge is validated.

Practice tests in this course will not only help you to assess your current knowledge of these topics but will also help you to revise the topics quickly. Questions are designed to challenge your understanding of the topics. Detailed explanations for all the questions are also provided for your reference. 

Functional programming is not a new concept. Lambdas were implemented in other languages much before they were introduced in Java.

Before JDK 8, anonymous inner classes with a single method was the closest Java came to functional programming but with lots of boilerplate code. If anyone wants to really appreciate the implementation of lambda expressions in java, it is necessary to know the anonymous inner classes in depth and to understand anonymous inner class you need to have knowledge of Regular and method-local inner classes. 

You may face lots of questions in interviews or written tests where you are asked to convert anonymous inner class syntax to lambda expression and vice versa. Therefore, I decided to start with questions on inner classes and then go on with Lambda expression, method references, built-in functional interfaces and finally end this test series with questions on Stream API. 


1st practice test covers questions on:

  • Regular Inner class:


    1.  Regular inner class and its syntax 

    2.  Usage of this reference with Regular inner classes 

    3.  Shadowing of Outer class variable by Inner class variable 

    4.  Allowed access and non-access modifiers for Regular inner class 

    5.  Accessing Regular inner class's name from within outer class and outside of outer class 

    6.  Instantiating Regular inner class 

    7.  Allowed and not allowed components inside a Regular inner class


  • Method-local inner class:


    1.  Method-local inner class and its syntax 

    2.  Modifiers used with method local inner classes 

    3.  Relationship between method local inner class and top-level class 

    4.  Where to create the instance of method local inner class? 

    5.  Usage of local variables with method-local inner class 


  • Anonymous inner class:


    1.  Syntax of anonymous inner class 

    2.  Inheritance and Polymorphism with anonymous inner class 

    3.  Defining non-overriding methods in anonymous inner classes 

    4.  Instance of anonymous inner class can be assigned to static variable, instance variable, local variable, method parameter and return value 

    5.  Anonymous inner class extending from concrete class or abstract class or implementing an interface 

    6.  Constructors and anonymous inner class

  • Static nested class:


    1.  Syntax of static nested class 

    2.  Accessing instance and static members of static nested class 

    3.  Allowed access modifiers with static nested class 

    4.  Nested interface defined within a class 

    5. Nested interface and nested class defined within an interface


2nd practice test will test, how well you know lambda expressions.

2nd Practice test covers questions on:

  • Lambda expression and its syntax

  • Arrow (->) operator

  • Simplified Lambda expression syntax

  • @FunctionalInterface annotation

  • Requirements for an interface to be a Functional interface

  • Convert anonymous inner class code to Lambda expression

  • this within anonymous inner class vs this within lambda expression

  • Usage of local variables with Lambda expression


Once you are comfortable with lambda expressions, then you can take 3rd practice test to assess your method references concepts. 

3rd Practice test covers questions on:

  • Method reference and its syntax

  • Double colon (::) operator

  • 4 types of method references:

  •  Method Reference to Constructor

  •  Method Reference to Static Method

  •  Method reference to an Instance Method of a Particular Object

  •  Method Reference to an Instance Method of an Arbitrary Object of a Particular Type 

  • Possibility of ambiguous call when a method reference syntax refers to both static and instance method of the class


Java 8 has provided various built-in functional interfaces, out of which 4 are most important and rest are dependent upon these 4 interfaces. 

4th practice test covers questions on:

  • Supplier interface

  • Consumer interface and its default method: andThen

  • Predicate interface and its default methods: and, or, negate

  • Function interface and its default methods: compose, andThen 

  • Comparator interface, its static method: comparing and default methods: thenComparing, reversed


Stream API made the life of Java developers a lot easier.

5th practice test covers questions on:

  • Generic Stream interface and its primitive counterparts

  • Creating sequential streams

  • Important methods of Stream interface

  • Generic Optional class and its primitive counterparts

  • Convert arrays and collections to streams

  • Sort a collection using Stream API


After Stream support in Collection API, processing collection elements became a lot easier. Parallel streams can run tasks in parallel without writing cumbersome logic.

6th practice test covers questions on:

  • Method stream() of Collection interface

  • Save results to a collection using the collect method and group/partition data using the Collectors class

  • forEach(Consumer) method of Iterator<T> interface

  • Convert arrays and collections to streams

  • stream() and parallelStream() methods of Collection interface

  • parallel() and sequential() method of Stream interface

  • Behavior of various methods such as forEach, reduce, forEachOrdered, findFirst with parallel streams

NOTE: All the codes in this practice test are tested against JDK 8.


So, grab a cup of coffee or your favourite drink and test your Java Functional Programming skills.

Features of Practice Tests:

  • You can pause the test at any time and resume later.

  • You can retake the test as many times as you would like.

  • The progress bar at the top of the screen will show your progress as well as the time remaining in the test. If you run out of time, don’t worry; you will still be able to finish the test.

  • You can skip a question to come back to at the end of the exam.

  • You can also use “Mark for Review” to come back to questions you are unsure about before you submit your test.

  • If you want to finish the test and see your results immediately, press the stop button.


Copyright 2024 Udayan Khattry

All rights reserved. No part of this course may be reproduced in any form or by any electronic or mechanical means, including information storage and retrieval systems, without permission in writing from the author.

Reviews

Rohan
February 12, 2018
This is what I was looking for and these questions really tested my knowledge of Lambdas. I am impressed with the quality of the questions and explanations given for each of the questions. Nothing less than 5 STAR for this course. Would like to see questions on Streams as well.

Charts

Price

Test Java Functional Programming (Lambda & Stream) skills - Price chart

Rating

Test Java Functional Programming (Lambda & Stream) skills - Ratings chart

Enrollment distribution

Test Java Functional Programming (Lambda & Stream) skills - Distribution chart
1442492
udemy ID
11/22/2017
course created date
11/23/2019
course indexed date
Bot
course submited by