# Question Set 2

## Java Programming

* What is covariant?
* Real life examples of features of OOPS.
* What are wrapper classes?
* Write a implementation for Predicate functional interface
* Functional Interface implementation Dynamically with Lambda
* Junit Test case for addition of two numbers
* Difference between Java 7 and Java 8.
* How to clone an object in Java?
* Can a static inner class be present within a non-static class?
* When do you get the ClassNotFound error in Java?
* Does Java have pointers or references?
* What is the difference between i++ and ++i in Java?
* What is the Collections class and Arrays class in Java?
* Maven exclusion and scope related questions
* Reflection in Java.
* What is an Enum in Java?
* What is the Map collection in Java?
* Difference between Enumerator and Iterator in Java
* What is the difference between a static block and instance block in Java?
* What is Generics in Java and how to implement mutable and immutable objects?

## Collections & Data Structures

* Explain List, ArrayList and Set
* Comparison of HashSet and HashMap in Java
* What is the internal working of HashMap and HashSet in Java?
* What is collision in HashMap/Hashtable in Java?
* What is the use of Optional feature in Java 8? Can you provide an example?
* What is the hierarchy of Collection and Exception classes in Java?

## Strings & Memory Management

* String compare and string constant pool questions
* How to check equality of two string literals
* Why is String immutable if it can be assigned a new value?
* How string variables are stored in memory?
* What happens if a new variable is created with the same value?
* How memory is allocated to String?

## Exception Handling

* Explain ConcurrentModificationException
* Revisit [checked and unchecked exceptions](../java-spring-boot#explain-checked-and-unchecked-exceptions.).
* Exception hierarchy and why Throwable is used.
* How to create custom exceptions.
* Types of exception handling.
* Checked vs unchecked exceptions.
* Throw vs Throws vs Throwable.
* Deciding between Checked or Unchecked exceptions for user defined exceptions

## Java 8 Features

* Parallel Stream
* Functional Interface
* Difference between Stream API and Collections framework
* Why static methods introduced in Interface from Java 8?
* Can one functional interface extend another functional interface?
* What is the difference between intermediate and terminal operation in stream API?
* Map and filter
* Functional Interface
* Stream API
* How to group elements in a stream using GroupBy?
* How to sort elements in a stream using Sorted?
* What are Terminal and Intermediary operations in the Stream API?

## Concurrency

* What is future in Executor framework
* Difference between submit and execute methods
* How to use execute methods
* Synchronization topic: serialized vs. synchronized and ways to achieve synchronization.
* Threads: Thread limit, executor, etc.

## Design Patterns

* Explain factory design pattern
* What are design patterns
* Explain design patterns used in your application with code

## SQL

* SQL question to find the student with maximum cost

## Microservices

* What is Microservice
* Command used to access a container
* Kubernetes commands
* What is Kubernetes and its function
* Producer, consumer, predicate, supplier
* How to create and manage JMS.
* What is Callable/Future and how to achieve async in Java?
* What is ThreadPoolExecutor and how to manage threads using it?
* How to get the result from an async operation?
* How to handle exceptions from a Runnable?
* What is ExecutorService and how does it differ from Error and Exception?
* How to handle an OutOfMemoryError and what are the workarounds for it?

## Coding

* Write code to get customer accounts by id
* What is REST API
* Conflicting questions about REST methods like POST for response data
* Idempotent in REST API with example
* Java Lambda expression - program to get employees from a List of List of employees whose age is less than 40
* Array Operations: Second max value from array
* Design Patterns: Immutability, singleton

## JPA

* What is JPA
* What is Entity
* What is Entity scan
* ORM framework used
* What is @Qualifier annotation
* What is @Required annotation
* How to use the remove in JPA cascading operations

## Git

* Git merge conflict scenarios
* Git commit scenarios

## JUnit & Testing

* What is Mockito and why it is used
* Explain Junit testing with example
* What is Sonarqube

## Miscellaneous

* What is Normalization in SQL (1NF, 2NF, BCNF, etc.)?
* What is the difference between Pointers and References in C++?
